| [1] | 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| [232] | 3 | # $Id: post-init 2915 2011-12-09 20:19:33Z 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
|
|---|
| [2856] | 27 | LogIt "The mondorestore command was not found on your backup media" 1
|
|---|
| [2915] | 28 | LogIt "It may mean your device is not seen correctly." 1
|
|---|
| 29 | LogIt "Check driver list and error messages." 1
|
|---|
| [739] | 30 | exit 0
|
|---|
| [1] | 31 | else
|
|---|
| [739] | 32 | LogIt "Mindi-Linux has finished booting."
|
|---|
| [1] | 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 |
|
|---|
| [1962] | 61 | mondoopt=""
|
|---|
| [1983] | 62 | if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
|
|---|
| [1962] | 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 |
|
|---|
| [1] | 70 | if [ "$compare" ] ; then
|
|---|
| 71 | LogIt "------------------COMPARE MODE-----------------" 1
|
|---|
| [1967] | 72 | mondorestore $mondoopt -Z compare
|
|---|
| [1] | 73 | elif [ "$nuke" ] ; then
|
|---|
| 74 | LogIt "-------------------NUKE MODE-------------------" 1
|
|---|
| [1967] | 75 | mondorestore $mondoopt -Z nuke
|
|---|
| [1] | 76 | elif [ "$expert" ] ; then
|
|---|
| [1983] | 77 | if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
|---|
| [1] | 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
|
|---|
| [1967] | 85 | mondorestore $mondoopt -Z nuke
|
|---|
| [1] | 86 | else
|
|---|
| [1962] | 87 | mondorestore $mondoopt; # MR will detect & access the tape
|
|---|
| [1] | 88 | fi
|
|---|
| 89 | fi
|
|---|
| [1983] | 90 | elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
|
|---|
| [1] | 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
|
|---|
| [1967] | 98 | mondorestore -Z nuke $mondoopt
|
|---|
| [1] | 99 | else
|
|---|
| [1962] | 100 | mondorestore $mondoopt; # MR will detect & access the cdstream
|
|---|
| [1] | 101 | fi
|
|---|
| 102 | fi
|
|---|
| 103 | else
|
|---|
| [1612] | 104 | LogIt "------------------EXPERT MODE------------------" 1
|
|---|
| 105 | LogIt "You do all the work. :-)" 1
|
|---|
| 106 | if which mondorestore > /dev/null 2> /dev/null ; then
|
|---|
| [1] | 107 | LogIt "Type 'mondorestore' to begin the restore/compare process." 1
|
|---|
| 108 | fi
|
|---|
| 109 | fi
|
|---|
| 110 | else
|
|---|
| 111 | LogIt "------------------INTERACTIVE------------------" 1
|
|---|
| [1967] | 112 | mondorestore -Z interactive $mondoopt
|
|---|
| [1] | 113 | fi
|
|---|
| 114 |
|
|---|
| [1967] | 115 | [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
|
|---|
| [1] | 116 |
|
|---|
| 117 | exit 0
|
|---|