1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # $Id: post-init 2937 2012-01-28 00:51:28Z bruno $
|
---|
4 | #
|
---|
5 | #------------------------------------------------------------
|
---|
6 |
|
---|
7 | sleep 1
|
---|
8 |
|
---|
9 | echo "Here is my $MINDI_CACHE/mountlist.txt" >> $LOGFILE
|
---|
10 | cat $MINDI_CACHE/mountlist.txt >> $LOGFILE
|
---|
11 | echo "-----------------------------------" >> $LOGFILE
|
---|
12 |
|
---|
13 |
|
---|
14 | iso=`grep iso $CMDLINE`
|
---|
15 | nuke=`grep nuke $CMDLINE`
|
---|
16 | if [ "$nuke" = "" ] ; then
|
---|
17 | nuke=`grep -i "RESTORE " $CMDLINE`
|
---|
18 | fi
|
---|
19 | expert=`grep expert $CMDLINE`
|
---|
20 | compare=`grep compare $CMDLINE`
|
---|
21 | interactive=`grep interactive $CMDLINE`
|
---|
22 | pxe=`grep pxe $CMDLINE`
|
---|
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
|
---|
27 | if [ "$iso$nuke$compare$interactive$pxe" != "" ] ; then
|
---|
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
|
---|
31 | exit 0
|
---|
32 | else
|
---|
33 | LogIt "Mindi-Linux has finished booting."
|
---|
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 |
|
---|
42 | for i in mount-me unmount-me ; do
|
---|
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 |
|
---|
50 | mondoopt=""
|
---|
51 | if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
|
---|
52 | mondoopt="$mondoopt -o -d $TAPEDEV"
|
---|
53 | fi
|
---|
54 |
|
---|
55 | if [ "`grep -i 'debug' $CMDLINE`" ]; then
|
---|
56 | mondoopt="$mondoopt -K 99"
|
---|
57 | fi
|
---|
58 |
|
---|
59 | if [ "$compare" ] ; then
|
---|
60 | LogIt "------------------COMPARE MODE-----------------" 1
|
---|
61 | mondorestore $mondoopt -Z compare
|
---|
62 | elif [ "$nuke" ] ; then
|
---|
63 | LogIt "-------------------NUKE MODE-------------------" 1
|
---|
64 | mondorestore $mondoopt -Z nuke
|
---|
65 | elif [ "$expert" ] ; then
|
---|
66 | if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep tapedev $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
|
---|
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
|
---|
74 | mondorestore $mondoopt -Z nuke
|
---|
75 | else
|
---|
76 | mondorestore $mondoopt; # MR will detect & access the tape
|
---|
77 | fi
|
---|
78 | fi
|
---|
79 | elif [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep using-cdstream $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
|
---|
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
|
---|
87 | mondorestore -Z nuke $mondoopt
|
---|
88 | else
|
---|
89 | mondorestore $mondoopt; # MR will detect & access the cdstream
|
---|
90 | fi
|
---|
91 | fi
|
---|
92 | else
|
---|
93 | LogIt "------------------EXPERT MODE------------------" 1
|
---|
94 | LogIt "You do all the work. :-)" 1
|
---|
95 | if which mondorestore > /dev/null 2> /dev/null ; then
|
---|
96 | LogIt "Type 'mondorestore' to begin the restore/compare process." 1
|
---|
97 | fi
|
---|
98 | fi
|
---|
99 | else
|
---|
100 | LogIt "------------------INTERACTIVE------------------" 1
|
---|
101 | mondorestore -Z interactive $mondoopt
|
---|
102 | fi
|
---|
103 |
|
---|
104 | [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
|
---|
105 |
|
---|
106 | exit 0
|
---|