1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # $Id: post-init 3279 2014-04-30 11:05:17Z bruno $
|
---|
4 | #
|
---|
5 | #------------------------------------------------------------
|
---|
6 |
|
---|
7 | if [ -f "/tmp/mountlist.txt" ]; then
|
---|
8 | echo "Here is my /tmp/mountlist.txt" >> $LOGFILE
|
---|
9 | cat /tmp/mountlist.txt >> $LOGFILE
|
---|
10 | fi
|
---|
11 |
|
---|
12 | iso=`grep iso /proc/cmdline`
|
---|
13 | nuke=`grep nuke /proc/cmdline`
|
---|
14 | if [ "$nuke" = "" ] ; then
|
---|
15 | nuke=`grep -i "RESTORE " /proc/cmdline`
|
---|
16 | fi
|
---|
17 | expert=`grep expert /proc/cmdline`
|
---|
18 | compare=`grep compare /proc/cmdline`
|
---|
19 | interactive=`grep interactive /proc/cmdline`
|
---|
20 | pxe=`grep pxe /proc/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 "The mondorestore command was not found on your backup media" 1
|
---|
27 | LogIt "It may mean your device is not seen correctly." 1
|
---|
28 | LogIt "Check driver list and error messages." 1
|
---|
29 | exit 0
|
---|
30 | else
|
---|
31 | LogIt "Mindi-Linux has finished booting."
|
---|
32 | fi
|
---|
33 | fi
|
---|
34 |
|
---|
35 | if [ -h "`which mondorestore`" ] ; then
|
---|
36 | LogIt "Turning mondorestore from a hyperlink into an executable"
|
---|
37 | cat `which mondorestore` > /usr/bin/MR
|
---|
38 | # in case there's more than one instance :)
|
---|
39 | rm -f `which mondorestore 2> /dev/null`
|
---|
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 | mv /usr/bin/MR /usr/bin/mondorestore
|
---|
44 | chmod +x /usr/bin/mondorestore
|
---|
45 | fi
|
---|
46 |
|
---|
47 | if which bootstrap > /dev/null 2> /dev/null ; then
|
---|
48 | LogIt "Calling bootstrap script" 1
|
---|
49 | bootstrap
|
---|
50 | fi
|
---|
51 |
|
---|
52 | for i in mount-me unmount-me mondorestore ; do
|
---|
53 | if which $i > /dev/null 2> /dev/null ; then
|
---|
54 | LogIt "$i found"
|
---|
55 | else
|
---|
56 | LogIt "Warning - $i not found on ramdisk."
|
---|
57 | fi
|
---|
58 | done
|
---|
59 |
|
---|
60 | mondoopt=""
|
---|
61 | if [ "`grep -i 'obdr ' /tmp/mondorestore.cfg 2> /dev/null`" ]; then
|
---|
62 | mondoopt="$mondoopt -o -d $TAPEDEV"
|
---|
63 | fi
|
---|
64 |
|
---|
65 | if [ "`grep -i 'debug' /proc/cmdline`" ]; then
|
---|
66 | mondoopt="$mondoopt -K 99"
|
---|
67 | fi
|
---|
68 |
|
---|
69 | # Now suppress msg redirection to avoid poluting log file
|
---|
70 | exec 2>&4 >&5 4>&- 5>&-
|
---|
71 |
|
---|
72 | if [ "$compare" ] ; then
|
---|
73 | LogIt "------------------COMPARE MODE-----------------" 1
|
---|
74 | mondorestore $mondoopt -Z compare
|
---|
75 | elif [ "$nuke" ] ; then
|
---|
76 | LogIt "-------------------NUKE MODE-------------------" 1
|
---|
77 | mondorestore $mondoopt -Z nuke
|
---|
78 | elif [ "$expert" ] ; then
|
---|
79 | if [ "`grep tapedev /tmp/mondorestore.cfg 2> /dev/null`" ] ; then
|
---|
80 | LogIt "-------------------TAPE 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 "Tape Mode -- calling mondorestore..."
|
---|
86 | if [ "$nuke" ] ; then
|
---|
87 | mondorestore $mondoopt -Z nuke
|
---|
88 | else
|
---|
89 | mondorestore $mondoopt; # MR will detect & access the tape
|
---|
90 | fi
|
---|
91 | fi
|
---|
92 | elif [ "`grep using-cdstream /tmp/mondorestore.cfg 2> /dev/null`" ] ; then
|
---|
93 | LogIt "------------------CDSTREAM MODE------------------" 1
|
---|
94 | loc=`which mondorestore 2> /dev/null`
|
---|
95 | if [ "$loc" = "" ] ; then
|
---|
96 | LogIt "I presume you backed up with Mindi, not Mondo." 1
|
---|
97 | else
|
---|
98 | LogIt "Cdstream Mode -- calling mondorestore..."
|
---|
99 | if [ "$nuke" ] ; then
|
---|
100 | mondorestore -Z nuke $mondoopt
|
---|
101 | else
|
---|
102 | mondorestore $mondoopt; # MR will detect & access the cdstream
|
---|
103 | fi
|
---|
104 | fi
|
---|
105 | else
|
---|
106 | LogIt "------------------EXPERT MODE------------------" 1
|
---|
107 | LogIt "You do all the work. :-)" 1
|
---|
108 | if which mondorestore > /dev/null 2> /dev/null ; then
|
---|
109 | LogIt "Type 'mondorestore' to begin the restore/compare process." 1
|
---|
110 | fi
|
---|
111 | fi
|
---|
112 | else
|
---|
113 | LogIt "------------------INTERACTIVE------------------" 1
|
---|
114 | mondorestore -Z interactive $mondoopt
|
---|
115 | fi
|
---|
116 |
|
---|
117 | [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
|
---|
118 |
|
---|
119 | exit 0
|
---|