diff -r d09ec85ffdfe -r 79da91042fcc examples/cdload --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/cdload Sat Dec 29 15:25:21 2007 +0100 @@ -0,0 +1,55 @@ +#!/bin/bash + +# defaults + +DEVICE="/dev/sr1" +TRACK="1" +LIST=0 + +# process command-line options + +while getopts ":d:t:l" optn; do + case $optn in + d ) DEVICE=$OPTARG + ;; + t ) TRACK=$OPTARG + ;; + l ) LIST=1 + ;; + \? ) echo "Usage: `basename $0` [-d device] [-t track] [-l] [filespec]" + echo "" + echo "Defaults: -d /dev/sr1" + echo " -t 1" + echo "" + echo "if -l is given, archive is listed not restored." + exit 1 + ;; + esac +done +shift $(($OPTIND - 1)) + +# process input-files + +TMP="/tmp/cdload.$$" +rm -f $TMP + +SPECOPT="" +for filespec in "$@"; do + echo "$filespec" >>$TMP + SPECOPT="-w $TMP" + done +#echo "-$SPECOPT-" +#cat $TMP +#echo "--" + +if [ $LIST -eq 1 ]; then + aopt="-t" # list archive + echo "`basename $0`: listing archive" +else + aopt="-i" # restore archive + echo "`basename $0`: restoring archive" +fi + +cdrestore -d $DEVICE -t $TRACK | afio $aopt -vnz $SPECOPT - + +rm -f $TMP