diff options
author | Chet Ramey <chet.ramey@case.edu> | 2014-02-25 20:36:50 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2014-02-25 20:36:50 -0500 |
commit | 4539d736f1aff232857a854fd2a68df0c98d9f34 (patch) | |
tree | 841c9a36d28c9a4d61c1b2d79524ccbe5f5c5029 /examples/scripts.v2/arc2tarz | |
parent | f281b8f4f8936b2713966274d9f8508a9f0910e4 (diff) | |
download | android_external_bash-4539d736f1aff232857a854fd2a68df0c98d9f34.tar.gz android_external_bash-4539d736f1aff232857a854fd2a68df0c98d9f34.tar.bz2 android_external_bash-4539d736f1aff232857a854fd2a68df0c98d9f34.zip |
prep for bash-4.3 release
Diffstat (limited to 'examples/scripts.v2/arc2tarz')
-rw-r--r-- | examples/scripts.v2/arc2tarz | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/examples/scripts.v2/arc2tarz b/examples/scripts.v2/arc2tarz deleted file mode 100644 index 285bede..0000000 --- a/examples/scripts.v2/arc2tarz +++ /dev/null @@ -1,85 +0,0 @@ -#! /bin/bash -# -# original from: -# arc2tarz: convert arced file to tarred, compressed form. -# @(#) arc2tarz.ksh 1.0 92/02/16 -# 91/03/28 john h. dubois iii (john@armory.com) -# 92/02/16 added -h option for help -# -# conversion to bash v2 syntax by Chet Ramey - -unset ENV -Usage="Usage: $0 arcfile [-hcg] [ tarzfile ]" - -phelp() -{ -echo "$Usage -arcfile is the name of an arc file to convert to tarred, compressed form. -The file must have a .arc extension, but only the base name needs to be -given. If no output file name is given, it will be created in the current -directory with the name being the arcfile basename followed by .tar.EXT. -If the -c option is given, compress will be used, and EXT will be Z. -The default (also available with -g) is to use gzip, in which case EXT -is gz. If the basename is too long the extension may be truncated. All -uppercase letters in the names of files in the archive are moved to lowercase." -} - -compress=gzip -ext=gz - -while getopts "hcg" opt; do - case "$opt" in - h) phelp; exit 0;; - c) compress=compress; ext=Z;; - g) compress=gzip ; ext=gz ;; - *) echo "$Usage" 1>&2 ; exit 2;; - esac -done - -shift $((OPTIND - 1)) - -if [ $# = 0 ]; then - phelp - exit 0 -fi - -[ -z "$TMP" ] && tmpdir=/tmp/arc2tarz.$$ || tmpdir=$TMP/arc2tarz.$$ - -case "$1" in -*.arc) arcfile=$1 ;; -*) arcfile=$1.arc ;; -esac - -if [ ! -f $arcfile ] || [ ! -r $arcfile ]; then - echo "Could not open arc file \"$arcfile\"." - exit 1 -fi - -case "$arcfile" in -/*) ;; -*) arcfile=$PWD/$arcfile ;; -esac - -basename=${arcfile%.arc} -basename=${basename##*/} -[ $# -lt 2 ] && tarzname=$PWD/$basename.tar.$ext || tarzname=$2 - -trap 'rm -rf $tmpdir $tarzname' 1 2 3 6 15 - -mkdir $tmpdir -cd $tmpdir -echo "unarcing files..." -arc -ie $arcfile - -# lowercase -for f in *; do - new=$(echo $f | tr A-Z a-z) - if [ "$f" != "$new" ]; then - mv $f $new - fi -done - -echo "tarring/compressing files..." -tar cf - * | $compress > $tarzname -cd - -rm -rf $tmpdir |