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

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 26 08:22:10 2019 +0100 (2019-02-26)
parents 91fcb259b3bf
children
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) 2014-2015 SliTaz GNU/Linux - BSD License
9 #
11 . /lib/libtaz.sh
13 # Unset all receipt variables.
14 unset_receipt() {
15 unset PACKAGE VERSION EXTRAVERSION SHORT_DESC HOST_ARCH TARBALL \
16 DEPENDS BUILD_DEPENDS WANTED WGET_URL PROVIDE CROSS_BUG TAGS
17 }
19 # Converts pkg.tazpkg to pkg
20 package_name() {
21 basename $1 .tazpkg
22 }
24 # Check mirror ID: return false if no changes or mirror unreachable
25 check_mirror_id() {
26 [ -n "$forced" ] && rm -f ID
27 [ -f 'ID' ] || echo $$ > ID
28 mv ID ID.bak
29 if wget -qs ${mirror%/}/ID; then
30 wget -q ${mirror%/}/ID
31 else
32 _n 'Mirror is unreachable'
33 false; status; return 1
34 fi
35 if [ "$(cat ID)" = "$(cat ID.bak)" ]; then
36 _n 'Mirror is up-to-date'
37 true; status; return 1
38 fi
39 }
41 # Source a package receipt
42 source_receipt() {
43 local receipt="$1"
44 if [ ! -f $receipt ]; then
45 indent 28 $(_ 'Missing receipt: %s' "$receipt")
46 continue
47 else
48 . $receipt
49 fi
50 }
52 #
53 # Do we realy need the code below here ???
54 #
56 # checks to see if file is proper tazpkg
57 is_valid_tazpkg() {
58 local file="$1"
59 [ -a $file ] && [ "$file" != "$(package_name $file)" ]
60 }
62 check_valid_tazpkg() {
63 local file="$1"
64 if ! is_valid_tazpkg $file; then
65 _ 'File %s is not a tazpkg. Exiting' "$file"
66 exit 1
67 fi
68 }