tazpkg diff modules/remove @ rev 846
Remove "busybox" "prefixes" (thanks llev)
We used "busybox wget", etc. to be sure we called Busybox's "wget", not any other "wget". Workaround already done in "getenv" module.
We used "busybox wget", etc. to be sure we called Busybox's "wget", not any other "wget". Workaround already done in "getenv" module.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Oct 09 13:14:01 2015 +0300 (2015-10-09) |
parents | a02e36d44d06 |
children | b6daeaa95431 |
line diff
1.1 --- a/modules/remove Fri Aug 28 16:10:34 2015 +0300 1.2 +++ b/modules/remove Fri Oct 09 13:14:01 2015 +0300 1.3 @@ -45,6 +45,39 @@ 1.4 im() { tty -s; } 1.5 1.6 1.7 +# Block of receipt function callers 1.8 +# Why? "Bad" receipt sourcing can redefine some vital TazPkg variables. 1.9 +# Few receipts function should be patched now. 1.10 + 1.11 +# Input: $1 = path to the receipt to be processed 1.12 + 1.13 +call_pre_remove() { 1.14 + local tmp 1.15 + if grep -q '^pre_remove()' "$1"; then 1.16 + action 'Execute pre-remove commands...' 1.17 + tmp="$(mktemp)" 1.18 + cp "$1" "$tmp" 1.19 + sed -i 's|$1/*$INSTALLED|$INSTALLED|g' "$tmp" 1.20 + ( . "$tmp"; pre_remove "$root" ) 1.21 + status 1.22 + rm "$tmp" 1.23 + fi 1.24 +} 1.25 + 1.26 +call_post_remove() { 1.27 + local tmp 1.28 + if grep -q '^post_remove()' "$1"; then 1.29 + action 'Execute post-remove commands...' 1.30 + tmp="$(mktemp)" 1.31 + cp "$1" "$tmp" 1.32 + sed -i 's|$1/*$INSTALLED|$INSTALLED|g' "$tmp" 1.33 + ( . "$tmp"; post_remove "$root" ) 1.34 + status 1.35 + rm "$tmp" 1.36 + fi 1.37 +} 1.38 + 1.39 + 1.40 1.41 1.42 PACKAGE="$1" 1.43 @@ -88,11 +121,8 @@ 1.44 title 'Removing package "%s"' "$PACKAGE" 1.45 1.46 # [1/4] Pre-remove commands 1.47 -if grep -q ^pre_remove "$INSTALLED/$PACKAGE/receipt"; then 1.48 - action 'Execution of pre-remove commands...' 1.49 - pre_remove 1.50 - status 1.51 -fi 1.52 +call_pre_remove "$INSTALLED/$PACKAGE/receipt" 1.53 + 1.54 1.55 # [2/4] Removing files 1.56 action 'Removing all files installed...' 1.57 @@ -115,11 +145,7 @@ 1.58 status 1.59 1.60 # [3/4] Post-remove commands 1.61 -if grep -q ^post_remove "$INSTALLED/$PACKAGE/receipt"; then 1.62 - action 'Execution of post-remove commands...' 1.63 - post_remove 1.64 - status 1.65 -fi 1.66 +call_post_remove "$INSTALLED/$PACKAGE/receipt" 1.67 1.68 # [4/4] Remove package receipt and remove it from databases 1.69 action 'Removing package receipt...'