#!/bin/sh # archive, unarchive -- tar and compress source for archival storage command=`basename $0` #-- parse command line options set -- `getopt 'dlrtuvzZ' $*` if [ $? != 0 ] then cat <&1" if [ $? != 0 ] then echo "archive: $decomp/tar error" exit 1 fi #-- remove archive if [ ".$listonly" = "." ] then $debug "rm -f $myfile" fi elif [ ".$listonly" != "." ] then echo "archive: -l option applies only to dearchiving" exit 1 else if [ -f $dir.$suffix ] then echo "Archive $dir.$suffix already present." exit 1 fi if [ $arg = . ] then all='`ls -A`' else all='`ls -Ad '$arg'`' fi $debug "tar -c${verbose}f - $all | $compress -c >../$dir.$suffix" if [ $? != 0 ] then echo "archive: tar error" exit 1 fi #-- obtain date for "-t" option if [ $touch = "y" ] then last=`find $arg -type f -print` if [ ".$last" != "." ] then last=`ls -1t $last | head -1` $debug cpd $last ../$dir.$suffix if [ ".$verbose" = ".v" ]; then echo last=$last;fi fi fi #-- remove current sources $debug "chmod u+w ." $debug "find $arg -type d -exec chmod u+w {} \\;" $debug "rm -rf $all" if [ $remove = "y" ] then #-- move archive to parent, removing leaf leaf=`basename $paths` $debug "cd ..;rmdir $leaf" else #-- move archive back in $debug "mv ../$dir.$suffix ." if [ "$arg" = "." ] then $debug "chmod -w ." fi if [ $touch = "y" ] then $debug cpd $dir.$suffix . fi fi fi