tazpkg rev 700

/etc/slitaz/slitaz.conf tells that $LOCALSTATE is an OLD variable and equals to $PKGS_DB, so change code.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Dec 04 01:41:59 2014 +0200 (2014-12-04)
parents 1b791f0f9239
children 56a4afc8d5fa
files pkgs.cgi tazpkg tazpkg-find-depends
line diff
     1.1 --- a/pkgs.cgi	Thu Dec 04 01:23:47 2014 +0200
     1.2 +++ b/pkgs.cgi	Thu Dec 04 01:41:59 2014 +0200
     1.3 @@ -26,8 +26,8 @@
     1.4  
     1.5  i18n_desc() {
     1.6  	# Display localized short description
     1.7 -	if [ -e "$LOCALSTATE/packages-desc.$LANG" ]; then
     1.8 -		LOCDESC=$(grep -e "^$pkg	" $LOCALSTATE/packages-desc.$LANG | cut -d'	' -f2)
     1.9 +	if [ -e "$PKGS_DB/packages-desc.$LANG" ]; then
    1.10 +		LOCDESC=$(grep -e "^$pkg	" $PKGS_DB/packages-desc.$LANG | cut -d'	' -f2)
    1.11  	[ "x$LOCDESC" != "x" ] && SHORT_DESC="$LOCDESC"
    1.12  	fi
    1.13  }
    1.14 @@ -61,9 +61,9 @@
    1.15  <tbody>
    1.16  <tr><td>$(gettext 'Last recharge:')</td>
    1.17  EOT
    1.18 -	stat=$(stat -c %y $LOCALSTATE/packages.list | \
    1.19 +	stat=$(stat -c %y $PKGS_DB/packages.list | \
    1.20  		sed 's/\(:..\):.*/\1/' | awk '{print $1}')
    1.21 -	mtime=$(find $LOCALSTATE/packages.list -mtime +10)
    1.22 +	mtime=$(find $PKGS_DB/packages.list -mtime +10)
    1.23  	echo -n "<td>$stat "
    1.24  	if [ "$mtime" ]; then
    1.25  		gettext '(Older than 10 days)'; echo
    1.26 @@ -75,13 +75,13 @@
    1.27  <tr><td>$(gettext 'Installed packages:')</td>
    1.28  	<td>$(ls $INSTALLED | wc -l)</td></tr>
    1.29  <tr><td>$(gettext 'Mirrored packages:')</td>
    1.30 -	<td>$(cat $LOCALSTATE/packages.list | wc -l)</td></tr>
    1.31 +	<td>$(cat $PKGS_DB/packages.list | wc -l)</td></tr>
    1.32  <tr><td>$(gettext 'Upgradeable packages:')</td>
    1.33 -	<td>$(cat $LOCALSTATE/packages.up | wc -l)</td></tr>
    1.34 +	<td>$(cat $PKGS_DB/packages.up | wc -l)</td></tr>
    1.35  <tr><td>$(gettext 'Installed files:')</td>
    1.36  	<td>$(cat $INSTALLED/*/files.list | wc -l)</td></tr>
    1.37  <tr><td>$(gettext 'Blocked packages:')</td>
    1.38 -	<td>$(cat $LOCALSTATE/blocked-packages.list | wc -l)</td></tr>
    1.39 +	<td>$(cat $PKGS_DB/blocked-packages.list | wc -l)</td></tr>
    1.40  </tbody>
    1.41  </table>
    1.42  EOT
    1.43 @@ -107,7 +107,7 @@
    1.44  
    1.45  # Parse repositories list to be able to have an icon and remove link
    1.46  list_repos() {
    1.47 -	ls $LOCALSTATE/undigest 2> /dev/null | while read repo ; do
    1.48 +	ls $PKGS_DB/undigest 2> /dev/null | while read repo ; do
    1.49  		cat <<EOT
    1.50  	<li><a href="$SCRIPT_NAME?admin=rm-repo=$repo">
    1.51  	    <img src="$IMAGES/clear.png">$repo</a></li>
    1.52 @@ -174,13 +174,13 @@
    1.53  	<a class="active_extra" href="$SCRIPT_NAME?cat=extra&repo=$repo">$(gettext 'extra')</a>
    1.54  EOT
    1.55  
    1.56 -	if [ -d $LOCALSTATE/undigest ]; then
    1.57 +	if [ -d $PKGS_DB/undigest ]; then
    1.58  		[ -n "$category" ] || category="base-system"
    1.59  		cat << EOT
    1.60  	<h4>$(gettext 'Repositories')</h4>
    1.61  	<a class="repo_Public" href="$SCRIPT_NAME?repo=Public&cat=$category">$(gettext 'Public')</a>
    1.62  EOT
    1.63 -		for i in $(ls $LOCALSTATE/undigest); do
    1.64 +		for i in $(ls $PKGS_DB/undigest); do
    1.65  			cat << EOT
    1.66  	<a class="repo_$i" href="$SCRIPT_NAME?repo=$i&cat=$category">$i</a>
    1.67  EOT
    1.68 @@ -193,23 +193,23 @@
    1.69  }
    1.70  
    1.71  repo_list() {
    1.72 -	if [ -n "$(ls $LOCALSTATE/undigest/ 2> /dev/null)" ]; then
    1.73 +	if [ -n "$(ls $PKGS_DB/undigest/ 2> /dev/null)" ]; then
    1.74  		case "$repo" in
    1.75  		Public)	;;
    1.76 -		""|Any) for i in $LOCALSTATE/undigest/* ; do
    1.77 +		""|Any) for i in $PKGS_DB/undigest/* ; do
    1.78  				[ -d "$i" ] && echo "$i$1"
    1.79  			done ;;
    1.80 -		*)	echo "$LOCALSTATE/undigest/$repo$1"
    1.81 +		*)	echo "$PKGS_DB/undigest/$repo$1"
    1.82  			return ;;
    1.83  		esac
    1.84  	fi
    1.85 -	echo "$LOCALSTATE$1"
    1.86 +	echo "$PKGS_DB$1"
    1.87  }
    1.88  
    1.89  repo_name() {
    1.90  	case "$1" in
    1.91 -	$LOCALSTATE)		echo "Public" ;;
    1.92 -	$LOCALSTATE/undigest/*)	echo ${1#$LOCALSTATE/undigest/} ;;
    1.93 +	$PKGS_DB)		echo "Public" ;;
    1.94 +	$PKGS_DB/undigest/*)	echo ${1#$PKGS_DB/undigest/} ;;
    1.95  	esac
    1.96  }
    1.97  
    1.98 @@ -257,7 +257,7 @@
    1.99  			# Use default tazpkg icon since all packages displayed are
   1.100  			# installed
   1.101  			colorpkg=$pkg
   1.102 -			grep -qs "^$pkg$" $LOCALSTATE/blocked-packages.list &&
   1.103 +			grep -qs "^$pkg$" $PKGS_DB/blocked-packages.list &&
   1.104  				colorpkg="<span style='color: red;'>$pkg</span>"
   1.105  			i18n_desc
   1.106  			cat << EOT
   1.107 @@ -310,7 +310,7 @@
   1.108  $(table_head)
   1.109  <tbody>
   1.110  EOT
   1.111 -		target=$(readlink $LOCALSTATE/fslink)
   1.112 +		target=$(readlink $PKGS_DB/fslink)
   1.113  		for pkg in $(ls $target/$INSTALLED)
   1.114  		do
   1.115  			[ -s $pkg/receipt ] && continue
   1.116 @@ -342,7 +342,7 @@
   1.117  		# List all available packages by category on mirror. Listing all
   1.118  		# packages is too resource intensive and not useful.
   1.119  		#
   1.120 -		cd  $LOCALSTATE
   1.121 +		cd  $PKGS_DB
   1.122  		repo=$(GET repo)
   1.123  		category=$(GET cat)
   1.124  		[ "$category" == "cat" ] && category="base-system"
   1.125 @@ -405,7 +405,7 @@
   1.126  		#
   1.127  		pkg=$(GET search)
   1.128  		repo=$(GET repo)
   1.129 -		cd  $LOCALSTATE
   1.130 +		cd  $PKGS_DB
   1.131  		search_form
   1.132  		sidebar | sed "s/repo_$repo/active/"
   1.133  		LOADING_MSG="$(gettext 'Searching packages...')"
   1.134 @@ -514,7 +514,7 @@
   1.135  		#
   1.136  		# Upgrade packages
   1.137  		#
   1.138 -		cd $LOCALSTATE
   1.139 +		cd $PKGS_DB
   1.140  		search_form
   1.141  		sidebar
   1.142  		LOADING_MSG="$(gettext 'Checking for upgrades...')"
   1.143 @@ -546,8 +546,8 @@
   1.144  EOT
   1.145  		for pkg in `cat packages.up`
   1.146  		do
   1.147 -			grep -hs "^$pkg |" $LOCALSTATE/packages.desc \
   1.148 -				$LOCALSTATE/undigest/*/packages.desc | \
   1.149 +			grep -hs "^$pkg |" $PKGS_DB/packages.desc \
   1.150 +				$PKGS_DB/undigest/*/packages.desc | \
   1.151  				parse_packages_desc
   1.152  		done
   1.153  		cat << EOT
   1.154 @@ -576,7 +576,7 @@
   1.155  				LOADING_MSG="get-installing packages..."
   1.156  				;;
   1.157  			link)
   1.158 -				opt=$(readlink $LOCALSTATE/fslink)
   1.159 +				opt=$(readlink $PKGS_DB/fslink)
   1.160  				LOADING_MSG="linking packages..."
   1.161  				;;
   1.162  		esac
   1.163 @@ -623,7 +623,7 @@
   1.164  			action="Remove"
   1.165  			action_i18n=$(gettext 'Remove')
   1.166  		else
   1.167 -			cd  $LOCALSTATE
   1.168 +			cd  $PKGS_DB
   1.169  			LOADING_MSG=$(gettext 'Getting package info...')
   1.170  			loading_msg
   1.171  			IFS='|'
   1.172 @@ -654,7 +654,7 @@
   1.173  		fi
   1.174  
   1.175  		if [ -d $INSTALLED/$pkg ]; then
   1.176 -			if grep -qs "^$pkg$" $LOCALSTATE/blocked-packages.list; then
   1.177 +			if grep -qs "^$pkg$" $PKGS_DB/blocked-packages.list; then
   1.178  				cat << EOT
   1.179  			<a class="button" href="$SCRIPT_NAME?do=Unblock&$pkg">$(gettext 'Unblock')</a>
   1.180  EOT
   1.181 @@ -759,7 +759,7 @@
   1.182  			add-repo)
   1.183  				# Decode url
   1.184  				mirror=$(GET mirror)
   1.185 -				repository=$LOCALSTATE/undigest/$(GET repository)
   1.186 +				repository=$PKGS_DB/undigest/$(GET repository)
   1.187  				case "$mirror" in
   1.188  				http://*|ftp://*)
   1.189  					mkdir -p $repository
   1.190 @@ -768,13 +768,13 @@
   1.191  				esac ;;
   1.192  			rm-repo=*)
   1.193  				repository=${cmd#rm-repo=}
   1.194 -				rm -rf $LOCALSTATE/undigest/$repository ;;
   1.195 +				rm -rf $PKGS_DB/undigest/$repository ;;
   1.196  		esac
   1.197  		[ "$cmd" == "$(gettext 'Set link')" ] &&
   1.198  			[ -d "$(GET link)/$INSTALLED" ] &&
   1.199 -			ln -fs $(GET link) $LOCALSTATE/fslink
   1.200 +			ln -fs $(GET link) $PKGS_DB/fslink
   1.201  		[ "$cmd" == "$(gettext 'Remove link')" ] &&
   1.202 -			rm -f $LOCALSTATE/fslink
   1.203 +			rm -f $PKGS_DB/fslink
   1.204  		cache_files=`find /var/cache/tazpkg -name *.tazpkg | wc -l`
   1.205  		cache_size=`du -sh /var/cache/tazpkg`
   1.206  		sidebar
   1.207 @@ -848,10 +848,10 @@
   1.208  
   1.209  <h3>$(gettext 'Current mirror list')</h3>
   1.210  EOT
   1.211 -		for i in $LOCALSTATE/mirrors $LOCALSTATE/undigest/*/mirrors; do
   1.212 +		for i in $PKGS_DB/mirrors $PKGS_DB/undigest/*/mirrors; do
   1.213  			[ -s $i ] || continue
   1.214  			echo '<div class="box">'
   1.215 -			if [ $i != $LOCALSTATE/mirrors ]; then
   1.216 +			if [ $i != $PKGS_DB/mirrors ]; then
   1.217  				Repo_Name="$(repo_name $(dirname $i))"
   1.218  				echo "<h4>$(eval_gettext 'Repository: $Repo_Name')</h4>"
   1.219  			fi
   1.220 @@ -871,7 +871,7 @@
   1.221  EOT
   1.222  		done
   1.223  		echo "<h3>$(gettext 'Private repositories')</h3>"
   1.224 -		[ -n "$(ls $LOCALSTATE/undigest 2> /dev/null)" ] && cat << EOT
   1.225 +		[ -n "$(ls $PKGS_DB/undigest 2> /dev/null)" ] && cat << EOT
   1.226  <div class="box">
   1.227  	<ul>
   1.228  		$(list_repos)
   1.229 @@ -898,7 +898,7 @@
   1.230  <p>
   1.231  	<input type="hidden" name="admin" value="add-link" />
   1.232  	<input type="text" name="link"
   1.233 -	 value="$(readlink $LOCALSTATE/fslink 2> /dev/null)" size="50">
   1.234 +	 value="$(readlink $PKGS_DB/fslink 2> /dev/null)" size="50">
   1.235  	<input type="submit" name="admin" value="$(gettext 'Set link')" />
   1.236  	<input type="submit" name="admin" value="$(gettext 'Remove link')" />
   1.237  </p>
   1.238 @@ -969,7 +969,7 @@
   1.239  	<a class="button" href="$SCRIPT_NAME?list">
   1.240  		<img src="$IMAGES/tazpkg.png" />$(gettext 'My packages')</a>
   1.241  EOT
   1.242 -		fslink=$(readlink $LOCALSTATE/fslink)
   1.243 +		fslink=$(readlink $PKGS_DB/fslink)
   1.244  		[ -n "$fslink" -a -d "$fslink/$INSTALLED" ] &&
   1.245  			cat << EOT
   1.246  	<a class="button" href="$SCRIPT_NAME?linkable">
     2.1 --- a/tazpkg	Thu Dec 04 01:23:47 2014 +0200
     2.2 +++ b/tazpkg	Thu Dec 04 01:41:59 2014 +0200
     2.3 @@ -112,9 +112,9 @@
     2.4  SAVE_CACHE_DIR="$CACHE_DIR"
     2.5  
     2.6  # Path to tazpkg used dir and configuration files
     2.7 -MIRROR=$LOCALSTATE/mirror
     2.8 -BLOCKED=$LOCALSTATE/blocked-packages.list
     2.9 -UP_LIST=$LOCALSTATE/packages.up
    2.10 +MIRROR=$PKGS_DB/mirror
    2.11 +BLOCKED=$PKGS_DB/blocked-packages.list
    2.12 +UP_LIST=$PKGS_DB/packages.up
    2.13  DEFAULT_MIRROR="$ONLINE_PKGS"
    2.14  
    2.15  
    2.16 @@ -225,9 +225,9 @@
    2.17  		check_dir $1$CACHE_DIR
    2.18  		check_dir $1$INSTALLED
    2.19  		check_dir $1$SLITAZ_LOGS
    2.20 -		if [ ! -f "$1$LOCALSTATE/mirror" ]; then
    2.21 -			echo "${DEFAULT_MIRROR%/}/" > $1$LOCALSTATE/mirror
    2.22 -			[ -n "$1" ] && cp $LOCALSTATE/packages.* $1$LOCALSTATE/
    2.23 +		if [ ! -f "$1$PKGS_DB/mirror" ]; then
    2.24 +			echo "${DEFAULT_MIRROR%/}/" > $1$PKGS_DB/mirror
    2.25 +			[ -n "$1" ] && cp $PKGS_DB/packages.* $1$PKGS_DB/
    2.26  		fi
    2.27  	fi
    2.28  }
    2.29 @@ -274,25 +274,25 @@
    2.30  }
    2.31  
    2.32  
    2.33 -# Get repositories priority using $LOCALSTATE/priority.
    2.34 +# Get repositories priority using $PKGS_DB/priority.
    2.35  # In this files, undigest are called by their name and main mirror
    2.36  # by main. Sort order: priority
    2.37  
    2.38  look_for_priority()
    2.39  {
    2.40 -	[ -s $LOCALSTATE/priority ] && priority=$(cat $LOCALSTATE/priority)
    2.41 -	for rep in main $(ls $LOCALSTATE/undigest 2>/dev/null); do
    2.42 -		if [ ! -s $LOCALSTATE/priority ] || \
    2.43 -			! grep -q ^$rep$ $LOCALSTATE/priority; then
    2.44 +	[ -s $PKGS_DB/priority ] && priority=$(cat $PKGS_DB/priority)
    2.45 +	for rep in main $(ls $PKGS_DB/undigest 2>/dev/null); do
    2.46 +		if [ ! -s $PKGS_DB/priority ] || \
    2.47 +			! grep -q ^$rep$ $PKGS_DB/priority; then
    2.48  			priority=$(echo -e "$priority\n$rep")
    2.49  		fi
    2.50  	done
    2.51  	priority=$(echo "$priority" | sed '/^$/d' | \
    2.52  		while read line; do
    2.53  		if [ "$line" = main ]; then
    2.54 -			echo $LOCALSTATE
    2.55 +			echo $PKGS_DB
    2.56  		else
    2.57 -			echo $LOCALSTATE/undigest/$line
    2.58 +			echo $PKGS_DB/undigest/$line
    2.59  		fi
    2.60  	done)
    2.61  }
    2.62 @@ -344,7 +344,7 @@
    2.63  
    2.64  check_for_packages_list()
    2.65  {
    2.66 -	list_path="$LOCALSTATE/packages.list"
    2.67 +	list_path="$PKGS_DB/packages.list"
    2.68  	if [ ! -f "$list_path" ]; then
    2.69  		if test $(id -u) = 0 ; then
    2.70  			tazpkg recharge
    2.71 @@ -364,7 +364,7 @@
    2.72  get_cache_dir()
    2.73  {
    2.74  	echo $rep > $tmp/rep
    2.75 -	if [ "$rep" = "$LOCALSTATE" ]; then
    2.76 +	if [ "$rep" = "$PKGS_DB" ]; then
    2.77  		CACHE_DIR="$SAVE_CACHE_DIR/$SLITAZ_RELEASE/packages"
    2.78  	elif [ "${rep%-incoming}" = "$rep" ]; then
    2.79  		CACHE_DIR="$SAVE_CACHE_DIR/${rep##*/}/packages"
    2.80 @@ -381,8 +381,8 @@
    2.81  
    2.82  equivalent_pkg()
    2.83  {
    2.84 -	for i in $(grep -hs "^$1=" $LOCALSTATE/packages.equiv \
    2.85 -		   $LOCALSTATE/undigest/*/packages.equiv | sed "s/^$1=//"); do
    2.86 +	for i in $(grep -hs "^$1=" $PKGS_DB/packages.equiv \
    2.87 +		   $PKGS_DB/undigest/*/packages.equiv | sed "s/^$1=//"); do
    2.88  		if echo $i | fgrep -q : ; then
    2.89  			# format 'alternative:newname'
    2.90  			# if alternative is installed then substitute newname
    2.91 @@ -491,7 +491,7 @@
    2.92  	local extra
    2.93  
    2.94  	[ "$1" = "Installed" ] && \
    2.95 -	extra=" - $(fgrep $PACKAGE-$VERSION $LOCALSTATE/installed.$SUM | awk '{ print $1 }')"
    2.96 +	extra=" - $(fgrep $PACKAGE-$VERSION $PKGS_DB/installed.$SUM | awk '{ print $1 }')"
    2.97  
    2.98  	[ -e $LOG ] || touch $LOG
    2.99  
   2.100 @@ -624,9 +624,9 @@
   2.101  		cp $TMP_DIR/files.list $ROOT$INSTALLED/$PACKAGE 2> /dev/null
   2.102  		rm -rf $TMP_DIR 2> /dev/null
   2.103  		sed -i "/ $(basename $PACKAGE_FILE)$/d" \
   2.104 -			$ROOT$LOCALSTATE/installed.$SUM 2> /dev/null
   2.105 +			$ROOT$PKGS_DB/installed.$SUM 2> /dev/null
   2.106  		cd $(dirname $PACKAGE_FILE)
   2.107 -		$CHECKSUM $(basename $PACKAGE_FILE) >> $ROOT$LOCALSTATE/installed.$SUM
   2.108 +		$CHECKSUM $(basename $PACKAGE_FILE) >> $ROOT$PKGS_DB/installed.$SUM
   2.109  	}
   2.110  
   2.111  	# Resolve package deps.
   2.112 @@ -635,7 +635,7 @@
   2.113  		install_deps $ROOT
   2.114  	fi
   2.115  	mkdir -p $TMP_DIR
   2.116 -	[ -n "$INSTALL_LIST" ] && echo "$PACKAGE_FILE" >> $ROOT$LOCALSTATE/$INSTALL_LIST-processed
   2.117 +	[ -n "$INSTALL_LIST" ] && echo "$PACKAGE_FILE" >> $ROOT$PKGS_DB/$INSTALL_LIST-processed
   2.118  
   2.119  	title 'Installation of: $PACKAGE'
   2.120  
   2.121 @@ -1005,7 +1005,7 @@
   2.122  				fi
   2.123  				# Install deps from the mirror.
   2.124  				if [ $found -eq 0 ]; then
   2.125 -					if [ ! -f "$LOCALSTATE/packages.list" ]; then
   2.126 +					if [ ! -f "$PKGS_DB/packages.list" ]; then
   2.127  						tazpkg recharge
   2.128  					fi
   2.129  					tazpkg get-install $pkg $root
   2.130 @@ -1058,11 +1058,11 @@
   2.131  	separator
   2.132  	num=0
   2.133  	BPATTERN="$(emsg "<b>$PATTERN</b>")"
   2.134 -	for i in $LOCALSTATE/packages.list $LOCALSTATE/undigest/*/packages.list; do
   2.135 +	for i in $PKGS_DB/packages.list $PKGS_DB/undigest/*/packages.list; do
   2.136  		grep -is "$PATTERN" $i | sed "s|$PATTERN|$BPATTERN|"
   2.137  		num=$(($num + `grep -is "$PATTERN" $i | wc -l`))
   2.138  	done
   2.139 -	if [ ! -f "$LOCALSTATE/packages.list" ]; then
   2.140 +	if [ ! -f "$PKGS_DB/packages.list" ]; then
   2.141  		newline
   2.142  		_ \
   2.143  "No 'packages.list' found to check for mirrored packages. For more results,
   2.144 @@ -1088,11 +1088,11 @@
   2.145  	_ 'Matching packages name with version and desc'
   2.146  	separator
   2.147  	num=0
   2.148 -	for i in $LOCALSTATE/packages.txt $LOCALSTATE/undigest/*/packages.txt; do
   2.149 +	for i in $PKGS_DB/packages.txt $PKGS_DB/undigest/*/packages.txt; do
   2.150  		grep -is -A 2 "^$PATTERN" $i
   2.151  		num=$(($num + `grep -is "^$PATTERN" $i | wc -l`))
   2.152  	done
   2.153 -	if [ ! -f "$LOCALSTATE/packages.txt" ]; then
   2.154 +	if [ ! -f "$PKGS_DB/packages.txt" ]; then
   2.155  		newline
   2.156  		_ \
   2.157  "No 'packages.txt' found to check for mirrored packages. For more results,
   2.158 @@ -1206,7 +1206,7 @@
   2.159  			*\ $i\ *) continue;;
   2.160  		esac
   2.161  		ALL_DEPS="$ALL_DEPS $i"
   2.162 -		[ -n "$2" ] && echo "$2$i ($(fgrep -A 3 $i $LOCALSTATE/packages.txt | \
   2.163 +		[ -n "$2" ] && echo "$2$i ($(fgrep -A 3 $i $PKGS_DB/packages.txt | \
   2.164  						tail -1 | sed 's/.*(\([^ ]*\).*/\1/'))"
   2.165  		[ -f $i/receipt ] || continue
   2.166  		DEPENDS=""
   2.167 @@ -1250,7 +1250,7 @@
   2.168  		echo -n $spc | sed 's/=/ /g'
   2.169  		echo -n $pkg
   2.170  		echo -n ' ('
   2.171 -		fgrep -A 3 $pkg $LOCALSTATE/packages.txt  | tail -1 | \
   2.172 +		fgrep -A 3 $pkg $PKGS_DB/packages.txt  | tail -1 | \
   2.173  			sed 's/.*(\([^ ]*\).*/\1)/'
   2.174  	done
   2.175  }
   2.176 @@ -1373,10 +1373,10 @@
   2.177  		check_for_packages_list
   2.178  		case $2 in
   2.179  			--diff)
   2.180 -				if [ -f "$LOCALSTATE/packages.diff" ]; then
   2.181 +				if [ -f "$PKGS_DB/packages.diff" ]; then
   2.182  					title 'Mirrored packages diff'
   2.183 -					cat $LOCALSTATE/packages.diff
   2.184 -					num=$(wc -l < $LOCALSTATE/packages.diff)
   2.185 +					cat $PKGS_DB/packages.diff
   2.186 +					num=$(wc -l < $PKGS_DB/packages.diff)
   2.187  					footer "$(eval_ngettext \
   2.188  						'$num new package listed on the mirror.' \
   2.189  						'$num new packages listed on the mirror.' $num)"
   2.190 @@ -1388,9 +1388,9 @@
   2.191  				fi; exit 0 ;;
   2.192  			--text|--txt|--raw|*)
   2.193  				title 'List of available packages on the mirror'
   2.194 -				cat $LOCALSTATE/packages.txt ;;
   2.195 +				cat $PKGS_DB/packages.txt ;;
   2.196  		esac
   2.197 -		pkgs=$(wc -l < $LOCALSTATE/packages.list)
   2.198 +		pkgs=$(wc -l < $PKGS_DB/packages.list)
   2.199  		num=$(emsg "<c 32>$pkgs</c>")
   2.200  		footer "$(eval_ngettext \
   2.201  			'$num package in the last recharged list.' \
   2.202 @@ -1420,8 +1420,8 @@
   2.203  		. $INSTALLED/$PACKAGE/receipt
   2.204  		title 'TazPKG information'
   2.205  		# Display localized short description
   2.206 -		if [ -e "$LOCALSTATE/packages-desc.$LANG" ]; then
   2.207 -			LOCDESC=$(grep -e "^$PACKAGE	" $LOCALSTATE/packages-desc.$LANG | cut -d'	' -f2)
   2.208 +		if [ -e "$PKGS_DB/packages-desc.$LANG" ]; then
   2.209 +			LOCDESC=$(grep -e "^$PACKAGE	" $PKGS_DB/packages-desc.$LANG | cut -d'	' -f2)
   2.210  			[ "x$LOCDESC" != "x" ] && SHORT_DESC="$LOCDESC"
   2.211  		fi
   2.212  		emsg "\
   2.213 @@ -1513,8 +1513,8 @@
   2.214  		if [ "$3" == "--mirror" ]; then
   2.215  
   2.216  			match=0
   2.217 -			for i in $LOCALSTATE/files.list.lzma \
   2.218 -				$LOCALSTATE/undigest/*/files.list.lzma; do
   2.219 +			for i in $PKGS_DB/files.list.lzma \
   2.220 +				$PKGS_DB/undigest/*/files.list.lzma; do
   2.221  				[ -f $i ] || continue
   2.222  				unlzma -c $i | grep -- ".*:.*$2" | awk '
   2.223  					BEGIN { last="" }
   2.224 @@ -1573,8 +1573,8 @@
   2.225  
   2.226  		# Search for a file on mirror and output only the package name
   2.227  		match=0
   2.228 -		for i in $LOCALSTATE/files.list.lzma \
   2.229 -				 $LOCALSTATE/undigest/*/files.list.lzma; do
   2.230 +		for i in $PKGS_DB/files.list.lzma \
   2.231 +				 $PKGS_DB/undigest/*/files.list.lzma; do
   2.232  				 [ -f $i ] || continue
   2.233  				unlzma -c $i | grep -- ".*:.*$2" | cut -d: -f1 | uniq | awk '{ print $1 }'
   2.234  				match=$(($match + `unlzma -c $i | grep -- ".*:.*$2" | cut -d: -f1 | uniq | wc -l`))
   2.235 @@ -1604,7 +1604,7 @@
   2.236  			if [ "$root" ]; then
   2.237  				CACHE_DIR=$root/$CACHE_DIR
   2.238  				SAVE_CACHE_DIR=$CACHE_DIR
   2.239 -				LOCALSTATE=$root/$LOCALSTATE
   2.240 +				PKGS_DB=$root/$PKGS_DB
   2.241  			else
   2.242  				echo "rootconfig needs --root= option used." >&2
   2.243  				exit 1
   2.244 @@ -1694,7 +1694,7 @@
   2.245  			newline
   2.246  			exit 0
   2.247  		fi
   2.248 -		rm $LOCALSTATE/mirror
   2.249 +		rm $PKGS_DB/mirror
   2.250  		echo "$RELEASE" > /etc/slitaz-release
   2.251  		tazpkg recharge && tazpkg upgrade
   2.252  
   2.253 @@ -1783,7 +1783,7 @@
   2.254  			status
   2.255  
   2.256  			sed -i "/ $PACKAGE-$VERSION$EXTRAVERSION$/d" \
   2.257 -				$LOCALSTATE/installed.$SUM 2> /dev/null
   2.258 +				$PKGS_DB/installed.$SUM 2> /dev/null
   2.259  
   2.260  			# Log this activity
   2.261  			log_pkg Removed
   2.262 @@ -2090,21 +2090,21 @@
   2.263  
   2.264  		ARG=$2
   2.265  		if [ "$root" ]; then
   2.266 -			LOCALSTATE=$root$LOCALSTATE
   2.267 +			PKGS_DB=$root$PKGS_DB
   2.268  			[ "${2#--}" != "$2" ] && ARG=$3
   2.269  		fi
   2.270  		if [ "$ARG" = main ]; then
   2.271 -			repository_to_recharge=$LOCALSTATE
   2.272 +			repository_to_recharge=$PKGS_DB
   2.273  		elif [ "$ARG" ]; then
   2.274 -			if [ -d "$LOCALSTATE/undigest/$ARG" ]; then
   2.275 -				repository_to_recharge=$LOCALSTATE/undigest/$ARG
   2.276 +			if [ -d "$PKGS_DB/undigest/$ARG" ]; then
   2.277 +				repository_to_recharge=$PKGS_DB/undigest/$ARG
   2.278  			else
   2.279 -				repo="$LOCALSTATE/undigest/$ARG"
   2.280 +				repo="$PKGS_DB/undigest/$ARG"
   2.281  				_ "\$repo doesn't exist." >&2
   2.282  				exit 1
   2.283  			fi
   2.284  		else
   2.285 -			repository_to_recharge="$LOCALSTATE $LOCALSTATE/undigest/*"
   2.286 +			repository_to_recharge="$PKGS_DB $PKGS_DB/undigest/*"
   2.287  		fi
   2.288  		for path in $repository_to_recharge; do
   2.289  			[ -f $path/mirror ] || continue
   2.290 @@ -2114,7 +2114,7 @@
   2.291  			[ -f ID ] && mv ID ID.bak
   2.292  			download_from "$(cat mirror)" ID >/dev/null 2>/dev/null
   2.293  			if [ -f ID ] && fgrep -q $(cat ID.bak 2>/dev/null || echo "null") ID; then
   2.294 -				if [ "$path" = "$LOCALSTATE" ]; then
   2.295 +				if [ "$path" = "$PKGS_DB" ]; then
   2.296  					repository_name=Main
   2.297  				else
   2.298  					base_path="$(basename $path)"
   2.299 @@ -2133,7 +2133,7 @@
   2.300  			fi
   2.301  
   2.302  			newline
   2.303 -			if [ "$path" != "$LOCALSTATE" ]; then
   2.304 +			if [ "$path" != "$PKGS_DB" ]; then
   2.305  				base_path="$(basename $path)"
   2.306  				_ 'Recharging undigest $base_path:'
   2.307  			fi
   2.308 @@ -2208,13 +2208,13 @@
   2.309  			esac
   2.310  		done
   2.311  		time=$(date +%s)
   2.312 -		installed_sum=$LOCALSTATE/installed.$SUM
   2.313 +		installed_sum=$PKGS_DB/installed.$SUM
   2.314  		look_for_priority
   2.315  		for repo in $priority; do
   2.316  			pkg_list=$repo/packages.list
   2.317  			mtime=$(find $pkg_list -mtime +7)
   2.318  			if [ "$mtime" ]; then
   2.319 -				if [ "$repo" = "$LOCALSTATE" ]; then
   2.320 +				if [ "$repo" = "$PKGS_DB" ]; then
   2.321  					repo_name=main
   2.322  				else
   2.323  					repo_name="${repo##*/}"
   2.324 @@ -2245,7 +2245,7 @@
   2.325  
   2.326  					emsg -n "$PACKAGE<i 28> $VERSION"
   2.327  
   2.328 -					# Skip pkgs listed in $LOCALSTATE/blocked-packages.list
   2.329 +					# Skip pkgs listed in $PKGS_DB/blocked-packages.list
   2.330  					if $(grep -qs "^$PACKAGE" $BLOCKED); then
   2.331  						blocked_count=$(($blocked_count + 1))
   2.332  						emsg "<i 48><c 31> $(_ 'Blocked')</c>"
   2.333 @@ -2482,7 +2482,7 @@
   2.334  			if [ "$root" ]; then
   2.335  				CACHE_DIR=$root/$CACHE_DIR
   2.336  				SAVE_CACHE_DIR=$CACHE_DIR
   2.337 -				LOCALSTATE=$root/$LOCALSTATE
   2.338 +				PKGS_DB=$root/$PKGS_DB
   2.339  			else
   2.340  				_ 'rootconfig needs --root= option used.' >&2
   2.341  				exit 1
   2.342 @@ -2527,7 +2527,7 @@
   2.343  			if [ "$root" ]; then
   2.344  				CACHE_DIR=$root/$CACHE_DIR
   2.345  				SAVE_CACHE_DIR=$CACHE_DIR
   2.346 -				LOCALSTATE=$root/$LOCALSTATE
   2.347 +				PKGS_DB=$root/$PKGS_DB
   2.348  			else
   2.349  				_ 'rootconfig needs --root= option used.' >&2
   2.350  				exit 1
   2.351 @@ -2575,7 +2575,7 @@
   2.352  			download $PACKAGE.tazpkg
   2.353  		fi
   2.354  		PACKAGE_FILE=$CACHE_DIR/$PACKAGE.tazpkg
   2.355 -		[ "$rootconfig" ] && LOCALSTATE=${LOCALSTATE#$root}
   2.356 +		[ "$rootconfig" ] && PKGS_DB=${PKGS_DB#$root}
   2.357  		install_package $ROOT
   2.358  		[ "$AUTOEXEC" != "no" ] && $PACKAGE $ROOT
   2.359  		update_desktop_database $ROOT
   2.360 @@ -2602,13 +2602,13 @@
   2.361  	list-undigest)
   2.362  		# list undigest URLs.
   2.363  		if [ "$2" = "--box" ]; then
   2.364 -			for i in $LOCALSTATE/undigest/*/mirror; do
   2.365 +			for i in $PKGS_DB/undigest/*/mirror; do
   2.366  				[ -f $i ] || continue
   2.367  				echo "$(basename $(dirname $i))|$(cat $i)"
   2.368  			done
   2.369  		else
   2.370  			title 'Current undigest(s)'
   2.371 -			for i in $LOCALSTATE/undigest/*/mirror; do
   2.372 +			for i in $PKGS_DB/undigest/*/mirror; do
   2.373  				if [ ! -f $i ]; then
   2.374  					_ 'No undigest mirror found.'
   2.375  					exit 1
   2.376 @@ -2623,13 +2623,13 @@
   2.377  		# remove undigest URL.
   2.378  		check_root $@
   2.379  		undigest="$2"
   2.380 -		if [ -d $LOCALSTATE/undigest/$2 ]; then
   2.381 +		if [ -d $PKGS_DB/undigest/$2 ]; then
   2.382  			confirm "$(_ 'Remove $undigest undigest? (y/N)')"
   2.383  			if [ $? = 0 ]; then
   2.384  				action 'Removing $undigest undigest...'
   2.385 -				rm -rf $LOCALSTATE/undigest/$2
   2.386 +				rm -rf $PKGS_DB/undigest/$2
   2.387  				status
   2.388 -				rmdir $LOCALSTATE/undigest 2> /dev/null
   2.389 +				rmdir $PKGS_DB/undigest 2> /dev/null
   2.390  			fi
   2.391  		else
   2.392  			_ 'Undigest $undigest not found'
   2.393 @@ -2640,25 +2640,25 @@
   2.394  		# Add undigest URL.
   2.395  		check_root $@
   2.396  		undigest=$2
   2.397 -		[ -d $LOCALSTATE/undigest ] || mkdir $LOCALSTATE/undigest
   2.398 +		[ -d $PKGS_DB/undigest ] || mkdir $PKGS_DB/undigest
   2.399  		if [ -z "$undigest" ]; then
   2.400  			i=1
   2.401 -			while [ -d $LOCALSTATE/undigest/$i ]; do
   2.402 +			while [ -d $PKGS_DB/undigest/$i ]; do
   2.403  				i=$(($i+1))
   2.404  			done
   2.405  			undigest=$i
   2.406  		fi
   2.407 -		if [ ! -d $LOCALSTATE/undigest/$undigest ]; then
   2.408 +		if [ ! -d $PKGS_DB/undigest/$undigest ]; then
   2.409  			_ 'Creating new undigest $undigest.'
   2.410 -			mkdir $LOCALSTATE/undigest/$undigest
   2.411 +			mkdir $PKGS_DB/undigest/$undigest
   2.412  		fi
   2.413 -		setup_mirror $LOCALSTATE/undigest/$undigest $3 ;;
   2.414 +		setup_mirror $PKGS_DB/undigest/$undigest $3 ;;
   2.415  
   2.416  
   2.417  	setup-mirror|-sm)
   2.418  		# Change mirror URL.
   2.419  		check_root $@
   2.420 -		setup_mirror $LOCALSTATE $2 ;;
   2.421 +		setup_mirror $PKGS_DB $2 ;;
   2.422  
   2.423  
   2.424  	reconfigure)
     3.1 --- a/tazpkg-find-depends	Thu Dec 04 01:23:47 2014 +0200
     3.2 +++ b/tazpkg-find-depends	Thu Dec 04 01:41:59 2014 +0200
     3.3 @@ -29,7 +29,7 @@
     3.4  {
     3.5  	DEFAULT_DEPENDS="glibc-base gcc-lib-base"
     3.6  
     3.7 -	[ -n "$TMPLOCALSTATE" ] || TMPLOCALSTATE=$LOCALSTATE
     3.8 +	[ -n "$TMPLOCALSTATE" ] || TMPLOCALSTATE=$PKGS_DB
     3.9  	[ -f $TMPLOCALSTATE/files.list.lzma ] || tazpkg recharge > /dev/null
    3.10  	for i in $TMPLOCALSTATE/files.list.lzma \
    3.11  		$TMPLOCALSTATE/undigest/*/files.list.lzma ; do