spk rev 42
Removed pack from spk-archive
author | Christian Mesh <meshca@clarkson.edu> |
---|---|
date | Tue May 15 21:42:35 2012 -0500 (2012-05-15) |
parents | 4a7b284956e1 |
children | ddb3c10c0a4b |
files | spk-archive |
line diff
1.1 --- a/spk-archive Wed May 16 02:53:24 2012 +0200 1.2 +++ b/spk-archive Tue May 15 21:42:35 2012 -0500 1.3 @@ -3,7 +3,6 @@ 1.4 # Spk-Archive - SliTaz Package Archive Manager 1.5 # 1.6 # NOT COMPLETE: Still need to re-write (just what was grabbed from tazpkg) 1.7 -# UNSURE: Should Pack and Repack be here? 1.8 # 1.9 # Authors : See the AUTHORS files 1.10 1.11 @@ -112,176 +111,7 @@ 1.12 rm -rf $TMP_DIR 1.13 } 1.14 1.15 -# Create SliTaz package archive from an installed package. 1.16 -# Parameters: package 1.17 -repack() { 1.18 - local package=$1 1.19 - unset EXTRAVERSION 1.20 - source $INSTALLED/$package/receipt 1.21 - newline 1.22 - echo -e "$(bold Repacking :) $PACKAGE-$VERSION$EXTRAVERSION.tazpkg" 1.23 - separator 1.24 - if grep -qs ^NO_REPACK= $INSTALLED/$PACKAGE/receipt; then 1.25 - eval_gettext "Can't repack \$PACKAGE"; newline 1.26 - exit 1 1.27 - fi 1.28 - if [ -s $INSTALLED/$PACKAGE/modifiers ]; then 1.29 - eval_gettext "Can't repack, \$PACKAGE files have been modified by:"; newline 1.30 - for i in $(cat $INSTALLED/$PACKAGE/modifiers); do 1.31 - echo " $i" 1.32 - done 1.33 - exit 1 1.34 - fi 1.35 - unset MISSING 1.36 - while read i; do 1.37 - [ -e "$i" ] && continue 1.38 - [ -L "$i" ] || MISSING="$MISSING\n $i" 1.39 - done < $INSTALLED/$PACKAGE/files.list 1.40 - if [ -n "$MISSING" ]; then 1.41 - gettext "Can't repack, the following files are lost:" 1.42 - echo -e "$MISSING" 1.43 - exit 1 1.44 - fi 1.45 - mkdir -p $TMP_DIR 1.46 - pushd $TMP_DIR > /dev/null 1.47 - FILES="fs.cpio.lzma\n" 1.48 - for i in $(ls $INSTALLED/$PACKAGE) ; do 1.49 - [ "$i" = "volatile.cpio.gz" ] && continue 1.50 - [ "$i" = "modifiers" ] && continue 1.51 - cp $INSTALLED/$PACKAGE/$i . && FILES="$FILES$i\n" 1.52 - done 1.53 - ln -s / rootfs 1.54 - mkdir tmp 1.55 - sed 's/^/rootfs/' < files.list | cpio -o -H newc --quiet |\ 1.56 - { cd tmp ; cpio -idm --quiet >/dev/null; cd ..; } 1.57 - mv tmp/rootfs fs 1.58 - if [ -f $INSTALLED/$PACKAGE/volatile.cpio.gz ]; then 1.59 - zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | \ 1.60 - { cd fs; cpio -idm --quiet; cd ..; } 1.61 - fi 1.62 - if fgrep -q repack_cleanup $INSTALLED/$PACKAGE/receipt; then 1.63 - . $INSTALLED/$PACKAGE/receipt 1.64 - repack_cleanup fs 1.65 - fi 1.66 - if [ -f $INSTALLED/$PACKAGE/$CHECKSUM ]; then 1.67 - sed 's, , fs,' < $INSTALLED/$PACKAGE/$CHECKSUM | \ 1.68 - $CHECKSUM -s -c || { 1.69 - gettext "Can't repack, $CHECKSUM error."; newline 1.70 - popd 1.71 - rm -rf $TMP_DIR 1.72 - exit 1 1.73 - } 1.74 - fi 1.75 - find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si 1.76 - echo -e "$FILES" | cpio -o -H newc --quiet > $PACKAGE-$VERSION$EXTRAVERSION.tazpkg 1.77 - popd > /dev/null 1.78 - mv $TMP_DIR/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg . 1.79 - rm -R $TMP_DIR 1.80 - eval_gettext "Package \$PACKAGE repacked successfully."; newline 1.81 - echo $(gettext "Size") : $(du -sh $PACKAGE-$VERSION$EXTRAVERSION.tazpkg) 1.82 - newline 1.83 -} 1.84 - 1.85 -# Create SliTaz package archive from configuration files. 1.86 -repack_config() { 1.87 - mkdir -p $TMP_DIR 1.88 - pushd $TMP_DIR > /dev/null 1.89 - CONFIG_VERSION=1.0 1.90 - mkdir config-$CONFIG_VERSION 1.91 - pushd config-$CONFIG_VERSION 1.92 - for i in $INSTALLED/*/volatile.cpio.gz; do 1.93 - zcat $i | cpio -t --quiet 1.94 - done > files.list 1.95 - mkdir fs 1.96 - pushd fs 1.97 - ( cd / ; cpio -o -H newc --quiet ) < ../files.list | cpio -idm --quiet > /dev/null 1.98 - mkdir -p etc/tazlito 1.99 - for i in $INSTALLED/*/receipt; do 1.100 - unset EXTRAVERSION 1.101 - source $i 1.102 - echo "$PACKAGE-$VERSION$EXTRAVERSION" 1.103 - done > etc/tazlito/config-packages.list 1.104 - popd > /dev/null 1.105 - echo "etc/tazlito/config-packages.list" >> files.list 1.106 - cat > receipt <<EOT 1.107 -# SliTaz package receipt. 1.108 - 1.109 -PACKAGE="config" 1.110 -VERSION="$CONFIG_VERSION" 1.111 -CATEGORY="base-system" 1.112 -SHORT_DESC="$(gettext "User configuration backup on ")$(date)" 1.113 -DEPENDS="$(ls $INSTALLED)" 1.114 -EOT 1.115 - popd 1.116 - tazpkg pack config-$CONFIG_VERSION 1.117 - popd 1.118 - cp $TMP_DIR/config-$CONFIG_VERSION.tazpkg . 1.119 - rm -rf $TMP_DIR 1.120 -} 1.121 - 1.122 -# Create SliTaz package archive using cpio and gzip. 1.123 -# Parameters: package 1.124 -pack() { 1.125 - local package="$1" 1.126 - cd $PACKAGE 1.127 - if [ ! -f "receipt" ]; then 1.128 - gettext "Receipt is missing. Please read the documentation."; newline 1.129 - exit 0 1.130 - else 1.131 - newline 1.132 - echo "$(bold Packing :) $PACKAGE" 1.133 - separator 1.134 - # Create files.list with redirecting find outpout. 1.135 - gettext "Creating the list of files..." 1.136 - pushd fs 1.137 - find . -type f -print > ../files.list 1.138 - find . -type l -print >> ../files.list 1.139 - popd 1.140 - sed -i s/'^.'/''/ files.list 1.141 - status 1.142 - gettext "Creating $CHECKSUM of files..." 1.143 - while read file; do 1.144 - [ -L "fs$file" ] && continue 1.145 - [ -f "fs$file" ] || continue 1.146 - case "$file" in 1.147 - /lib/modules/*/modules.*|*.pyc) continue;; 1.148 - esac 1.149 - $CHECKSUM "fs$file" | sed 's/ fs/ /' 1.150 - done < files.list > $CHECKSUM 1.151 - status 1.152 - UNPACKED_SIZE=$(du -chs fs receipt files.list $CHECKSUM \ 1.153 - description.txt 2> /dev/null | busybox awk \ 1.154 - '{ sz=$1 } END { print sz }') 1.155 - # Build cpio archives. 1.156 - gettext "Compressing the fs... " 1.157 - find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si 1.158 - rm -rf fs 1.159 - status 1.160 - PACKED_SIZE=$(du -chs fs.cpio.lzma receipt files.list \ 1.161 - $CHECKSUM description.txt 2> /dev/null | busybox awk \ 1.162 - '{ sz=$1 } END { print sz }') 1.163 - gettext "Updating receipt sizes..." 1.164 - sed -i s/^PACKED_SIZE.*$// receipt 1.165 - sed -i s/^UNPACKED_SIZE.*$// receipt 1.166 - sed -i "s/^PACKAGE=/PACKED_SIZE=\"$PACKED_SIZE\"\nUNPACKED_SIZE=\"$UNPACKED_SIZE\"\nPACKAGE=/" receipt 1.167 - status 1.168 - gettext "Creating full cpio archive... " 1.169 - find . -print | cpio -o -H newc --quiet > ../$PACKAGE.tazpkg 1.170 - status 1.171 - gettext "Restoring original package tree... " 1.172 - unlzma -c fs.cpio.lzma | cpio -idm --quiet 1.173 - status 1.174 - rm fs.cpio.lzma && cd .. 1.175 - separator 1.176 - eval_gettext "Package \$PACKAGE compressed successfully."; newline 1.177 - echo $(gettext "Size") : $(du -sh $PACKAGE.tazpkg) 1.178 - newline 1.179 - fi 1.180 -} 1.181 - 1.182 case $1 in 1.183 - pack|-p) 1.184 - pack $2 ;; 1.185 extract|-e) 1.186 extract_package $2 $3 ;; 1.187 recompress|-r)