1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#!/bin/bash
# defaults
LABEL="Afio-Backup"
SCSIDEV="0,4,0"
DEVICE="/dev/sr1"
SPEED="8"
LEN="702"
MULTI=""
# process command-line options
while getopts ":a:d:r:s:l:m" optn; do
case $optn in
a ) LABEL=$OPTARG
;;
d ) DEVICE=$OPTARG
;;
r ) SCSIDEV=$OPTARG
;;
s ) SPEED=$OPTARG
;;
l ) LEN=$OPTARG
;;
m ) MULTI="-m"
;;
\? ) echo "Usage: `basename $0` [-a label] [-l cd_len] [-m] [-d device] [-r scsidev] [-s speed] file1 file2 ..."
echo ""
echo "Defaults: -a Afio-Backup"
echo " -d /dev/sr1"
echo " -r 0,4,0"
echo " -s 8"
echo " -l 702"
exit 1
;;
esac
done
shift $(($OPTIND - 1))
# process input-files
TMP="/tmp/cdsave.$$"
rm -f $TMP
for filename in "$@"; do
case $filename in
*[*?]* ) # means shell couldnt extend *.wav, etc.
echo "warning: no $filename file(s) found"
;;
* )
echo >>$TMP "$filename"
;;
esac
done
if [ -s $TMP ] ; then
cat $TMP | \
afio -o -uz - | \
cdbackup -v -a "$LABEL" $MULTI -l "$LEN" -d "$DEVICE" -r "$SCSIDEV" -s "$SPEED" -- -v fs=8m
else
echo "Error: no files specified"
fi
rm -f $TMP
|