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