1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # $Id: post-init 2591 2010-03-11 01:56:00Z 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 "FYI, this CD was made by Mindi, not Mondo." 1
|
---|
29 | exit 0
|
---|
30 | else
|
---|
31 | LogIt "Mindi-Linux has finished booting."
|
---|
32 | fi
|
---|
33 | fi
|
---|
34 |
|
---|
35 | if which bootstrap > /dev/null 2> /dev/null ; then
|
---|
36 | LogIt "Calling bootstrap script" 1
|
---|
37 | bootstrap
|
---|
38 | fi
|
---|
39 |
|
---|
40 | for i in mount-me unmount-me ; do
|
---|
41 | if which $i > /dev/null 2> /dev/null ; then
|
---|
42 | LogIt "$i found"
|
---|
43 | else
|
---|
44 | LogIt "Warning - $i not found on ramdisk."
|
---|
45 | fi
|
---|
46 | done
|
---|
47 |
|
---|
48 | mondoopt=""
|
---|
49 | if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
|
---|
50 | mondoopt="$mondoopt -o -d $TAPEDEV"
|
---|
51 | fi
|
---|
52 |
|
---|
53 | if [ "`grep -i 'debug' $CMDLINE`" ]; then
|
---|
54 | mondoopt="$mondoopt -K 99"
|
---|
55 | fi
|
---|
56 |
|
---|
57 | if [ "$compare" ] ; then
|
---|
58 | LogIt "------------------COMPARE MODE-----------------" 1
|
---|
59 | mondorestore $mondoopt -Z compare
|
---|
60 | elif [ "$nuke" ] ; then
|
---|
61 | LogIt "-------------------NUKE MODE-------------------" 1
|
---|
62 | mondorestore $mondoopt -Z nuke
|
---|
63 | elif [ "$expert" ] ; then
|
---|
64 | if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep tapedev $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
|
---|
65 | LogIt "-------------------TAPE MODE-------------------" 1
|
---|
66 | loc=`which mondorestore 2> /dev/null`
|
---|
67 | if [ "$loc" = "" ] ; then
|
---|
68 | LogIt "I presume you backed up with Mindi, not Mondo." 1
|
---|
69 | else
|
---|
70 | LogIt "Tape Mode -- calling mondorestore..."
|
---|
71 | if [ "$nuke" ] ; then
|
---|
72 | mondorestore $mondoopt -Z nuke
|
---|
73 | else
|
---|
74 | mondorestore $mondoopt; # MR will detect & access the tape
|
---|
75 | fi
|
---|
76 | fi
|
---|
77 | elif [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep using-cdstream $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
|
---|
78 | LogIt "------------------CDSTREAM 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 "Cdstream Mode -- calling mondorestore..."
|
---|
84 | if [ "$nuke" ] ; then
|
---|
85 | mondorestore -Z nuke $mondoopt
|
---|
86 | else
|
---|
87 | mondorestore $mondoopt; # MR will detect & access the cdstream
|
---|
88 | fi
|
---|
89 | fi
|
---|
90 | else
|
---|
91 | LogIt "------------------EXPERT MODE------------------" 1
|
---|
92 | LogIt "You do all the work. :-)" 1
|
---|
93 | if which mondorestore > /dev/null 2> /dev/null ; then
|
---|
94 | LogIt "Type 'mondorestore' to begin the restore/compare process." 1
|
---|
95 | fi
|
---|
96 | fi
|
---|
97 | else
|
---|
98 | LogIt "------------------INTERACTIVE------------------" 1
|
---|
99 | mondorestore -Z interactive $mondoopt
|
---|
100 | fi
|
---|
101 |
|
---|
102 | [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
|
---|
103 |
|
---|
104 | exit 0
|
---|