Listing 1: Make a compressed uuencoded cpio archive
#!/bin/sh
#
# mkarc
#
# Make an archive suitable for RCS check-in. The archive must be
# compressed and in text form. To extract at any location with any
# name, create the archive with relative path names. Use cpio's
# compatibility option to avoid tar's incompatible design.
#
# Lawrence S Reznick -- 94Nov08
if [ $# -lt 2 ]
then
echo "Usage: `basename $0` dirname archivename" 1>&2
echo 1>&2
echo "Archives dirname tree using \"cpio -c\"" 1>&2
exit 1
fi
DIR=$1
ARC=`basename $2 .Z.uu`
#
# awk changes the uuencoded file's permissions. The pipe sets perm=0!
#
( cd $DIR ; find . -depth -print | cpio -oc ) |
compress |
uuencode $ARC.Z |
awk '
NR == 1 { print $1, 664, $3 }
NR != 1
' > $ARC.Z.uu
|