| 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # $Id: post-init 2915 2011-12-09 20:19:33Z 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." 1
|
|---|
| 29 | LogIt "Check driver list and error messages." 1
|
|---|
| 30 | exit 0
|
|---|
| 31 | else
|
|---|
| 32 | LogIt "Mindi-Linux has finished booting."
|
|---|
| 33 | fi
|
|---|
| 34 | fi
|
|---|
| 35 |
|
|---|
| 36 | if [ -h "`which mondorestore`" ] ; then
|
|---|
| 37 | LogIt "Turning mondorestore from a hyperlink into an executable"
|
|---|
| 38 | cat `which mondorestore` > /usr/bin/MR
|
|---|
| 39 | # in case there's more than one instance :)
|
|---|
| 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 | rm -f `which mondorestore 2> /dev/null`
|
|---|
| 44 | mv /usr/bin/MR /usr/bin/mondorestore
|
|---|
| 45 | chmod +x /usr/bin/mondorestore
|
|---|
| 46 | fi
|
|---|
| 47 |
|
|---|
| 48 | if which bootstrap > /dev/null 2> /dev/null ; then
|
|---|
| 49 | LogIt "Calling bootstrap script" 1
|
|---|
| 50 | bootstrap
|
|---|
| 51 | fi
|
|---|
| 52 |
|
|---|
| 53 | for i in mount-me unmount-me mondorestore ; do
|
|---|
| 54 | if which $i > /dev/null 2> /dev/null ; then
|
|---|
| 55 | LogIt "$i found"
|
|---|
| 56 | else
|
|---|
| 57 | LogIt "Warning - $i not found on ramdisk."
|
|---|
| 58 | fi
|
|---|
| 59 | done
|
|---|
| 60 |
|
|---|
| 61 | mondoopt=""
|
|---|
| 62 | if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
|
|---|
| 63 | mondoopt="$mondoopt -o -d $TAPEDEV"
|
|---|
| 64 | fi
|
|---|
| 65 |
|
|---|
| 66 | if [ "`grep -i 'debug' /proc/cmdline`" ]; then
|
|---|
| 67 | mondoopt="$mondoopt -K 99"
|
|---|
| 68 | fi
|
|---|
| 69 |
|
|---|
| 70 | if [ "$compare" ] ; then
|
|---|
| 71 | LogIt "------------------COMPARE MODE-----------------" 1
|
|---|
| 72 | mondorestore $mondoopt -Z compare
|
|---|
| 73 | elif [ "$nuke" ] ; then
|
|---|
| 74 | LogIt "-------------------NUKE MODE-------------------" 1
|
|---|
| 75 | mondorestore $mondoopt -Z nuke
|
|---|
| 76 | elif [ "$expert" ] ; then
|
|---|
| 77 | if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
|---|
| 78 | LogIt "-------------------TAPE MODE-------------------" 1
|
|---|
| 79 | loc=`which mondorestore 2> /dev/null`
|
|---|
| 80 | if [ "$loc" = "" ] ; then
|
|---|
| 81 | LogIt "I presume you backed up with Mindi, not Mondo." 1
|
|---|
| 82 | else
|
|---|
| 83 | LogIt "Tape Mode -- calling mondorestore..."
|
|---|
| 84 | if [ "$nuke" ] ; then
|
|---|
| 85 | mondorestore $mondoopt -Z nuke
|
|---|
| 86 | else
|
|---|
| 87 | mondorestore $mondoopt; # MR will detect & access the tape
|
|---|
| 88 | fi
|
|---|
| 89 | fi
|
|---|
| 90 | elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
|---|
| 91 | LogIt "------------------CDSTREAM MODE------------------" 1
|
|---|
| 92 | loc=`which mondorestore 2> /dev/null`
|
|---|
| 93 | if [ "$loc" = "" ] ; then
|
|---|
| 94 | LogIt "I presume you backed up with Mindi, not Mondo." 1
|
|---|
| 95 | else
|
|---|
| 96 | LogIt "Cdstream Mode -- calling mondorestore..."
|
|---|
| 97 | if [ "$nuke" ] ; then
|
|---|
| 98 | mondorestore -Z nuke $mondoopt
|
|---|
| 99 | else
|
|---|
| 100 | mondorestore $mondoopt; # MR will detect & access the cdstream
|
|---|
| 101 | fi
|
|---|
| 102 | fi
|
|---|
| 103 | else
|
|---|
| 104 | LogIt "------------------EXPERT MODE------------------" 1
|
|---|
| 105 | LogIt "You do all the work. :-)" 1
|
|---|
| 106 | if which mondorestore > /dev/null 2> /dev/null ; then
|
|---|
| 107 | LogIt "Type 'mondorestore' to begin the restore/compare process." 1
|
|---|
| 108 | fi
|
|---|
| 109 | fi
|
|---|
| 110 | else
|
|---|
| 111 | LogIt "------------------INTERACTIVE------------------" 1
|
|---|
| 112 | mondorestore -Z interactive $mondoopt
|
|---|
| 113 | fi
|
|---|
| 114 |
|
|---|
| 115 | [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
|
|---|
| 116 |
|
|---|
| 117 | exit 0
|
|---|