File: cdsave

package info (click to toggle)
cdbackup 0.7.0-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 176 kB
  • ctags: 185
  • sloc: ansic: 1,241; sh: 105; makefile: 76
file content (65 lines) | stat: -rwxr-xr-x 1,244 bytes parent folder | download | duplicates (7)
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