| sep95.tar |
Listing 2: Dearchive a compressed uuencoded cpio archive
#!/bin/sh # # dearc # # Takes an archive already checked out from RCS and extracts the # files, rebuilding the original tree. The archive must be # compressed and in uuencoded text form. Use cpio's compatibility # option to avoid tar's incompatible design. Use zcat to keep the # file handling simple. # # Lawrence S Reznick -- 94Nov08 if [ $# -lt 2 ] then echo "Usage: `basename $0` archivename dirname" 1>&2 echo " `basename $0` -t archivename" 1>&2 echo 1>&2 echo "Creates dirname tree from archive using \"cpio -c\"" 1>&2 echo "-t option shows archive's table of contents only" 1>&2 exit 1 fi if [ "$1" = "-t" ] then OPT=tv ARC=$2 else ARC=$1 DIR=$2 fi ZFILE=`basename $ARC .uu` uudecode $ARC trap "rm -f $ZFILE" 0 1 2 3 15 if [ "$OPT" ] then mkdir -p $DIR >/dev/null 2>&1 if [ ! -d $DIR ] then echo "Can't create $DIR" 1>&2 exit 2 fi fi zcat $ZFILE | ( cd $DIR; cpio -icd )
|