spk rev 64
spk-archive: be busybox ash compatible
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri May 18 03:19:51 2012 +0200 (2012-05-18) |
parents | d0fa46ea46bd |
children | de880358af6d |
files | spk-archive |
line diff
1.1 --- a/spk-archive Fri May 18 03:09:37 2012 +0200 1.2 +++ b/spk-archive Fri May 18 03:19:51 2012 +0200 1.3 @@ -1,4 +1,4 @@ 1.4 -#!/bin/bash 1.5 +#!/bin/sh 1.6 # 1.7 # Spk-Archive - SliTaz Package Archive Manager 1.8 # 1.9 @@ -15,13 +15,13 @@ 1.10 $(boldify $(gettext "Usage:")) $name [command] package 1.11 1.12 $(boldify $(gettext "Commands:")) 1.13 - pack 1.14 - repack [--config] 1.15 - extract 1.16 - recompress 1.17 + pack 1.18 + repack [--config] 1.19 + extract 1.20 + recompress 1.21 1.22 $(boldify "$(gettext "Example:")") 1.23 - $name extract clex 1.24 + $name extract package 1.25 1.26 EOT 1.27 exit 0 1.28 @@ -33,13 +33,13 @@ 1.29 local package_file=$1 1.30 local package_name=$(package_name $package_file) 1.31 1.32 - eval_gettext "Extracting \$package_name... " 1.33 + gettext "Extracting:"; echo " $package_name... " 1.34 cpio -idm --quiet < ${package_file##*/} && rm -f ${package_file##*/} 1.35 status 1.36 1.37 - gettext "Extracting the pseudo fs... " 1.38 + [ "$verbose" ] && gettext "Extracting the pseudo fs... " 1.39 unlzma -c fs.cpio.lzma | cpio -idm --quiet && rm fs.cpio.lzma 1.40 - status 1.41 + [ "$verbose" ] && status 1.42 } 1.43 1.44 # Extract .tazpkg cpio archive into a directory. 1.45 @@ -48,10 +48,10 @@ 1.46 local package_file=$1 1.47 local target_dir=$2 1.48 1.49 - # validate the file 1.50 + # Validate the file 1.51 check_valid_tazpkg $package_file 1.52 1.53 - # find the package name 1.54 + # Find the package name 1.55 local package_name=$(package_name $package_file) 1.56 1.57 # Create destination directory 1.58 @@ -66,11 +66,12 @@ 1.59 gettext "Copying original package..." 1.60 cp $package_file $dest_dir 1.61 status 1.62 - pushd $dest_dir > /dev/null 1.63 - extract_package $package $package_file 1.64 - popd > /dev/null 1.65 + cd $dest_dir 1.66 + extract_package $package $package_file 1.67 + cd - > /dev/null 1.68 separator 1.69 - eval_gettext "\$package_name is extracted to: \$dest_dir"; newline 1.70 + echo -n "$package_name" 1.71 + gettext "is extracted to:"; echo " $dest_dir" 1.72 newline 1.73 } 1.74 1.75 @@ -92,16 +93,15 @@ 1.76 cp $package_file $TMP_DIR 1.77 status 1.78 1.79 - pushd $TMP_DIR > /dev/null 1.80 - extract_package $package_file 1.81 + cd $TMP_DIR 1.82 + extract_package $package_file 1.83 + gettext "Recompressing the fs..." 1.84 + find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si 1.85 + rm -rf fs 1.86 + status 1.87 + cd - > /dev/null 1.88 1.89 - gettext "Recompressing the fs... " 1.90 - find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si 1.91 - rm -rf fs 1.92 - status 1.93 - popd > /dev/null 1.94 - 1.95 - gettext "Creating new package... " 1.96 + gettext "Creating new package..." 1.97 find $TMP_DIR -print | cpio -o -H newc --quiet > \ 1.98 $(basename $package_file).$$ && mv -f \ 1.99 $(basename $package_file).$$ \