slitaz-base-files view rootfs/usr/lib/slitaz/libpkg.sh @ rev 165

LibPkg: Fixed is_valid_tazpkg
author Christian Mesh <meshca@clarkson.edu>
date Fri May 11 21:24:32 2012 -0500 (2012-05-11)
parents 6f52c9934cfc
children 1691917d8883
line source
1 #!/bin/sh
2 #
3 # SliTaz Packages base functions used by packages manager, cook and
4 # all tools dealing with packages and receipts.
5 #
6 # Documentation: man libpkg or /usr/share/doc/slitaz/libpkg.txt
7 #
8 # Copyright (C) 2012 SliTaz GNU/Linux - BSD License
9 #
11 # Unset all receipt variables.
12 unset_receipt() {
13 unset PACKAGE VERSION EXTRAVERSION SHORT_DESC HOST_ARCH TARBALL \
14 DEPENDS BUILD_DEPENDS WANTED WGET_URL PROVIDE CROSS_BUG
15 }
17 # converts /tmp/pkg.tazpkg to pkg
18 package_name() {
19 local name=$(basename $1)
20 echo ${name%.tazpkg}
21 }
23 # checks to see if file is proper tazpkg
24 is_valid_tazpkg() {
25 local file=$1
26 [ -a $file ] && [ "$file" != "$(package_name $file)" ]
27 }
29 check_valid_tazpkg() {
30 local file=$1
31 if ! is_valid_tazpkg $file; then
32 gettext "$file is not a tazpkg. Exiting"; newline
33 exit 1
34 fi
35 }