Changeset 1770 in MondoRescue for branches/stable/mindi/rootfs/sbin/find-and-mount-cdrom
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi/rootfs/sbin/find-and-mount-cdrom
r1581 r1770 4 4 TryToFindCDROM() { 5 5 # hda1 is there for testing 6 LogIt "find-and-mount-cdrom --- starting"7 for device in /dev/hd? /dev/scd? /dev/rcd? /dev/sr? /dev/cd? /dev/ide/*/*/*/*/cd /dev/scsi/*/*/*/*/cd; do8 [ ! "$SECOND_TRY" ] && LogIt "Trying $device"9 if [ "`grep "using-cdstream=yes" /tmp/mondo-restore.cfg`" ]; then10 pwd=`pwd`11 cd $GROOVY12 tar -zxf $device 2> /tmp/mount.log13 res=$?14 cd $pwd15 if [ "$res" -eq "0" ] ; then6 LogIt "find-and-mount-cdrom --- starting" 7 for device in /dev/hd? /dev/scd? /dev/rcd? /dev/sr? /dev/cd? /dev/ide/*/*/*/*/cd /dev/scsi/*/*/*/*/cd; do 8 [ ! "$SECOND_TRY" ] && LogIt "Trying $device" 9 if [ "`grep "using-cdstream yes" /tmp/mondo-restore.cfg`" ]; then 10 pwd=`pwd` 11 cd $GROOVY 12 tar -zxf $device 2> /tmp/mount.log 13 res=$? 14 cd $pwd 15 if [ "$res" -eq "0" ] ; then 16 16 clear 17 LogIt "Using cdstream as extended datadisk ($device). Good." 318 echo "Using cdstrea mas extd dsk." > /tmp/TAPEDEV-HAS-DATA-DISKS19 ln -sf $device /dev/cdrom20 exit 021 fi22 else23 mount $device -t iso9660 -o ro /mnt/cdrom 2> /tmp/mount.log24 res=$?25 fi17 LogIt "Using cdstream as extended datadisk ($device). Good." 3 18 echo "Using cdstrea as extd dsk." > /tmp/TAPEDEV-HAS-DATA-DISKS 19 ln -sf $device /dev/cdrom 20 exit 0 21 fi 22 else 23 mount $device -t iso9660 -o ro /mnt/cdrom 2> /tmp/mount.log 24 res=$? 25 fi 26 26 if [ "$res" -ne "0" ] ; then 27 27 res=`cat /tmp/mount.log` … … 37 37 ln -sf $device /dev/cdrom 38 38 if [ "$?" -ne "0" ]; then 39 LogIt "Unable to softlink $device to /dev/cdrom. That's weird."40 continue39 LogIt "Unable to softlink $device to /dev/cdrom. That's weird." 40 continue 41 41 fi 42 LogIt "CD-ROM found at $device"42 LogIt "CD-ROM found at $device" 43 43 mount /mnt/cdrom 44 if [ "$?" -ne "0" ] ; then45 LogIt "Cannot mount /dev/cdrom (type $format) (dev=$device)"46 continue47 elif [ ! -d "/mnt/cdrom/archives" ] ; then48 LogIt "There is a CD in $device but it's not a Mondo CD"49 continue50 else51 LogIt "$device is where the Mondo CD lives."52 which hdparm > /dev/null 2> /dev/null && hdparm -u1 -c3 -d1 $device53 return 044 if [ "$?" -ne "0" ] ; then 45 LogIt "Cannot mount /dev/cdrom (type $format) (dev=$device)" 46 continue 47 elif [ ! -d "/mnt/cdrom/archives" ] ; then 48 LogIt "There is a CD in $device but it's not a Mondo CD" 49 continue 50 else 51 LogIt "$device is where the Mondo CD lives." 52 which hdparm > /dev/null 2> /dev/null && hdparm -u1 -c3 -d1 $device 53 return 0 54 54 fi 55 done56 LogIt "Failed to find CD-ROM"57 return 155 done 56 LogIt "Failed to find CD-ROM" 57 return 1 58 58 } 59 59 … … 63 63 [ "$1" = "--second-try" ] && SECOND_TRY=yes 64 64 if [ ! "$GROOVY" ] ; then 65 LogIt "I'm not groovy!"66 exit 165 LogIt "I'm not groovy!" 66 exit 1 67 67 fi 68 68 69 69 TryToFindCDROM 70 70 if [ "$?" -eq "0" ] ; then 71 [ "$SECOND_TRY" ] && add="At 2nd attempt, " || add=""72 LogIt $add"CD-ROM found and mounted at $device" 373 echo "$device" > /tmp/CDROM-LIVES-HERE74 LogIt "find-and-mount-cdrom --- leaving (0)"75 exit 071 [ "$SECOND_TRY" ] && add="At 2nd attempt, " || add="" 72 LogIt $add"CD-ROM found and mounted at $device" 3 73 echo "$device" > /tmp/CDROM-LIVES-HERE 74 LogIt "find-and-mount-cdrom --- leaving (0)" 75 exit 0 76 76 fi 77 77 [ "$1" = "--second-try" ] && exit 1; 78 78 if [ "`grep "using-cdstream=yes" /tmp/mondo-restore.cfg`" ] ; then 79 LogIt "Because you are using cdstream, I won't try to mount CD."80 exit 079 LogIt "Because you are using cdstream, I won't try to mount CD." 80 exit 0 81 81 fi
Note:
See TracChangeset
for help on using the changeset viewer.
