[3320] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
| 3 | # $Id: post-init 2856 2011-07-25 13:01:43Z bruno $
|
---|
| 4 | #
|
---|
| 5 | #------------------------------------------------------------
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | sleep 1
|
---|
| 9 |
|
---|
| 10 | echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
|
---|
| 11 | cat /tmp/mountlist.txt >> $LOGFILE
|
---|
| 12 |
|
---|
| 13 | iso=`grep iso /proc/cmdline`
|
---|
| 14 | nuke=`grep nuke /proc/cmdline`
|
---|
| 15 | if [ "$nuke" = "" ] ; then
|
---|
| 16 | nuke=`grep -i "RESTORE " /proc/cmdline`
|
---|
| 17 | fi
|
---|
| 18 | expert=`grep expert /proc/cmdline`
|
---|
| 19 | compare=`grep compare /proc/cmdline`
|
---|
| 20 | interactive=`grep interactive /proc/cmdline`
|
---|
| 21 | pxe=`grep pxe /proc/cmdline`
|
---|
| 22 | [ "$interactive" ] && expert=""; # in case 'expert' crops up somewhere
|
---|
| 23 | if which mondorestore > /dev/null 2> /dev/null ; then
|
---|
| 24 | LogIt "mondorestore found; cool..."
|
---|
| 25 | else
|
---|
| 26 | if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
|
---|
| 27 | LogIt "The mondorestore command was not found on your backup media" 1
|
---|
| 28 | LogIt "It may mean your device is not seen correctly. Check driver list and error messages." 1
|
---|
| 29 | exit 0
|
---|
| 30 | else
|
---|
| 31 | LogIt "Mindi-Linux has finished booting."
|
---|
| 32 | fi
|
---|
| 33 | fi
|
---|
| 34 |
|
---|
| 35 | if [ -h "`which mondorestore`" ] ; then
|
---|
| 36 | LogIt "Turning mondorestore from a hyperlink into an executable"
|
---|
| 37 | cat `which mondorestore` > /usr/bin/MR
|
---|
| 38 | # in case there's more than one instance :)
|
---|
| 39 | rm -f `which mondorestore 2> /dev/null`
|
---|
| 40 | rm -f `which mondorestore 2> /dev/null`
|
---|
| 41 | rm -f `which mondorestore 2> /dev/null`
|
---|
| 42 | rm -f `which mondorestore 2> /dev/null`
|
---|
| 43 | mv /usr/bin/MR /usr/bin/mondorestore
|
---|
| 44 | chmod +x /usr/bin/mondorestore
|
---|
| 45 | fi
|
---|
| 46 |
|
---|
| 47 | if which bootstrap > /dev/null 2> /dev/null ; then
|
---|
| 48 | LogIt "Calling bootstrap script" 1
|
---|
| 49 | bootstrap
|
---|
| 50 | fi
|
---|
| 51 |
|
---|
| 52 | for i in mount-me unmount-me mondorestore ; do
|
---|
| 53 | if which $i > /dev/null 2> /dev/null ; then
|
---|
| 54 | LogIt "$i found"
|
---|
| 55 | else
|
---|
| 56 | LogIt "Warning - $i not found on ramdisk."
|
---|
| 57 | fi
|
---|
| 58 | done
|
---|
| 59 |
|
---|
| 60 | mondoopt=""
|
---|
| 61 | if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
|
---|
| 62 | mondoopt="$mondoopt -o -d $TAPEDEV"
|
---|
| 63 | fi
|
---|
| 64 |
|
---|
| 65 | if [ "`grep -i 'debug' /proc/cmdline`" ]; then
|
---|
| 66 | mondoopt="$mondoopt -K 99"
|
---|
| 67 | fi
|
---|
| 68 |
|
---|
| 69 | if [ "$compare" ] ; then
|
---|
| 70 | LogIt "------------------COMPARE MODE-----------------" 1
|
---|
| 71 | mondorestore $mondoopt -Z compare
|
---|
| 72 | elif [ "$nuke" ] ; then
|
---|
| 73 | LogIt "-------------------NUKE MODE-------------------" 1
|
---|
| 74 | mondorestore $mondoopt -Z nuke
|
---|
| 75 | elif [ "$expert" ] ; then
|
---|
| 76 | if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
---|
| 77 | LogIt "-------------------TAPE MODE-------------------" 1
|
---|
| 78 | loc=`which mondorestore 2> /dev/null`
|
---|
| 79 | if [ "$loc" = "" ] ; then
|
---|
| 80 | LogIt "I presume you backed up with Mindi, not Mondo." 1
|
---|
| 81 | else
|
---|
| 82 | LogIt "Tape Mode -- calling mondorestore..."
|
---|
| 83 | if [ "$nuke" ] ; then
|
---|
| 84 | mondorestore $mondoopt -Z nuke
|
---|
| 85 | else
|
---|
| 86 | mondorestore $mondoopt; # MR will detect & access the tape
|
---|
| 87 | fi
|
---|
| 88 | fi
|
---|
| 89 | elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
---|
| 90 | LogIt "------------------CDSTREAM MODE------------------" 1
|
---|
| 91 | loc=`which mondorestore 2> /dev/null`
|
---|
| 92 | if [ "$loc" = "" ] ; then
|
---|
| 93 | LogIt "I presume you backed up with Mindi, not Mondo." 1
|
---|
| 94 | else
|
---|
| 95 | LogIt "Cdstream Mode -- calling mondorestore..."
|
---|
| 96 | if [ "$nuke" ] ; then
|
---|
| 97 | mondorestore -Z nuke $mondoopt
|
---|
| 98 | else
|
---|
| 99 | mondorestore $mondoopt; # MR will detect & access the cdstream
|
---|
| 100 | fi
|
---|
| 101 | fi
|
---|
| 102 | else
|
---|
| 103 | LogIt "------------------EXPERT MODE------------------" 1
|
---|
| 104 | LogIt "You do all the work. :-)" 1
|
---|
| 105 | if which mondorestore > /dev/null 2> /dev/null ; then
|
---|
| 106 | LogIt "Type 'mondorestore' to begin the restore/compare process." 1
|
---|
| 107 | fi
|
---|
| 108 | fi
|
---|
| 109 | else
|
---|
| 110 | LogIt "------------------INTERACTIVE------------------" 1
|
---|
| 111 | mondorestore -Z interactive $mondoopt
|
---|
| 112 | fi
|
---|
| 113 |
|
---|
| 114 | [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
|
---|
| 115 |
|
---|
| 116 | exit 0
|
---|