tazpkg rev 590

Use /lib/libtaz.sh
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 13 02:25:09 2012 +0200 (2012-04-13)
parents 59ac27af090d
children f941fb43bb88
files tazpkg
line diff
     1.1 --- a/tazpkg	Fri Apr 13 02:10:29 2012 +0200
     1.2 +++ b/tazpkg	Fri Apr 13 02:25:09 2012 +0200
     1.3 @@ -25,6 +25,8 @@
     1.4  . /etc/slitaz/slitaz.conf
     1.5  . /etc/slitaz/tazpkg.conf
     1.6  
     1.7 +. /lib/libtaz.sh
     1.8 +
     1.9  # Include gettext helper script.
    1.10  . /usr/bin/gettext.sh
    1.11  
    1.12 @@ -61,21 +63,6 @@
    1.13  # Need by check_depends
    1.14  TMPLOCALSTATE=
    1.15  
    1.16 -# Check if the directories and files used by Tazpkg
    1.17 -# exist. If not and user is root we create them.
    1.18 -check_base_dir()
    1.19 -{
    1.20 -	if test $(id -u) = 0 ; then
    1.21 -		check_dir $1$CACHE_DIR
    1.22 -		check_dir $1$INSTALLED
    1.23 -		if [ ! -f "$1$LOCALSTATE/mirror" ]; then
    1.24 -			echo "$DEFAULT_MIRROR" > $1$LOCALSTATE/mirror
    1.25 -			[ -n "$1" ] && cp $LOCALSTATE/packages.* $1$LOCALSTATE/
    1.26 -		fi
    1.27 -	fi
    1.28 -}
    1.29 -check_base_dir
    1.30 -
    1.31  ####################
    1.32  # Script functions #
    1.33  ####################
    1.34 @@ -146,10 +133,6 @@
    1.35  "
    1.36  }
    1.37  
    1.38 -separator() {
    1.39 -	echo "================================================================================"
    1.40 -}
    1.41 -
    1.42  # Check if dir exist
    1.43  check_dir()
    1.44  {
    1.45 @@ -161,6 +144,25 @@
    1.46  	fi
    1.47  }
    1.48  
    1.49 +# Check if the directories and files used by Tazpkg
    1.50 +# exist. If not and user is root we create them.
    1.51 +check_base_dir()
    1.52 +{
    1.53 +	if test $(id -u) = 0 ; then
    1.54 +		check_dir $1$CACHE_DIR
    1.55 +		check_dir $1$INSTALLED
    1.56 +		if [ ! -f "$1$LOCALSTATE/mirror" ]; then
    1.57 +			echo "$DEFAULT_MIRROR" > $1$LOCALSTATE/mirror
    1.58 +			[ -n "$1" ] && cp $LOCALSTATE/packages.* $1$LOCALSTATE/
    1.59 +		fi
    1.60 +	fi
    1.61 +}
    1.62 +check_base_dir
    1.63 +
    1.64 +separator() {
    1.65 +	echo "================================================================================"
    1.66 +}
    1.67 +
    1.68  # Store -- options in a variable.
    1.69  get_options()
    1.70  {