source: MondoRescue/branches/2.2.7/mindi/rootfs/sbin/post-init@ 1983

Last change on this file since 1983 was 1983, checked in by Bruno Cornec, 16 years ago
  • Remove aux-tools dir in mindi (either scripts moved or removed)
  • Remove isolinux and syslinux static files from mindi. Now generated
  • Remove lilo support for ia32 now useless in mindi
  • Remoce empty directories in rootfs in mindi
  • Remove HackSyslinuxFile, CopyBootBFile, FindLiloBinary, FindSensibleBootBFile, MakeSyslinuxMessageFile, MakeLiloConfFile, ReplaceIndividualLine in mindi
  • Adds a single MakeBootConfFile function to dynamiclly create needed conf files in mindi
  • Avoids error messages when using only mindi with a non-existant /tmp/mondo-restore.cfg
  • Property svn:keywords set to Id
File size: 5.1 KB
Line 
1#!/bin/sh
2#
3# $Id: post-init 1983 2008-06-16 19:40:42Z bruno $
4#
5#------------------------------------------------------------
6
7
8call_multifunc_cd() {
9 echo "Hooray! I'm a multi-function CD. Oo! Oo!"
10 mount | grep cdrom > /dev/null 2> /dev/null || mount /dev/cdrom /mnt/cdrom >> $LOGFILE 2>> $LOGFILE
11 for i in bin lib usr sbin ; do
12 echo -en "\rNormalizing $i ... "
13 if [ -d "/mnt/cdrom/$i" ] ; then
14 for j in `find /mnt/cdrom/$i` ; do
15 k=`echo "$j" | awk -F '/' '{for(i=4; i<=NF;i++) {printf("/%s",$i);};printf "\n"; }'`
16 mkdir -p $k
17 rmdir $k 2> /dev/null
18 ln -sf $j $k
19 done
20 fi
21 done
22 echo -en "\rNormalized softlinks OK.\n"
23 echo -en "Shall I run a CPU burn-in test in the background (y/n) ?"
24 read line
25 if [ "$line" = "y" ] || [ "$line" = "Y" ] || [ "$line" = "yes" ] || [ "$line" = "YES" ] ; then
26 for i in `find /usr/local/sbin/burn*` ; do basename $i ; done
27 echo -en "...Which one ?"
28 read line
29 $i || echo $? &
30 fi
31 for i in lucifer mprime ; do
32# tiobench ide-smart
33 if which $i > /dev/null > /dev/null ; then
34 echo -en "Shall I run $i (y/n) ?"
35 read line
36 if [ "$line" = "y" ] || [ "$line" = "Y" ] || [ "$line" = "yes" ] || [ "$line" = "YES" ] ; then
37 echo "Running $i ..."
38 $i || echo "Warning - $i returned an error"
39 fi
40 fi
41 done
42
43# echo "Running bash."
44# busybox sh
45 echo "Exiting multi-function CD thingy. Please reboot immediately."
46 exit 0
47}
48
49
50# ---------------------------- main ----------------------------
51
52sleep 1
53
54if [ -e "/MULTIFUNC" ] ; then
55 LogIt "I think this is a multifunc CD but I'm not going there today."
56# call_multifunc_cd
57fi
58
59cat /tmp/mountlist.txt >> $LOGFILE
60
61iso=`grep iso /proc/cmdline`
62nuke=`grep nuke /proc/cmdline`
63if [ "$nuke" = "" ] ; then
64 nuke=`grep -i "RESTORE " /proc/cmdline`
65fi
66expert=`grep expert /proc/cmdline`
67compare=`grep compare /proc/cmdline`
68interactive=`grep interactive /proc/cmdline`
69[ "$interactive" ] && expert=""; # in case 'expert' crops up somewhere
70if which mondorestore > /dev/null 2> /dev/null ; then
71 LogIt "mondorestore found; cool..."
72else
73 if [ "$iso$nuke$compare$interactive" != "" ] ; then
74 LogIt "FYI, this CD was made by Mindi, not Mondo." 1
75 exit 0
76 else
77 LogIt "Mindi-Linux has finished booting."
78 fi
79fi
80
81if [ -h "`which mondorestore`" ] ; then
82 LogIt "Turning mondorestore from a hyperlink into an executable"
83 cat `which mondorestore` > /usr/bin/MR
84# in case there's more than one instance :)
85 rm -f `which mondorestore 2> /dev/null`
86 rm -f `which mondorestore 2> /dev/null`
87 rm -f `which mondorestore 2> /dev/null`
88 rm -f `which mondorestore 2> /dev/null`
89 mv /usr/bin/MR /usr/bin/mondorestore
90 chmod +x /usr/bin/mondorestore
91fi
92
93if which bootstrap > /dev/null 2> /dev/null ; then
94 LogIt "Calling bootstrap script" 1
95 bootstrap
96fi
97
98for i in mount-me unmount-me mondorestore ; do
99 if which $i > /dev/null 2> /dev/null ; then
100 LogIt "$i found"
101 else
102 LogIt "Warning - $i not found on ramdisk."
103 fi
104done
105
106mondoopt=""
107if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg 2> /dev/null`" ]; then
108 mondoopt="$mondoopt -o -d $TAPEDEV"
109fi
110
111if [ "`grep -i 'debug' /proc/cmdline`" ]; then
112 mondoopt="$mondoopt -K 99"
113fi
114
115if [ "$compare" ] ; then
116 LogIt "------------------COMPARE MODE-----------------" 1
117 mondorestore $mondoopt -Z compare
118elif [ "$nuke" ] ; then
119 LogIt "-------------------NUKE MODE-------------------" 1
120 mondorestore $mondoopt -Z nuke
121elif [ "$expert" ] ; then
122 if [ "`grep tapedev /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
123 LogIt "-------------------TAPE MODE-------------------" 1
124 loc=`which mondorestore 2> /dev/null`
125 if [ "$loc" = "" ] ; then
126 LogIt "I presume you backed up with Mindi, not Mondo." 1
127 else
128 LogIt "Tape Mode -- calling mondorestore..."
129 if [ "$nuke" ] ; then
130 mondorestore $mondoopt -Z nuke
131 else
132 mondorestore $mondoopt; # MR will detect & access the tape
133 fi
134 fi
135 elif [ "`grep using-cdstream /tmp/mondo-restore.cfg 2> /dev/null`" ] ; then
136 LogIt "------------------CDSTREAM MODE------------------" 1
137 loc=`which mondorestore 2> /dev/null`
138 if [ "$loc" = "" ] ; then
139 LogIt "I presume you backed up with Mindi, not Mondo." 1
140 else
141 LogIt "Cdstream Mode -- calling mondorestore..."
142 if [ "$nuke" ] ; then
143 mondorestore -Z nuke $mondoopt
144 else
145 mondorestore $mondoopt; # MR will detect & access the cdstream
146 fi
147 fi
148 else
149 LogIt "------------------EXPERT MODE------------------" 1
150 LogIt "You do all the work. :-)" 1
151 if which mondorestore > /dev/null 2> /dev/null ; then
152 LogIt "Type 'mondorestore' to begin the restore/compare process." 1
153 loc=`which ISO 2> /dev/null`
154 fi
155 fi
156else
157 LogIt "------------------INTERACTIVE------------------" 1
158 mondorestore -Z interactive $mondoopt
159fi
160
161[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
162
163exit 0
Note: See TracBrowser for help on using the repository browser.