| [1] | 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| [232] | 3 | # $Id: post-init 2937 2012-01-28 00:51:28Z bruno $
|
|---|
| [1] | 4 | #
|
|---|
| 5 | #------------------------------------------------------------
|
|---|
| 6 |
|
|---|
| 7 | sleep 1
|
|---|
| 8 |
|
|---|
| [2462] | 9 | echo "Here is my $MINDI_CACHE/mountlist.txt" >> $LOGFILE
|
|---|
| 10 | cat $MINDI_CACHE/mountlist.txt >> $LOGFILE
|
|---|
| 11 | echo "-----------------------------------" >> $LOGFILE
|
|---|
| [1] | 12 |
|
|---|
| [2462] | 13 |
|
|---|
| [2329] | 14 | iso=`grep iso $CMDLINE`
|
|---|
| 15 | nuke=`grep nuke $CMDLINE`
|
|---|
| [1] | 16 | if [ "$nuke" = "" ] ; then
|
|---|
| [2329] | 17 | nuke=`grep -i "RESTORE " $CMDLINE`
|
|---|
| [1] | 18 | fi
|
|---|
| [2329] | 19 | expert=`grep expert $CMDLINE`
|
|---|
| 20 | compare=`grep compare $CMDLINE`
|
|---|
| 21 | interactive=`grep interactive $CMDLINE`
|
|---|
| 22 | pxe=`grep pxe $CMDLINE`
|
|---|
| [1] | 23 | [ "$interactive" ] && expert=""; # in case 'expert' crops up somewhere
|
|---|
| 24 | if which mondorestore > /dev/null 2> /dev/null ; then
|
|---|
| 25 | LogIt "mondorestore found; cool..."
|
|---|
| 26 | else
|
|---|
| [2098] | 27 | if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
|
|---|
| [2937] | 28 | LogIt "The mondorestore command was not found on your backup media" 1
|
|---|
| 29 | LogIt "It may mean your device is not seen correctly." 1
|
|---|
| 30 | LogIt "Check driver list and error messages." 1
|
|---|
| [739] | 31 | exit 0
|
|---|
| [1] | 32 | else
|
|---|
| [739] | 33 | LogIt "Mindi-Linux has finished booting."
|
|---|
| [1] | 34 | fi
|
|---|
| 35 | fi
|
|---|
| 36 |
|
|---|
| 37 | if which bootstrap > /dev/null 2> /dev/null ; then
|
|---|
| 38 | LogIt "Calling bootstrap script" 1
|
|---|
| 39 | bootstrap
|
|---|
| 40 | fi
|
|---|
| 41 |
|
|---|
| [2378] | 42 | for i in mount-me unmount-me ; do
|
|---|
| [1] | 43 | if which $i > /dev/null 2> /dev/null ; then
|
|---|
| 44 | LogIt "$i found"
|
|---|
| 45 | else
|
|---|
| 46 | LogIt "Warning - $i not found on ramdisk."
|
|---|
| 47 | fi
|
|---|
| 48 | done
|
|---|
| 49 |
|
|---|
| [1962] | 50 | mondoopt=""
|
|---|
| [2591] | 51 | if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
|
|---|
| [1962] | 52 | mondoopt="$mondoopt -o -d $TAPEDEV"
|
|---|
| 53 | fi
|
|---|
| 54 |
|
|---|
| [2329] | 55 | if [ "`grep -i 'debug' $CMDLINE`" ]; then
|
|---|
| [1962] | 56 | mondoopt="$mondoopt -K 99"
|
|---|
| 57 | fi
|
|---|
| 58 |
|
|---|
| [1] | 59 | if [ "$compare" ] ; then
|
|---|
| 60 | LogIt "------------------COMPARE MODE-----------------" 1
|
|---|
| [1967] | 61 | mondorestore $mondoopt -Z compare
|
|---|
| [1] | 62 | elif [ "$nuke" ] ; then
|
|---|
| 63 | LogIt "-------------------NUKE MODE-------------------" 1
|
|---|
| [1967] | 64 | mondorestore $mondoopt -Z nuke
|
|---|
| [1] | 65 | elif [ "$expert" ] ; then
|
|---|
| [2591] | 66 | if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep tapedev $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
|
|---|
| [1] | 67 | LogIt "-------------------TAPE MODE-------------------" 1
|
|---|
| 68 | loc=`which mondorestore 2> /dev/null`
|
|---|
| 69 | if [ "$loc" = "" ] ; then
|
|---|
| 70 | LogIt "I presume you backed up with Mindi, not Mondo." 1
|
|---|
| 71 | else
|
|---|
| 72 | LogIt "Tape Mode -- calling mondorestore..."
|
|---|
| 73 | if [ "$nuke" ] ; then
|
|---|
| [1967] | 74 | mondorestore $mondoopt -Z nuke
|
|---|
| [1] | 75 | else
|
|---|
| [1962] | 76 | mondorestore $mondoopt; # MR will detect & access the tape
|
|---|
| [1] | 77 | fi
|
|---|
| 78 | fi
|
|---|
| [2591] | 79 | elif [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep using-cdstream $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
|
|---|
| [1] | 80 | LogIt "------------------CDSTREAM 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 "Cdstream Mode -- calling mondorestore..."
|
|---|
| 86 | if [ "$nuke" ] ; then
|
|---|
| [1967] | 87 | mondorestore -Z nuke $mondoopt
|
|---|
| [1] | 88 | else
|
|---|
| [1962] | 89 | mondorestore $mondoopt; # MR will detect & access the cdstream
|
|---|
| [1] | 90 | fi
|
|---|
| 91 | fi
|
|---|
| 92 | else
|
|---|
| [1612] | 93 | LogIt "------------------EXPERT MODE------------------" 1
|
|---|
| 94 | LogIt "You do all the work. :-)" 1
|
|---|
| 95 | if which mondorestore > /dev/null 2> /dev/null ; then
|
|---|
| [1] | 96 | LogIt "Type 'mondorestore' to begin the restore/compare process." 1
|
|---|
| 97 | fi
|
|---|
| 98 | fi
|
|---|
| 99 | else
|
|---|
| 100 | LogIt "------------------INTERACTIVE------------------" 1
|
|---|
| [1967] | 101 | mondorestore -Z interactive $mondoopt
|
|---|
| [1] | 102 | fi
|
|---|
| 103 |
|
|---|
| [1967] | 104 | [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
|
|---|
| [1] | 105 |
|
|---|
| 106 | exit 0
|
|---|