#! /bin/sh # bak-tape -- do backups to tape # $Id$ # Carlos Duarte , 990908/001231 BUFFER="buffer -m 16m" D1=". ./mnt/dos" D2="USERS/ubsdev USERS/wedev SHARE" #TAPE="devlis01i:/dev/tape" TAPE="teclis16i:/dev/st0" METHOD=tar while : ; do case x"$1" in x-cpio) METHOD=cpio ;; x-tar) METHOD=tar ;; x-v) VERBOSE=on ;; x-t) TAPE="$2"; shift ;; x--) shift; break ;; x-*) echo "invalid option -- `echo $1|cut -c2-`" eval "$USAGE" ;; *) break ;; esac shift done if test "$1" = 1; then dirs="$D1" elif test "$1" = 2; then dirs="$D2" elif test $# -gt 0; then dirs="$@" fi if test x"$dirs" = x; then echo "usage: $0 {1|2|dirs...}" echo " 1: $D1" echo " 2: $D2" exit 1; fi case $TAPE in *:*) HOST="`echo \"$TAPE\" | cut -d: -f1`" TAPE_DEV="`echo \"$TAPE\" | cut -d: -f2`" ;; *) HOST="" TAPE_DEV="$TAPE" ;; esac if test x"$TAPE_DEV" = x; then echo "invalid tape spec" exit 2 fi cd / case $METHOD in cpio) test x"$VERBOSE" = xon && echo "find $dirs -xdev ... " find $dirs -xdev | grep -v \ -e ^SHARE/packa \ -e ^SHARE/back \ -e ^SHARE/irix-stow \ -e ^SHARE/linux-stow | cpio -o -H ustar -O $TAPE -v ;; tar) test x"$VERBOSE" = xon && echo "tar -lcf - $dirs | ... " if test x"$HOST" = x; then tar -l -cf - $dirs | $BUFFER >$TAPE_DEV else tar -l -cf - $dirs | $BUFFER | rsh $HOST "$BUFFER >$TAPE_DEV" fi ;; *) echo "$METHOD: invalid method" exit 2 ;; esac