tazpkg annotate modules/pack @ rev 846

Remove "busybox" "prefixes" (thanks llev)
We used "busybox wget", etc. to be sure we called Busybox's "wget", not any other "wget". Workaround already done in "getenv" module.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Oct 09 13:14:01 2015 +0300 (2015-10-09)
parents a02e36d44d06
children 4802158453e1
rev   line source
al@840 1 #!/bin/sh
al@840 2 # TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
al@840 3 # pack - TazPkg module
al@840 4 # Create SliTaz package archive using cpio and lzma
al@840 5
al@840 6
al@840 7 # Connect function libraries
al@840 8 . /lib/libtaz.sh
al@840 9
al@840 10 # Get TazPkg working environment
al@840 11 . @@MODULES@@/getenv
al@840 12
al@840 13
al@840 14
al@840 15
al@840 16 PACKAGE="$1"
al@844 17 TAZPKG_PACK="$2"
al@844 18
al@840 19 cd "$PACKAGE"
al@844 20
al@840 21 if [ ! -f 'receipt' ]; then
al@840 22 _ 'Receipt is missing. Please read the documentation.'
al@840 23 exit 0
al@840 24 fi
al@840 25
al@840 26 title 'Packing package "%s"' "$PACKAGE"
al@840 27
al@840 28 # Create files.list with redirecting find output.
al@840 29 action 'Creating the list of files...'
al@840 30 cd fs
al@840 31 find . -type f -print > ../files.list
al@840 32 find . -type l -print >> ../files.list
al@840 33 cd ..; sed -i s/'^.'/''/ files.list
al@840 34 status
al@840 35
al@840 36 action 'Creating %s of files...' "$CHECKSUM"
al@840 37 while read file; do
al@840 38 [ -L "fs$file" ] && continue
al@840 39 [ -f "fs$file" ] || continue
al@840 40 case "$file" in
al@840 41 /lib/modules/*/modules.*|*.pyc) continue;;
al@840 42 esac
al@840 43 $CHECKSUM "fs$file" | sed 's/ fs/ /'
al@840 44 done < files.list > $CHECKSUM
al@840 45 status
al@840 46
al@840 47 UNPACKED_SIZE=$(du -chs fs receipt files.list $CHECKSUM description.txt 2>/dev/null | awk 'END {print $1}')
al@840 48
al@840 49 # Build cpio archives.
al@840 50 action 'Compressing the FS...'
al@840 51 find fs | cpio -o -H newc --quiet | case "$TAZPKG_PACK" in
al@840 52 gzip) gzip -9 > fs.cpio.gz ;;
al@840 53 *) lzma e fs.cpio.lzma -si ;;
al@840 54 esac
al@840 55 rm -rf fs
al@840 56 status
al@840 57
al@840 58 PACKED_SIZE=$(du -chs fs.cpio.lzma receipt files.list $CHECKSUM description.txt 2>/dev/null | awk 'END {print $1}')
al@840 59
al@840 60 action 'Updating receipt sizes...'
al@840 61 sed -i s/^PACKED_SIZE.*$// receipt
al@840 62 sed -i s/^UNPACKED_SIZE.*$// receipt
al@840 63 sed -i "s/^PACKAGE=/PACKED_SIZE=\"$PACKED_SIZE\"\nUNPACKED_SIZE=\"$UNPACKED_SIZE\"\nPACKAGE=/" receipt
al@840 64 status
al@840 65
al@840 66 action 'Creating full cpio archive...'
al@840 67 find . -print | cpio -o -H newc --quiet > "../$PACKAGE.tazpkg"
al@840 68 status
al@840 69
al@840 70 action 'Restoring original package tree...'
al@844 71 case "$TAZPKG_PACK" in
al@844 72 gzip) gzip -d < fs.cpio.gz;;
al@844 73 *) unlzma < fs.cpio.lzma;;
al@844 74 esac | cpio -idm --quiet
al@840 75 status
al@844 76 rm fs.cpio.*
al@840 77
al@844 78 cd ..
al@844 79
al@840 80 footer "$(_ 'Package "%s" compressed successfully.' "$PACKAGE")"
al@840 81 _ 'Size: %s' "$(ls -lh "$PACKAGE.tazpkg" | awk '{print $5}')"