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