source: trunk/mindi/rootfs/sbin/insist-on-cd @ 1

Last change on this file since 1 was 1, checked in by bcornec, 14 years ago

Initial import from latest mondo-2.04_cvs_20050503/mindi-1.04_cvs_20050503 on http://www.mondorescue.org

File size: 1.4 KB
Line 
1#!/bin/sh
2
3
4
5InsistOnCD() {
6    local the_next_cd cd_inserted_correctly line present_cd
7    the_next_cd=$1
8
9    if [ "`ThisCDsNumber`" = "$the_next_cd" ] ; then
10#        echo "CD #$the_next_cd is already inserted. Proceeding."
11        return 0
12    fi
13
14    cd_inserted_correctly="no"
15
16# -- can't do w/o supermount until/unless softlinks from /usr/share/mondo
17# -- to /mnt/cdrom/usr/share/mondo are cut (I think).. but we'll see.. :)
18#    umount /mnt/cdrom; # to see if we can do without supermount :)
19#    if [ "$?" -ne "0" ] ; then
20#   LogIt "To paraphrase Celine Dion, 'I can't li-i-i-ive, if living is without supermount.'" 1
21#    fi
22    while [ "$cd_inserted_correctly" != "yes" ] ; do
23    umount /mnt/cdrom
24        eject /dev/cdrom
25    echo -n "Please insert CD #$the_next_cd in this set, then press ENTER."
26    read line
27    mount /mnt/cdrom
28    ls /mnt/cdrom/archives &> /tmp/try_to_read_cd.txt
29    if [ "$?" -ne "0" ] ; then
30        echo "Bad CD? No CD? I can't find /mnt/cdrom/archives. \
31Please try again."
32        elif [ "`ThisCDsNumber`" != "$the_next_cd" ] ; then
33            echo "This CD is #`ThisCDsNumber`; \
34I want #$the_next_cd. Try again."
35    else
36        echo -e -n "Thankyou. "
37        cd_inserted_correctly="yes"
38    fi
39    done
40    LogIt "Now processing CD#$the_next_cd." 1
41}
42
43
44ThisCDsNumber() {
45    if [ ! -f "/mnt/cdrom/archives/THIS-CD-NUMBER" ] ; then
46        echo "(absent)"
47    else
48        cat /mnt/cdrom/archives/THIS-CD-NUMBER
49    fi
50}
51
52InsistOnCD $1
53exit $?
Note: See TracBrowser for help on using the repository browser.