tazpkg rev 594

tazpkg: we dont need get_options, libtaz.sh store options by default
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 23 23:36:29 2012 +0200 (2012-04-23)
parents 19a2ab237dfc
children 90038f19958b
files tazpkg
line diff
     1.1 --- a/tazpkg	Sat Apr 14 19:08:47 2012 +0200
     1.2 +++ b/tazpkg	Mon Apr 23 23:36:29 2012 +0200
     1.3 @@ -151,6 +151,7 @@
     1.4  	if test $(id -u) = 0 ; then
     1.5  		check_dir $1$CACHE_DIR
     1.6  		check_dir $1$INSTALLED
     1.7 +		check_dir $1$SLITAZ_LOGS
     1.8  		if [ ! -f "$1$LOCALSTATE/mirror" ]; then
     1.9  			echo "$DEFAULT_MIRROR" > $1$LOCALSTATE/mirror
    1.10  			[ -n "$1" ] && cp $LOCALSTATE/packages.* $1$LOCALSTATE/
    1.11 @@ -159,28 +160,6 @@
    1.12  }
    1.13  check_base_dir
    1.14  
    1.15 -# Store -- options in a variable.
    1.16 -get_options()
    1.17 -{
    1.18 -	if echo "$log_command" | fgrep -q ' '--help; then
    1.19 -		echo "Available options for $(echo `basename "$log_command"` | cut -d ' ' -f 1,2) : $get_options_list"
    1.20 -		exit 0
    1.21 -	fi
    1.22 -	for get_option in $(echo "$log_command" | tr ' ' '\n' | grep ^-- | sed 's/^--//'); do
    1.23 -		if [ "${get_options_list/${get_option%%=*}}" = "$get_options_list" ]; then
    1.24 -			echo "Option ${get_option%%=*} is incorrect, valid options are : $get_options_list". >&2
    1.25 -			exit 1
    1.26 -		fi
    1.27 -		if [ "$get_option" = "${get_option/=}" ]; then
    1.28 -			export $get_option=yes
    1.29 -			export opts="$opts --$get_option"
    1.30 -		else
    1.31 -			export $get_option
    1.32 -			export opts="$opts --$get_option"
    1.33 -		fi
    1.34 -	done
    1.35 -}
    1.36 -
    1.37  # Check for a package name on cmdline.
    1.38  check_for_package_on_cmdline()
    1.39  {
    1.40 @@ -1826,9 +1805,6 @@
    1.41  		check_for_package_on_cmdline
    1.42  		check_for_package_file
    1.43  		
    1.44 -		get_options_list="root forced list rootconfig"
    1.45 -		get_options
    1.46 -		
    1.47  		[ "$root" ] && ROOT="$root" && check_base_dir "$root"
    1.48  		[ "$list" ] && INSTALL_LIST="$list"
    1.49  		if [ "$rootconfig" ]; then
    1.50 @@ -1934,8 +1910,7 @@
    1.51  		# Remove packages.
    1.52  		check_root
    1.53  		check_for_package_on_cmdline
    1.54 -		get_options_list="root auto"
    1.55 -		get_options
    1.56 +		
    1.57  		[ "$root" ] && ROOT="$root" 
    1.58  		if [ ! -f "$ROOT$INSTALLED/$PACKAGE/receipt" ]; then
    1.59  			echo ""
    1.60 @@ -2016,9 +1991,9 @@
    1.61  				if [ "$auto" ]; then
    1.62  					answer=`translate_querry y`
    1.63  				else
    1.64 -				eval_gettext "Remove packages depending on \$PACKAGE"
    1.65 -				echo -n " (`translate_querry y`/`translate_querry N`) ? "
    1.66 -				read answer
    1.67 +					eval_gettext "Remove packages depending on \$PACKAGE"
    1.68 +					echo -n " (`translate_querry y`/`translate_querry N`) ? "
    1.69 +					read answer
    1.70  				fi
    1.71  				if [ "$answer" = "$(translate_querry y)" ]; then
    1.72  					for i in $ALTERED; do
    1.73 @@ -2032,9 +2007,9 @@
    1.74  				if [ "$auto" ]; then
    1.75  					answer=`translate_querry y`
    1.76  				else
    1.77 -				eval_gettext "Reinstall packages modified by \$PACKAGE"
    1.78 -				echo -n " (`translate_querry y`/`translate_querry N`) ? "
    1.79 -				read answer
    1.80 +					eval_gettext "Reinstall packages modified by \$PACKAGE"
    1.81 +					echo -n " (`translate_querry y`/`translate_querry N`) ? "
    1.82 +					read answer
    1.83  				fi
    1.84  				if [ "$answer" = "$(translate_querry y)" ]; then
    1.85  					for i in $REFRESH; do
    1.86 @@ -2298,8 +2273,7 @@
    1.87  		# must have only the choosen main mirror.
    1.88  		#
    1.89  		check_root
    1.90 -		get_options_list="root forced list rootconfig"
    1.91 -		get_options
    1.92 +		
    1.93  		ARG=$2
    1.94  		if [ "$root" ]; then
    1.95  			LOCALSTATE=$root$LOCALSTATE
    1.96 @@ -2663,9 +2637,6 @@
    1.97  		check_for_package_on_cmdline
    1.98  		check_for_packages_list
    1.99  		
   1.100 -		get_options_list="root rootconfig"
   1.101 -		get_options
   1.102 -		
   1.103  		[ "$root" ] && ROOT="$root" && check_base_dir "$root"
   1.104  		if [ "$rootconfig" ]; then
   1.105  			if [ "$root" ]; then
   1.106 @@ -2706,18 +2677,6 @@
   1.107  		check_root
   1.108  		check_for_package_on_cmdline
   1.109  		check_for_packages_list
   1.110 -
   1.111 -		get_options_list="root forced list rootconfig"
   1.112 -		get_options
   1.113 -		
   1.114 -		# Install all pkgs specified in argument.
   1.115 -		#for arg in $@
   1.116 -		#do
   1.117 -			#case $arg in
   1.118 -				#-*|get-install) continue ;;
   1.119 -				#*) tazpkg -gi $arg $opts ;;
   1.120 -			#esac
   1.121 -		#done
   1.122  		
   1.123  		DO_CHECK=""
   1.124  		[ "$forced" ] && DO_CHECK=no