File: tapechange

package info (click to toggle)
afio 2.4.7-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 372 kB
  • ctags: 403
  • sloc: ansic: 4,238; sh: 226; makefile: 64
file content (52 lines) | stat: -rwxr-xr-x 1,164 bytes parent folder | download | duplicates (10)
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
#!/bin/sh
# Use this with -F from tar and -H with afio to change the backup device.

#Script provided by Raphael Manfredi <Raphael_Manfredi@pobox.com>.

vol="$1"
device="$2"
message="$3"

# debugging -- show error message to ensure it was a "no space left"
case "$message" in
'') ;;
*) echo "Got error '$message'";;
esac

case "$device" in
/dev/tape|/dev/ntape)
        medium=tape
        echo -n "Ejecting tape..."
        mt -f$device offline
        echo "done."
        ;;
/dev/floppy)
        medium="floppy disk"
        ;;
*)
        echo "Unrecognized medium device!"
        medium="backup medium"
        ;;
esac

cont=true
while $cont; do
        echo "Please insert $medium for volume #$vol..."
        echo -n "Press \"return\" when $medium is ready, or enter \"q\" to quit:
 ^G"
        read ans
        case "$ans" in
        q*) exit 1;;
        esac
        case "$medium" in
        tape)
                mt -f$device status >/dev/null 2>&1
                case "$?" in
                0) cont=false;;
                *) echo "Tape status error.";;
                esac
                ;;
        *)
                cont=false
        esac
done