tazpkg diff tazpkg @ rev 250

tazpkg reconfigure on target dir
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Mar 27 18:23:09 2009 +0000 (2009-03-27)
parents 90af2423ad9f
children 9336438839a4
line diff
     1.1 --- a/tazpkg	Fri Mar 27 17:58:11 2009 +0000
     1.2 +++ b/tazpkg	Fri Mar 27 18:23:09 2009 +0000
     1.3 @@ -174,8 +174,8 @@
     1.4  # Check for the receipt of an installed package.
     1.5  check_for_receipt()
     1.6  {
     1.7 -	if [ ! -f "$INSTALLED/$PACKAGE/receipt" ]; then
     1.8 -		echo -e "\nUnable to find the receipt : $INSTALLED/$PACKAGE/receipt\n"
     1.9 +	if [ ! -f "$1$INSTALLED/$PACKAGE/receipt" ]; then
    1.10 +		echo -e "\nUnable to find the receipt : $1$INSTALLED/$PACKAGE/receipt\n"
    1.11  		exit 0
    1.12  	fi
    1.13  }
    1.14 @@ -2064,14 +2064,27 @@
    1.15  		#
    1.16  		check_for_package_on_cmdline
    1.17  		check_root
    1.18 -		if [ -d "$INSTALLED/$PACKAGE" ]; then
    1.19 -			check_for_receipt
    1.20 +		ROOT=""
    1.21 +		while [ -n "$3" ]; do
    1.22 +			case "$3" in
    1.23 +			--root=*)
    1.24 +				ROOT="${3#--root=}/"
    1.25 +				;;
    1.26 +			*)	shift 2
    1.27 +				echo -e "\nUnknown option $*.\n"
    1.28 +				exit 1
    1.29 +				;;
    1.30 +			esac
    1.31 +			shift
    1.32 +		done
    1.33 +		if [ -d "$ROOT$INSTALLED/$PACKAGE" ]; then
    1.34 +			check_for_receipt $ROOT
    1.35  			# Check for post_install
    1.36 -			if grep -q ^post_install $INSTALLED/$PACKAGE/receipt; then
    1.37 -				. $INSTALLED/$PACKAGE/receipt
    1.38 -				post_install
    1.39 +			if grep -q ^post_install $ROOT$INSTALLED/$PACKAGE/receipt; then
    1.40 +				. $ROOT$INSTALLED/$PACKAGE/receipt
    1.41 +				post_install $ROOT
    1.42  				# Log this activity
    1.43 -				log Reconfigured
    1.44 +				[ -n "$ROOT" ] || log Reconfigured
    1.45  			else 
    1.46  				echo -e "\nNothing to do for $PACKAGE."
    1.47  			fi