[1] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
[232] | 3 | # $Id: post-init 3319 2014-12-01 22:35:39Z bruno $
|
---|
[1] | 4 | #
|
---|
| 5 | #------------------------------------------------------------
|
---|
| 6 |
|
---|
[3319] | 7 | if [ -f "/tmp/mountlist.txt" ]; then
|
---|
| 8 | echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
|
---|
| 9 | cat /tmp/mountlist.txt >> $LOGFILE
|
---|
| 10 | fi
|
---|
[1] | 11 |
|
---|
[273] | 12 | iso=`grep iso /proc/cmdline`
|
---|
| 13 | nuke=`grep nuke /proc/cmdline`
|
---|
[1] | 14 | if [ "$nuke" = "" ] ; then
|
---|
[273] | 15 | nuke=`grep -i "RESTORE " /proc/cmdline`
|
---|
[1] | 16 | fi
|
---|
[273] | 17 | expert=`grep expert /proc/cmdline`
|
---|
| 18 | compare=`grep compare /proc/cmdline`
|
---|
| 19 | interactive=`grep interactive /proc/cmdline`
|
---|
[2098] | 20 | pxe=`grep pxe /proc/cmdline`
|
---|
[1] | 21 | [ "$interactive" ] && expert=""; # in case 'expert' crops up somewhere
|
---|
| 22 | if which mondorestore > /dev/null 2> /dev/null ; then
|
---|
| 23 | LogIt "mondorestore found; cool..."
|
---|
| 24 | else
|
---|
[2098] | 25 | if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
|
---|
[2856] | 26 | LogIt "The mondorestore command was not found on your backup media" 1
|
---|
[2915] | 27 | LogIt "It may mean your device is not seen correctly." 1
|
---|
| 28 | LogIt "Check driver list and error messages." 1
|
---|
[739] | 29 | exit 0
|
---|
[1] | 30 | else
|
---|
[739] | 31 | LogIt "Mindi-Linux has finished booting."
|
---|
[1] | 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 |
|
---|
[1962] | 60 | mondoopt=""
|
---|
[1983] | 61 | if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
|
---|
[1962] | 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 |
|
---|
[3319] | 69 | # Now suppress msg redirection to avoid poluting log file
|
---|
| 70 | exec 2>&4 >&5 4>&- 5>&-
|
---|
| 71 |
|
---|
[1] | 72 | if [ "$compare" ] ; then
|
---|
| 73 | LogIt "------------------COMPARE MODE-----------------" 1
|
---|
[1967] | 74 | mondorestore $mondoopt -Z compare
|
---|
[1] | 75 | elif [ "$nuke" ] ; then
|
---|
| 76 | LogIt "-------------------NUKE MODE-------------------" 1
|
---|
[1967] | 77 | mondorestore $mondoopt -Z nuke
|
---|
[1] | 78 | elif [ "$expert" ] ; then
|
---|
[1983] | 79 | if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
---|
[1] | 80 | LogIt "-------------------TAPE MODE-------------------" 1
|
---|
| 81 | loc=`which mondorestore 2> /dev/null`
|
---|
| 82 | if [ "$loc" = "" ] ; then
|
---|
| 83 | LogIt "I presume you backed up with Mindi, not Mondo." 1
|
---|
| 84 | else
|
---|
| 85 | LogIt "Tape Mode -- calling mondorestore..."
|
---|
| 86 | if [ "$nuke" ] ; then
|
---|
[1967] | 87 | mondorestore $mondoopt -Z nuke
|
---|
[1] | 88 | else
|
---|
[1962] | 89 | mondorestore $mondoopt; # MR will detect & access the tape
|
---|
[1] | 90 | fi
|
---|
| 91 | fi
|
---|
[1983] | 92 | elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
---|
[1] | 93 | LogIt "------------------CDSTREAM MODE------------------" 1
|
---|
| 94 | loc=`which mondorestore 2> /dev/null`
|
---|
| 95 | if [ "$loc" = "" ] ; then
|
---|
| 96 | LogIt "I presume you backed up with Mindi, not Mondo." 1
|
---|
| 97 | else
|
---|
| 98 | LogIt "Cdstream Mode -- calling mondorestore..."
|
---|
| 99 | if [ "$nuke" ] ; then
|
---|
[1967] | 100 | mondorestore -Z nuke $mondoopt
|
---|
[1] | 101 | else
|
---|
[1962] | 102 | mondorestore $mondoopt; # MR will detect & access the cdstream
|
---|
[1] | 103 | fi
|
---|
| 104 | fi
|
---|
| 105 | else
|
---|
[1612] | 106 | LogIt "------------------EXPERT MODE------------------" 1
|
---|
| 107 | LogIt "You do all the work. :-)" 1
|
---|
| 108 | if which mondorestore > /dev/null 2> /dev/null ; then
|
---|
[1] | 109 | LogIt "Type 'mondorestore' to begin the restore/compare process." 1
|
---|
| 110 | fi
|
---|
| 111 | fi
|
---|
| 112 | else
|
---|
| 113 | LogIt "------------------INTERACTIVE------------------" 1
|
---|
[1967] | 114 | mondorestore -Z interactive $mondoopt
|
---|
[1] | 115 | fi
|
---|
| 116 |
|
---|
[1967] | 117 | [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
|
---|
[1] | 118 |
|
---|
| 119 | exit 0
|
---|