[1] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
[232] | 3 | # $Id: post-init 2098 2008-12-23 09:09:40Z bruno $
|
---|
[1] | 4 | #
|
---|
| 5 | #------------------------------------------------------------
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | sleep 1
|
---|
| 9 |
|
---|
[2098] | 10 | echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
|
---|
[1315] | 11 | cat /tmp/mountlist.txt >> $LOGFILE
|
---|
[1] | 12 |
|
---|
[273] | 13 | iso=`grep iso /proc/cmdline`
|
---|
| 14 | nuke=`grep nuke /proc/cmdline`
|
---|
[1] | 15 | if [ "$nuke" = "" ] ; then
|
---|
[273] | 16 | nuke=`grep -i "RESTORE " /proc/cmdline`
|
---|
[1] | 17 | fi
|
---|
[273] | 18 | expert=`grep expert /proc/cmdline`
|
---|
| 19 | compare=`grep compare /proc/cmdline`
|
---|
| 20 | interactive=`grep interactive /proc/cmdline`
|
---|
[2098] | 21 | pxe=`grep pxe /proc/cmdline`
|
---|
[1] | 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
|
---|
[2098] | 26 | if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
|
---|
[739] | 27 | LogIt "FYI, this CD was made by Mindi, not Mondo." 1
|
---|
| 28 | exit 0
|
---|
[1] | 29 | else
|
---|
[739] | 30 | LogIt "Mindi-Linux has finished booting."
|
---|
[1] | 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 |
|
---|
[1962] | 59 | mondoopt=""
|
---|
[1983] | 60 | if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
|
---|
[1962] | 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 |
|
---|
[1] | 68 | if [ "$compare" ] ; then
|
---|
| 69 | LogIt "------------------COMPARE MODE-----------------" 1
|
---|
[1967] | 70 | mondorestore $mondoopt -Z compare
|
---|
[1] | 71 | elif [ "$nuke" ] ; then
|
---|
| 72 | LogIt "-------------------NUKE MODE-------------------" 1
|
---|
[1967] | 73 | mondorestore $mondoopt -Z nuke
|
---|
[1] | 74 | elif [ "$expert" ] ; then
|
---|
[1983] | 75 | if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
---|
[1] | 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
|
---|
[1967] | 83 | mondorestore $mondoopt -Z nuke
|
---|
[1] | 84 | else
|
---|
[1962] | 85 | mondorestore $mondoopt; # MR will detect & access the tape
|
---|
[1] | 86 | fi
|
---|
| 87 | fi
|
---|
[1983] | 88 | elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
---|
[1] | 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
|
---|
[1967] | 96 | mondorestore -Z nuke $mondoopt
|
---|
[1] | 97 | else
|
---|
[1962] | 98 | mondorestore $mondoopt; # MR will detect & access the cdstream
|
---|
[1] | 99 | fi
|
---|
| 100 | fi
|
---|
| 101 | else
|
---|
[1612] | 102 | LogIt "------------------EXPERT MODE------------------" 1
|
---|
| 103 | LogIt "You do all the work. :-)" 1
|
---|
| 104 | if which mondorestore > /dev/null 2> /dev/null ; then
|
---|
[1] | 105 | LogIt "Type 'mondorestore' to begin the restore/compare process." 1
|
---|
| 106 | fi
|
---|
| 107 | fi
|
---|
| 108 | else
|
---|
| 109 | LogIt "------------------INTERACTIVE------------------" 1
|
---|
[1967] | 110 | mondorestore -Z interactive $mondoopt
|
---|
[1] | 111 | fi
|
---|
| 112 |
|
---|
[1967] | 113 | [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
|
---|
[1] | 114 |
|
---|
| 115 | exit 0
|
---|