"Fossies" - the Fresh Open Source Software Archive

Member "afio-2.5.2/script4/tapechange" (30 Nov 2018, 1164 Bytes) of package /linux/misc/afio-2.5.2.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 # Use this with -F from tar and -H with afio to change the backup device.
    3 
    4 #Script provided by Raphael Manfredi <Raphael_Manfredi@pobox.com>.
    5 
    6 vol="$1"
    7 device="$2"
    8 message="$3"
    9 
   10 # debugging -- show error message to ensure it was a "no space left"
   11 case "$message" in
   12 '') ;;
   13 *) echo "Got error '$message'";;
   14 esac
   15 
   16 case "$device" in
   17 /dev/tape|/dev/ntape)
   18         medium=tape
   19         echo -n "Ejecting tape..."
   20         mt -f$device offline
   21         echo "done."
   22         ;;
   23 /dev/floppy)
   24         medium="floppy disk"
   25         ;;
   26 *)
   27         echo "Unrecognized medium device!"
   28         medium="backup medium"
   29         ;;
   30 esac
   31 
   32 cont=true
   33 while $cont; do
   34         echo "Please insert $medium for volume #$vol..."
   35         echo -n "Press \"return\" when $medium is ready, or enter \"q\" to quit:
   36  ^G"
   37         read ans
   38         case "$ans" in
   39         q*) exit 1;;
   40         esac
   41         case "$medium" in
   42         tape)
   43                 mt -f$device status >/dev/null 2>&1
   44                 case "$?" in
   45                 0) cont=false;;
   46                 *) echo "Tape status error.";;
   47                 esac
   48                 ;;
   49         *)
   50                 cont=false
   51         esac
   52 done