slitaz-base-files rev 185

libpkg.sh: Move source_receipt function in spk-ls to libpkg.sh. Source /lib/libtaz.sh in libpkg.sh so source_receipt function will work no matter what.
author Christopher Rogers <slaxemulator@gmail.com>
date Fri May 25 16:34:01 2012 +0000 (2012-05-25)
parents 32b585eb6cbe
children 7b0560247e33
files rootfs/usr/lib/slitaz/libpkg.sh
line diff
     1.1 --- a/rootfs/usr/lib/slitaz/libpkg.sh	Fri May 25 00:20:50 2012 +0200
     1.2 +++ b/rootfs/usr/lib/slitaz/libpkg.sh	Fri May 25 16:34:01 2012 +0000
     1.3 @@ -8,6 +8,8 @@
     1.4  # Copyright (C) 2012 SliTaz GNU/Linux - BSD License
     1.5  #
     1.6  
     1.7 +. /lib/libtaz.sh
     1.8 +
     1.9  # Unset all receipt variables.
    1.10  unset_receipt() {
    1.11  	unset PACKAGE VERSION EXTRAVERSION SHORT_DESC HOST_ARCH TARBALL \
    1.12 @@ -37,6 +39,18 @@
    1.13  	fi
    1.14  }
    1.15  
    1.16 +# Source a package receipt
    1.17 +source_receipt() {
    1.18 +		local receipt=$1
    1.19 +		if [ ! -f $receipt ]; then
    1.20 +			echo -n $(colorize 31 "$pkg")
    1.21 +			indent 28 $(gettext "missing receipt")
    1.22 +			continue
    1.23 +		else
    1.24 +			. $receipt
    1.25 +		fi
    1.26 +}
    1.27 +
    1.28  #
    1.29  # Do we realy need the code below here ???
    1.30  #