tazwok rev 367

Fix block/unblock function
author Antoine Bodin <gokhlayeh@slitaz.org>
date Fri Feb 25 01:26:02 2011 +0100 (2011-02-25)
parents d741a360a291
children ccd7162c0ed1
files tazwok
line diff
     1.1 --- a/tazwok	Fri Feb 25 00:19:26 2011 +0100
     1.2 +++ b/tazwok	Fri Feb 25 01:26:02 2011 +0100
     1.3 @@ -3268,30 +3268,50 @@
     1.4  	;;
     1.5  	block)
     1.6  		# Add a pkg name to the list of blocked packages.
     1.7 +		get_tazwok_config
     1.8 +		check_root
     1.9 +		check_for_package_on_cmdline
    1.10 +		if ! [ -f $WOK/$PACKAGE/receipt ]; then
    1.11 +			echo "Can't find $PACKAGE into wok." >&2
    1.12 +			echo ""	
    1.13 +			exit 1
    1.14 +		fi
    1.15  		echo ""
    1.16 -		if grep -qs "^$2$" $PACKAGES_REPOSITORY/blocked; then
    1.17 -			echo -e "$2 is already in the blocked packages list."
    1.18 +		if grep -qs "^$PACKAGE$" $PACKAGES_REPOSITORY/blocked; then
    1.19 +			echo "$PACKAGE is already in the blocked packages list." >&2
    1.20 +			echo ""
    1.21 +			exit 1
    1.22  		else
    1.23 -			echo -n "Adding $2 to     : $PACKAGES_REPOSITORY/blocked... "
    1.24 -			echo "$2" >> $PACKAGES_REPOSITORY/blocked && echo "Done"
    1.25 -			if grep -q "^$2$" $PACKAGES_REPOSITORY/cooklist; then
    1.26 -				echo -n "Removing $2 from : $DB_DIR/cooklist... "
    1.27 -				sed -i /"^$2$"/d $PACKAGES_REPOSITORY/cooklist && echo "Done"
    1.28 +			echo -n "Adding $PACKAGE to     : $PACKAGES_REPOSITORY/blocked... "
    1.29 +			echo "$PACKAGE" >> $PACKAGES_REPOSITORY/blocked
    1.30 +			status
    1.31 +			if grep -q "^$PACKAGE$" $PACKAGES_REPOSITORY/cooklist; then
    1.32 +				echo -n "Removing $PACKAGE from : $PACKAGES_REPOSITORY/cooklist... "
    1.33 +				sed -i /"^$PACKAGE$"/d $PACKAGES_REPOSITORY/cooklist
    1.34 +				status
    1.35  			fi
    1.36  		fi
    1.37  		echo "" ;;
    1.38  	unblock)
    1.39  		# Remove a pkg name from the list of blocked packages.
    1.40 +		get_tazwok_config
    1.41 +		check_root
    1.42 +		check_for_package_on_cmdline
    1.43 +		if ! [ -f $WOK/$PACKAGE/receipt ]; then
    1.44 +			echo "Can't find $PACKAGE into wok." >&2
    1.45 +			echo ""
    1.46 +			exit 1
    1.47 +		fi
    1.48  		echo ""
    1.49 -		if grep -qs "^$2$" $PACKAGES_REPOSITORY/blocked; then
    1.50 -			echo -n "Removing $2 from : $PACKAGES_REPOSITORY/blocked... "
    1.51 -			sed -i /"^$2$"/d $PACKAGES_REPOSITORY/blocked
    1.52 -			sed -i '/^$/d' $PACKAGES_REPOSITORY/blocked && echo "Done"
    1.53 -			echo -n "Adding $2 to     : $DB_DIR/cooklist... "
    1.54 -			echo "$2" >> $DB_DIR/cooklist && echo "Done"
    1.55 -			sort_cooklist
    1.56 +		if grep -qs "^$PACKAGE$" $PACKAGES_REPOSITORY/blocked; then
    1.57 +			echo -n "Removing $PACKAGE from : $PACKAGES_REPOSITORY/blocked... "
    1.58 +			sed -i /"^$PACKAGE$"/d $PACKAGES_REPOSITORY/blocked
    1.59 +			sed -i '/^$/d' $PACKAGES_REPOSITORY/blocked
    1.60 +			status
    1.61  		else
    1.62 -			echo -e "$2 is not in the blocked packages list."
    1.63 +			echo "$PACKAGE is not in the blocked packages list." >&2
    1.64 +			echo ""
    1.65 +			exit 1
    1.66  		fi
    1.67  		echo "" ;;
    1.68  	usage|*)