source: MondoRescue/branches/2.2.10/mindi/rootfs/sbin/init@ 2816

Last change on this file since 2816 was 2816, checked in by Bruno Cornec, 13 years ago

svn merge (in svk) -r 2714:2773 2.2.9 in 2.2.10

r4207@localhost (orig r2716): bruno | 2011-02-03 01:29:51 +0100

  • Increase boot size again to support better fedora 13/14


r4208@localhost (orig r2717): bruno | 2011-02-12 15:43:36 +0100

  • Excluding vmhgfs FS for VMWare guests mounting areas of the host.


r4209@localhost (orig r2718): bruno | 2011-02-18 00:30:35 +0100
-Extend EXTRA-SIZE for Debian 6.0 (at least)


r4210@localhost (orig r2719): bruno | 2011-02-18 00:45:40 +0100

  • Fix #462 (removes temp dir if analyze-my-lvm launched in stand alonae mode)


r4213@localhost (orig r2722): bruno | 2011-02-25 18:44:47 +0100

  • Fixes for RHEL6 support at least around dm extensions, bnx2x and cp210x dependencies


r4214@localhost (orig r2723): bruno | 2011-02-25 19:00:17 +0100

  • Adds a restore quiet option


r4215@localhost (orig r2724): bruno | 2011-02-25 19:43:50 +0100

  • Adds support for dm-log used on RHEL6 as well.


r4216@localhost (orig r2725): bruno | 2011-02-25 21:26:54 +0100

  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3


r4217@localhost (orig r2726): bruno | 2011-02-26 11:38:29 +0100

  • Fix error introduced in previous patch in the if/then/else case without member in the then


r4218@localhost (orig r2727): bruno | 2011-02-26 12:05:33 +0100

  • With mindi-busybox 1.18.3 the syntax of openvt changed. This patch keeps a compatible init script for both previous and current version.


r4219@localhost (orig r2728): bruno | 2011-02-26 15:27:40 +0100

  • Latest lvdisplay print MiB instead of MB. Impact on analyze-my-lvm fixed.


r4220@localhost (orig r2729): bruno | 2011-02-26 16:39:32 +0100

  • Adds feature rpc to mindi-busybox in case of need



r4221@localhost (orig r2730): bruno | 2011-02-26 16:42:43 +0100

  • Adds the rebot command to the list of mandatory ones at restore time


r4222@localhost (orig r2731): bruno | 2011-02-26 17:37:13 +0100

  • Adds functions and /bin/loadkeys (new location) to minimal set of commands to have
  • provides a makemessage option to mindi and this function now works with pbdistrocheck
  • Do not create an error when a phys device has 0 size and is a /dev/dm-* device


r4223@localhost (orig r2732): bruno | 2011-02-26 19:07:43 +0100

  • Syntax fix


r4224@localhost (orig r2733): bruno | 2011-02-26 19:51:16 +0100

  • Fix test on dm which was made in wrong sense
  • Adds a driver to allow raid456 to work


r4225@localhost (orig r2734): bruno | 2011-02-26 20:55:00 +0100

  • Fix 2 redirections issues


r4317@localhost (orig r2737): bruno | 2011-03-13 13:12:57 +0100

  • Add support for libahci driver, mandatory for debian 6.


r4318@localhost (orig r2738): bruno | 2011-03-13 14:46:37 +0100

  • Update from Lester Wade (lester.wade_at_hp.com) incorporating latest ML feedbacks


r4319@localhost (orig r2739): bruno | 2011-03-13 17:49:15 +0100

  • Updated Lab for TES 2011


r4323@localhost (orig r2743): bruno | 2011-03-20 01:37:40 +0100

  • Fix a seg fault bug when using the GUI in case exclude_paths was NULL (mc_at_carreira.com.pt)


r4324@localhost (orig r2744): bruno | 2011-03-20 19:38:14 +0100

  • Adds Arch Linux Keyboard support (mc_at_carreira.com.pt)


r4325@localhost (orig r2745): bruno | 2011-03-20 19:48:01 +0100

  • Avoids coredump again when exclude_path is NULL with mr_make_devlist_from_pathlist (feedback from mc_at_carreira.com.pt)


r4326@localhost (orig r2746): bruno | 2011-03-20 19:39:47 +0100

  • Remove blkid from busybox to solve #435


r4327@localhost (orig r2747): bruno | 2011-03-20 19:43:22 +0100

  • Adds reboot to fix #435


r4328@localhost (orig r2748): bruno | 2011-03-22 00:58:07 +0100

  • Fix Arch Linux kbd printed in log file now instead of screen.


r4329@localhost (orig r2749): bruno | 2011-03-22 00:59:58 +0100

  • Again increase size for boot env to support better fedora 14 and other latest distros


r4356@localhost (orig r2750): bruno | 2011-03-25 19:30:01 +0100

  • Improve Arch Linux support for mindi tools (mc_at_carreira.com.pt)


r4357@localhost (orig r2751): bruno | 2011-03-25 19:48:33 +0100

  • Accept to work with either wodim or cdreord and genisoimage or mkisofs


r4358@localhost (orig r2752): bruno | 2011-03-25 20:20:49 +0100

  • Documents option -v of mondoarchive


r4359@localhost (orig r2753): bruno | 2011-03-29 01:34:30 +0200

  • Use modprobe instead of insmod to load loop, cd, ... modules (in order to force them at rstore time). Also drop very old aes support for mdk 9.2


r4360@localhost (orig r2754): bruno | 2011-03-29 01:38:49 +0200

  • Arch Linux support for boot message of mindi (mc_at_carreira.com.pt) using /etc/arch-release and pacman.log


r4383@localhost (orig r2755): bruno | 2011-04-07 09:49:38 +0200

  • Adds a UdevadmTrigger function at restore time to deal with the various syntax formats changes ddepending on version (mc_at_carreira.com.pt)


r4384@localhost (orig r2756): bruno | 2011-04-07 10:05:24 +0200

  • Increase again sizes for Debian 6 support (victor.gattegno_at_hp.com)


r4385@localhost (orig r2757): bruno | 2011-04-07 10:13:00 +0200
Conform to the report of size really !


r4386@localhost (orig r2758): bruno | 2011-04-07 11:31:12 +0200

  • Improved message for Arch Linux for rebuilding the initrd (mc_at_carreira.com.pt)


r4390@localhost (orig r2759): bruno | 2011-04-12 01:15:00 +0200

  • Typo in Web site


r4392@localhost (orig r2761): bruno | 2011-04-14 00:23:38 +0200

  • Adds download references for latest versions.


r4394@localhost (orig r2763): bruno | 2011-04-16 00:35:08 +0200

  • Adds support for MT back mandatory for OBDR.


r4395@localhost (orig r2764): bruno | 2011-04-20 12:18:46 +0200
Function resize_drive_proportionately_to_suit_new_drives

  • Integrate some mr_asprintf
  • Use systematically long long data types in all computation to match the struct mountlist_reference size member and have correct precision
  • Apply JB general_at_itpsg.com patch to make the partition resizing work properly according to the drive size (keeping all calculation in KB and converting only for display)


r4396@localhost (orig r2765): bruno | 2011-04-21 11:20:58 +0200

  • Remove very old code creating confusing symlinks pico to nano in init (patch from MC). Fix #477


r4397@localhost (orig r2766): bruno | 2011-04-21 11:57:44 +0200

  • text's are properly centered in open_and_list_dir (Patch from Chucky). Fix #404.


r4398@localhost (orig r2767): bruno | 2011-04-21 12:49:40 +0200

  • Attempt to fix #432 with a better message at a start.


r4399@localhost (orig r2768): bruno | 2011-04-21 13:00:37 +0200

Log content of mondo-restore.cfg


r4400@localhost (orig r2769): bruno | 2011-04-21 13:48:52 +0200

  • Introduce a new bkpinfo member (subdir) to support storing the subdir under which ISO images are stored on an external HDD. Should fix mostly #433.


r4401@localhost (orig r2770): bruno | 2011-04-21 14:14:52 +0200

  • Fix compilation issues due to level of visibility of functions


r4402@localhost (orig r2771): bruno | 2011-04-22 01:49:03 +0200

  • Adds GUI support for compresion type. Fix half of #468.


r4403@localhost (orig r2772): bruno | 2011-04-22 02:00:07 +0200

  • Adds support of ext attr through the GUI. Fix second part of #468


r4404@localhost (orig r2773): bruno | 2011-04-22 02:22:24 +0200

  • Propose more variables in the mindi.conf example
  • More explicit messages when size unsufficient in mindi for kernel + initrd as per #471
  • Better loging of labeling in mondo when in nuke mode


  • Property svn:keywords set to Id
File size: 25.9 KB
RevLine 
[1]1#!/bin/sh
2#
[736]3# $Id: init 2816 2011-04-29 13:42:55Z bruno $
[1]4#
[736]5# init script launched during the restore process
[1]6#------------------------------------------------------------
7
[2462]8export MINDI_CACHE=CCC
9
[1]10
11CaughtSoftReset() {
[1747]12 trap SIGTERM
13 reboot
[1]14}
15
16
17ConfigureLoggingDaemons() {
[1747]18 echo -en "Running klogd..."
19 klogd -c 2 > /dev/null 2> /dev/null
20 echo -en "Done.\nRunning syslogd..."
21 syslogd > /dev/null 2> /dev/null
22 echo "Done."
23 LogIt "klogd and syslogd have been started."
[1]24}
25
26
27
28CopyBootDevEntry() {
[1747]29 local outfile devfile
30 devfile=/dev/boot_device
31 outfile=`cat /BOOTLOADER.DEVICE 2> /dev/null`
32 [ ! "$outfile" ] && return 0
33 echo -en "Copying boot device to $outfile..."
34 if [ -e "$outfile" ] ; then
[2174]35 echo "not needed."
[1410]36 return 0
[1747]37 fi
38 mkdir -p $outfile
39 rmdir $outfile
40 cp -pRdf $devfile $outfile
41 if [ "$?" -ne "0" ] ; then
[1410]42 echo "Failed."
43 return 1
[1747]44 else
[1410]45 echo "OK."
46 return 0
[1747]47 fi
[1]48}
49
50
51
52Die() {
[1747]53 LogIt "Fatal error! $1" 1
54 exit 1
[1]55}
56
57
58
59ExtractDevTarballs() {
[1747]60 cd /
61 for fname in ataraid.tgz ida.tgz i2o.tgz rd.tgz raw.tgz cciss.tgz nst.tgz dm.tgz vc.tgz ; do
62 if [ ! -e "/$fname" ] ; then
63 LogIt "/$fname not found; cannot extract to /." 1
64 else
65 echo -en "\rExtracting /$fname... "
66 tar -zxf /$fname || LogIt "Error occurred while extracting /$fname"
[2487]67 rm -f /$fname
[1747]68 fi
69 done
70 echo -en "\r"
71 LogIt "Extracted additional /dev entries OK. " 1
[1]72}
73
74
75
76LaunchTerminals() {
[2816]77 openvt -c 2 /bin/sh
78 openvt -c 3 /bin/sh
79 openvt -c 4 /bin/sh
80 openvt -c 5 /bin/sh
81 openvt -c 6 /bin/sh
82 openvt -c 7 /bin/sh /sbin/wait-for-petris
83 openvt -c 8 /usr/bin/tail -f $LOGFILE
[2603]84 serial="/foo"
[2484]85 # By default first serial line is configured as tty
86 # Required to have a correct serial console support (MP on ia64 or VSP with iLO2 e.g.)
[2603]87 for i in `cat $CMDLINE` ; do
[2484]88 echo $i | grep -qi serial= && serial=`echo $i | cut -d= -f2`
89 done
[2487]90 # Doing that is only valid when using a real serial line
91 if [ -f $serial ]; then
[2499]92 LogIt "Redirecting serial $serial to /dev/tty" 1
[2487]93 ln -s -f $serial /dev/tty
94 fi
[1]95}
96
97
98LoadKeymap() {
[1747]99 local fname
[2487]100 fname=`cat $MINDI_CACHE/KEYMAP-LIVES-HERE 2> /dev/null`
[1747]101 [ "$fname" = "" ] && return
102 if which loadkeys > /dev/null 2> /dev/null ; then
103 loadkeys $fname
104 else
[2816]105 LogIt "Using default US keyboard map." 1
[1747]106 fi
[1]107}
108
109
110UntarTapeStuff() {
[1747]111 local old_pwd res
112 old_pwd=`pwd`
113 cd $GROOVY
114 [ "$1" != "" ] && tapedev=$1
[2591]115 [ ! "$tapedev" ] && [ -f $MINDI_CACHE/mondorestore.cfg ] && tapedev=`grep media-dev $MINDI_CACHE/mondorestore.cfg 2>/dev/null | tr -s ' ' ' ' | cut -d' ' -f2`
[1962]116 mt -f $tapedev rewind
[1958]117 mt -f $tapedev fsf 2
[1747]118 dd if=$tapedev bs=32k count=1024 | tar -zx
119 res=$?
120 if [ "$res" -eq "0" ] ; then
[1958]121 # Store the dev name in case we changed it interactively
[2462]122 if [ -f "$MINDI_CACHE/mondorestore.cfg" ]; then
123 sed -i "s/^media-dev .*$/media-dev $tapedev/" $MINDI_CACHE/mondorestore.cfg
[1983]124 fi
[1747]125 fi
126 cd $old_pwd
127 return $res
[1]128}
129
130HandleTape() {
[1747]131 local res tapedev
132 tapedev="" ; # will be set by UntarTapeStuff()
[1963]133
[1968]134 # Here we can add the USB storage module, it's working even with OBDR !
[1963]135 modprobe -q usb-storage
[1968]136 # Tape takes some time to appear
137 sleep 10
[1958]138 UntarTapeStuff $tapedev
[1747]139 res=$?
140 while [ "$res" -ne "0" ] ; do
141 LogIt "$tapedev failed to act as extended data disk for booting." 1
142 LogIt "Please specify an alternate tape device," 1
[1885]143 LogIt "or hit <Enter> to boot from another media." 1
[1747]144 echo -en "---> "
145 read tapedev
146 if [ "$tapedev" ] ; then
147 LogIt "User specified $tapedev instead"
148 UntarTapeStuff $tapedev
149 res=$?
150 else
151 LogIt "User opted not to specify an alternate tapedev"
152 res=1
[1]153 break
[1747]154 fi
155 done
[1962]156 # For post-init
157 export TAPEDEV=$tapedev
[1]158
[1747]159 if [ "$res" -ne "0" ] ; then
[1885]160 LogIt "Failed to use tape as extended datadisk. Reverting to another media." 1
161 HandleCDROM
[1410]162 res=$?
[1747]163 else
[1410]164 LogIt "Using tape as extended datadisk. Good." 3
165 echo "Using tape as extd ddisk." > /tmp/TAPEDEV-HAS-DATA-DISKS
166 res=0
[1747]167 CD_MOUNTED_OK=yes
168 fi
169 return $res
[1]170}
171
172
173
[1885]174HandleCDROM() {
[1825]175 # Just in case we have an iLO ensure we will map it correctly
[1830]176 echo "$DENY_MODS" | grep -q "usb-storage "
[1829]177 if [ $? -eq 0 ]; then
178 return
179 fi
[1826]180 echo "Activating a potential USB Storage device"
[1922]181 modprobe -q usb-storage
[1826]182 for i in 1 2 3 4 5 6 7 8 9 10 ; do
183 sleep 1
184 echo -en "."
185 done
[1825]186
[1747]187 find-and-mount-cdrom
188 res=$?
189 if [ "$res" -ne "0" ] ; then
[898]190 LogIt "First call to find-and-mount-cdrom failed." 1
191 LogIt "Sleeping for 3 seconds and trying again." 1
192 sleep 3
193 find-and-mount-cdrom
194 res=$?
[1747]195 fi
196 if [ "$res" -eq "0" ] ; then
[898]197 LogIt "OK, I am running on a CD-ROM. Good." 3
[1747]198 CD_MOUNTED_OK=yes
199 else
[1885]200 LogIt "You probably not have the right drivers" 3
201 LogIt "to support the hardware on which we are running" 3
202 LogIt "Your archives are probably fine but" 3
203 LogIt "your tape streamer and/or CD-ROM drive are unsupported at that point." 3
[898]204 CD_MOUNTED_OK=""
[1747]205 fi
206 return 0
[1]207}
208
209
[2362]210# --- cater for arbitrary locations of devfsd.conf by using the
211# config file path compiled into devfsd
[1]212RunDevfsd() {
[1747]213 loc=`which devfsd 2> /dev/null`
214 if [ "$loc" != "" ] ; then
[1]215 LogIt "Devfs found. Testing kernel support..."
216 if [ ! -e "/dev/.devfsd" ] ; then
[746]217 mount -t devfs devfs /dev 2>> $LOGFILE
[1747]218 if [ "$?" -ne "0" ] ; then
[1]219 LogIt "Error while trying to mount devfs"
220 else
221 LogIt "Devfs mounted OK"
222 fi
223 fi
224 #check if the kernel supports devfs
225 if [ -e "/dev/.devfsd" ] ; then
226 [ -d "/proc/1" ] || mount -n /proc
227 LogIt "Kernel support found. Creating config file and starting devfsd"
[911]228 conffile=`strings $loc | grep -E "devfsd.conf$"`
[1]229 [ "$conffile" ] || conffile="/etc/devfsd.conf"
230 confpath=`echo $conffile | sed "s/\/devfsd\.conf$//"`
231 [ -d "$confpath" ] || mkdir -p $confpath
232 echo -en "REGISTER .* MKOLDCOMPAT\nUNREGISTER .* RMOLDCOMPAT\n" > $conffile
233 devfsd /dev &
234 sleep 5
235 else
236 LogIt "No devfs kernel support."
237 fi
[1747]238 fi
[1]239}
240
[1718]241# Taken from udev management in Mandriva 2008.0. Kudos guys
242make_extra_nodes () {
243 # there are a few things that sysfs does not export for us.
244 # these things are listed in /etc/udev/links.conf
245 grep '^[^#]' /etc/udev-links.conf | \
246 while read type name arg1; do
247 [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue
248 case "$type" in
249 L) ln -s $arg1 /dev/$name ;;
250 D) mkdir -p /dev/$name ;;
[1719]251 M) mknod /dev/$name $arg1 && chmod 600 /dev/$name;;
252 *) echo "udev-links.conf: unparseable line (%s %s %s)\n" "$type" "$name" "$arg1" ;;
[1718]253 esac
254 done
255}
256
[1792]257create_dev_makedev() {
258 if [ -e /sbin/MAKEDEV ]; then
259 ln -sf /sbin/MAKEDEV /dev/MAKEDEV
260 else
261 ln -sf /bin/true /dev/MAKEDEV
262 fi
263}
[1718]264
[1716]265RunUdevd() {
[1718]266 # Inspiration from Mandriva 2008.0 startup script
267 echo "Preparing udev environment..."
268 mv /dev /dev.static
269 mkdir /dev
270 mount -n -o size=5M,mode=0755 -t tmpfs none /dev
271 make_extra_nodes
272 mount -n -t devpts -o mode=620 none /dev/pts
273 mount -n -t tmpfs none /dev/shm
[1789]274 if [ -e /proc/sys/kernel/hotplug ]; then
275 echo > /proc/sys/kernel/hotplug
276 fi
[1734]277 PKLVL=`cut -f1 /proc/sys/kernel/printk`
278 echo 0 > /proc/sys/kernel/printk
[2081]279 # Many possibilities depending on udev versions
[1759]280 if [ -x /sbin/startudev ]; then
281 /sbin/startudev
[2286]282 elif [ -x /sbin/start_udev ]; then
[2081]283 /sbin/start_udev
284 fi
[1759]285 # Depending on udevd version it gives back the hand or not :-(
[2696]286 ps | grep -v grep |grep udevd 2> /dev/null 1> /dev/null
[2444]287 if [ $? -ne 0 ]; then
[2286]288 /sbin/udevd --daemon &
[2444]289 echo "Waiting for udev to start..."
[2286]290 sleep 5
291 fi
[1792]292 mkdir -p /dev/.udev/queue/
[1789]293 if [ -x /sbin/udevtrigger ]; then
294 /sbin/udevtrigger
295 fi
[2444]296 echo "Waiting for udev to discover..."
[1792]297 create_dev_makedev
[2182]298 # Newer version use udevadm for that
[2444]299 if [ -x /sbin/udevsettle ]; then
300 /sbin/udevsettle --timeout=10
301 elif [ -x /sbin/udevadm ]; then
302 /sbin/udevadm trigger
303 /sbin/udevadm settle --timeout=10
[1816]304 fi
[2594]305 # It seems we need to have more static devs on some distro where
306 # udev has some other requirements to be covered later on.
[1824]307 # So in the mean time:
308 for d in `ls /dev.static`; do
309 if [ ! -e /dev/$d ]; then
310 mv /dev.static/$d /dev
311 fi
312 done
[1816]313 echo $PKLVL > /proc/sys/kernel/printk
[1716]314}
[1]315
[1761]316RstHW() {
[1]317
[1761]318 # Restore the HW configuration if available (NOT by default)
319 answer="NO"
[1]320
[2329]321 grep -q nohw $CMDLINE
[1815]322 if [ "$?" -eq 0 ]; then
323 return
324 fi
[2462]325 if [ -x $MINDI_CACHE/mindi-rsthw ]; then
[2329]326 grep -q RESTORE $CMDLINE
[1761]327 if [ "$?" -ne 0 ]; then
328 echo "*********************************************************************"
329 echo "Do you want to restore the HW configuration of the original machine ?"
330 echo "(This may dammage your hardware so be sure to check twice before saying yes)"
331 echo "*********************************************************************"
332 echo "Please confirm by typing YES exactly as written here (NO by default)"
333 echo -n "--> "
334 read answer
335 else
336 answer="YES"
337 fi
[1910]338 if [ "$answer" = "YES" ] ; then
[2462]339 $MINDI_CACHE/mindi-rsthw
[1761]340 fi
341 fi
342}
[1]343
[1761]344
[1]345#RunDevfsd() {
346# loc=`which devfsd 2> /dev/null`
347# if [ "$loc" != "" ] ; then
348# LogIt "Starting devfsd"
349# devfsd /dev &
350# sleep 5
351# fi
352#}
353
354
355
[1787]356StartUSBKbd() {
357# Prepare minimal USB env in case we have USB kbd such as with iLO
358[ -d /proc/bus/usb ] && ! grep -q /proc/bus/usb /proc/mounts && mount -t usbfs none /proc/bus/usb
[1830]359echo "$DENY_MODS" | grep -Eq 'uhcd_hci |usbhid |usbcore '
[1829]360if [ $? -eq 0 ]; then
361 return
362fi
[1922]363modprobe -q uhcd_hci
364modprobe -q usbhid
[1787]365}
[1]366
367
[1787]368
[1]369StartLvms() {
[2603]370 if [ "`grep -i nolvm $CMDLINE`" ]; then
[2481]371 return;
372 fi
[2623]373 if [ -e "$MINDI_CACHE/i-want-my-lvm" ] ; then
[1747]374 LogIt "Scanning LVM's..." 1
[739]375 if which lvm ; then
[1922]376 modprobe -q dm-mod
377 modprobe -q dm_mod
[739]378 lvm vgscan --mknodes
379 else
380 vgscan
381 fi
[2546]382
383 # Exclude devices we may not want
384 rm -f /tmp/restorevgs
[2569]385 for d in $MINDI_EXCLUDE_DEVS ; do
[2587]386 echo "LVM exclusion == $d"
[2623]387 EXCLUDE_VGS=`grep " $d" $MINDI_CACHE/i-want-my-lvm | grep vgcreate | awk '{print $4}'`
[2546]388 vg=`echo $EXCLUDE_VGS | sed "s/ /|/g"`
389 if [ "$vg" != "" ]; then
390 re=" $d|$vg"
391 else
392 re=" $d"
393 fi
394 # Remove VGs from i-want-my-lvm
[2623]395 grep -Ev "$re" $MINDI_CACHE/i-want-my-lvm > $MINDI_CACHE/i-want-my-lvm.new
396 mv $MINDI_CACHE/i-want-my-lvm.new $MINDI_CACHE/i-want-my-lvm
[2546]397 # Prepare script to restore the VG exluded here if needed
398 for v in $EXCLUDE_VGS; do
399 echo "vgcfgrestore $v" >> /tmp/restorevgs
400 # Remove LVs from mountlist
[2623]401 EXCLUDE_LVS=`grep " $v" $MINDI_CACHE/i-want-my-lvm | grep lvcreate | sed "s/^.*-n \([^ ][^ ]*\) .*$/$1/"`
[2546]402 for l in $EXCLUDE_LVS; do
403 # FIXME: Should search for all possible device names here
[2587]404 grep -Ev "/dev/$v/$l" $MINDI_CACHE/mountlist.txt > $MINDI_CACHE/mountlist.txt.new
405 grep -Ev "/dev/mapper/${v}-$l" $MINDI_CACHE/mountlist.txt.new > $MINDI_CACHE/mountlist.txt
[2546]406 done
407 done
408 done
409
[2623]410 grep -E "^#.*vgchange" $MINDI_CACHE/i-want-my-lvm | sed "s/^#[ ]*//" > /tmp/start-lvm
[1747]411 chmod +x /tmp/start-lvm
412 echo -en "Starting LVM's..."
413 /tmp/start-lvm &
414 for i in 1 2 3 4 5 ; do
[1410]415 echo -en "."
416 sleep 1
[1747]417 done
[2487]418 rm -f /tmp/start-lvm
[1747]419 echo "Done."
420 fi
[1]421# If necessary, cannibalize 'analyze-my-lvm'; copy some of its code here,
422# pipe vgscan's output, strip it, run 'vgchange' on its output, etc.etc.
[1747]423 LogIt "LVM's have been started."
[1]424}
425
[2177]426StartPowerPath() {
[1]427
[2177]428 # Taken from the init script of EMC PowerPath on RHEL
429 if [ -f /etc/emcp_devicesDB.dat ]; then
430 if [ -f /etc/emcp_devicesDB.idx ]; then
431 /etc/opt/emcpower/emcpmgr map -p > /dev/null 2>&1
432 fi
433 fi
434
435 /sbin/powermt config > /dev/null 2>&1
436 # Wait for udev to finish creating emcpower devices
437 #
438 pdfound=1
439 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
440 pdfound=1
441 for pd in `/bin/ls -d /sys/block/emcpower* 2> /dev/null`; do
442 bpd=`basename $pd`
443 if [ ! -e /dev/$bpd ]; then
444 pdfound=0
445 sleep 2
446 break;
447 fi
448 done
449 if [ "$pdfound" -eq 1 ]; then
450 break
451 fi
452 done
453 if [ "$pdfound" -eq 0 ]; then
454 echo "Unable to start PowerPath"
455 fi
456
457 /sbin/powermt load > /dev/null 2>&1
458 /etc/opt/emcpower/emcpmgr map > /dev/null 2>&1
459 /etc/opt/emcpower/powercf -C > /dev/null 2>&1
460 if [ ! -e /etc/powermt.custom ]; then
461 /sbin/powermt save > /dev/null 2>&1
462 fi
463 /sbin/powermt register > /dev/null 2>&1
464 /sbin/powermig transition -startup -noprompt > /dev/null 2>&1
465}
466
[2072]467StartMpath() {
[2329]468 if [ "`grep -i nompath $CMDLINE`" ]; then
[2072]469 return;
470 fi
[2462]471 if [ "`grep mpath $MINDI_CACHE/mountlist.txt`" ]; then
[2354]472 if [ -x /sbin/multipath ]; then
473 echo "Starting Mpath..."
474 mkdir -p /var/lib/multipath
475 cat > /etc/multipath.conf << EOF
[2072]476defaults {
477 user_friendly_names yes
478}
479EOF
[2354]480 /sbin/multipath -v 0
481 if [ -x /sbin/kpartx ]; then
482 /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p"
483 fi
[2072]484 fi
485 fi
486}
487
[1]488StartRaids() {
[1747]489 local raid_devices i
[1273]490
[2603]491 if [ "`grep -i noraid $CMDLINE`" ]; then
[2354]492 return;
493 fi
494
[2462]495 raid_devices=`grep /dev/md $MINDI_CACHE/mountlist.txt | cut -d' ' -f1`
[623]496 if which raidstart > /dev/null 2> /dev/null ; then
[1747]497 for i in $raid_devices ; do
498 if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
499 LogIt "$i is started already; no need to run 'raidstart $i'" 1
500 else
[623]501 LogIt "Running 'raidstart $i'" 1
502 raidstart $i
[1747]503 fi
504 done
[623]505 elif which mdrun > /dev/null 2> /dev/null ; then
[2603]506 if [ "`grep -i nomd $CMDLINE`" ]; then
[2354]507 return;
508 fi
[623]509 LogIt "Running 'mdrun'" 1
510 mdrun
[1273]511 elif which mdadm > /dev/null 2> /dev/null ; then
[2603]512 if [ "`grep -i nomd $CMDLINE`" ]; then
[2354]513 return;
514 fi
[1273]515 LogIt "Running 'mdadm'" 1
516 for i in $raid_devices ; do
[1747]517 if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
518 LogIt "$i is started already; no need to run 'mdadm $i'" 1
519 else
[1610]520 if [ -f /etc/mdadm.conf ] ; then
521 LogIt "Running 'mdadm $i' with user supplied /etc/mdadm.conf" 1
522 mdadm -A $i -c /etc/mdadm.conf
523 elif [ -f /etc/mdadm/mdadm.conf ] ; then
524 LogIt "Running 'mdadm $i' with user supplied /etc/mdadm/mdadm.conf" 1
525 mdadm -A $i -c /etc/mdadm/mdadm.conf
526 else
527 LogIt "Running 'mdadm $i'" 1
528 mdadm -Ac partitions -m dev $i
529 fi
[1747]530 fi
531 done
[2075]532 elif which dmraid > /dev/null 2> /dev/null ; then
[2329]533 if [ "`grep -i nodmraid $CMDLINE`" ]; then
[2072]534 return;
535 fi
536 for x in $(/sbin/dmraid -ay -i -p -t 2>/dev/null | grep -E -iv "^no " |awk -F ':' '{ print $1 }') ; do
537 echo "Please send the result of /sbin/dmraid -ay -i -p -t to the devteam !!!"
538 return
539 #dmname=$(resolve_dm_name $x)
540 #[ -z "$dmname" ] && continue
541 #/sbin/dmraid -ay -i -p "$dmname" >/dev/null 2>&1
542 #/sbin/kpartx -a -p p "/dev/mapper/$dmname"
543 done
[623]544 else
545 LogIt "Warning: Neither 'raidstart' nor 'mdrun''found. RAID devices may not have started." 1
546 fi
547
[1]548}
549
550
551TryAgainToFindCD() {
[1747]552 local res
553 mount | grep /mnt/cdrom && return 0
[2591]554 [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep "backup_media_type" $MINDI_CACHE/mondorestore.cfg 2> /dev/null | grep "cdstream"`" ] && return
[1747]555 LogIt "Trying to mount CD-ROM a 2nd time..."
556 find-and-mount-cdrom --second-try
557 res=$?
558 if [ "$res" -eq "0" ] ; then
559 CD_MOUNTED_OK=yes
560 LogIt "CD-ROM drive mounted successfully." 1
561 else
562 LogIt "I still cannot find or mount the CD-ROM drive, by the way."
563 fi
[1]564}
565
566
567
568UseTmpfs()
569{
[1747]570 local mount_cmd
571 echo -en "Mounting /tmp/tmpfs..."
572 mkdir -p /tmp/tmpfs
[1]573# For technical reasons, some sets are as large as 16MB.
574# I am allowing 32MB because selective restore occupies a lot of space.
[2212]575 for size in 128m 64m 48m 40m 32m ; do
[1747]576 mount_cmd="mount /dev/shm -t tmpfs -o size=$size" ; # was 34m until 04/2003
577 LogIt "Trying '$mount_cmd'"
578 $mount_cmd /tmp/tmpfs 2>> $LOGFILE
579 res=$?
580 [ "$res" -eq "0" ] && break
581 done
582 if [ "$res" -ne "0" ] ; then
583 LogIt "Failed. I could not run '$mount_cmd /tmp/tmpfs'. Your kernel is BROKEN or you do not have enough RAM." 1
584 umount /tmp/tmpfs > /dev/null 2> /dev/null
585 rmdir /tmp/tmpfs
586 ln -sf /mnt/RESTORING/tmp /tmp/tmpfs; # used by mondo-restore
587 LogIt "Failed to mount /tmp/tmpfs; using ugly softlink instead"
588 else
589 LogIt "Great. Pivot succeeded w/ size=$size" 1
590 echo -en "Pivoting /tmp..."
591 umount /tmp/tmpfs
592 mkdir -p /tmp.old
[1752]593 mv /tmp/* /tmp.old/
[1747]594 rm -f /tmp/*
595 $mount_cmd /tmp
[1752]596 mv /tmp.old/* /tmp/
[1747]597 rm -rf /tmp.old
598 mkdir -p /tmp/tmpfs
[2487]599 echo "Done."
600 LogIt "Successfully mounted dynamic /tmp ramdisk"
[1747]601 fi
[1]602}
603
604
605WelcomeMessage()
606{
[1747]607 echo "********************************************************************"
608 echo "MINDI-LINUX by Mondo Dev Team - web site: http://www.mondorescue.org"
[1]609which petris > /dev/null 2> /dev/null && echo "Petris was written by Peter Seidler <p.seidler@mail1.stofanet.dk>."
[1747]610 echo "Executables and source code are covered by the GNU GPL. No warranty."
611 echo "running on $ARCH"
612 echo "********************************************************************"
[1]613}
614
615
616EnableCcissIfAppropriate() {
[1747]617 local i fname
618 for i in 0 1 2 3 ; do
[1410]619 fname="/proc/driver/cciss/cciss$i"
620 if [ -e "$fname" ] ; then
621 LogIt "Engaging $fname"
622 echo "engage scsi" > $fname
623 LogIt "...result=$?"
624 fi
[1747]625 done
[1]626}
627
[1802]628ModprobeAllModules() {
[1]629
[2603]630 echo "Preparing to install modules..."
631 # Create a cache first time
632 if [ ! -f /tmp/lismod.txt ]; then
633 find /lib/modules -name '*\.ko*' -o -name '*\.o*' > /tmp/lismod.txt
634 fi
635 lismod=`cat /tmp/lismod.txt`
[2569]636 # loading forced modules first
637 for m in $lismod; do
[1927]638 k=`basename $m | sed 's/\.ko.*$//'`
639 j=`basename $k | sed 's/\.o.*$//'`
[2569]640 echo "$FORCE_MODS" | grep -q "$j "
641 if [ $? -eq 0 ]; then
642 echo "Forcing first $j..."
643 modprobe -q $j
644 fi
645 done
646 for m in $lismod; do
647 k=`basename $m | sed 's/\.ko.*$//'`
648 j=`basename $k | sed 's/\.o.*$//'`
[2603]649 lsmod | grep -qE '^$j$'
650 if [ $? -eq 0 ];then
651 # Already loaded
652 continue
653 fi
[1830]654 echo "$DENY_MODS" | grep -q "$j "
[1829]655 if [ $? -eq 0 ]; then
[1830]656 echo "Denying $j..."
[1829]657 continue
658 fi
[2569]659 echo "$FORCE_MODS" | grep -q "$j "
660 if [ $? -eq 0 ]; then
661 continue
662 fi
[1829]663 echo "Probing $j..."
[1815]664 modprobe -q $j
[1802]665 done
666}
667
[2816]668UdevadmTrigger() {
669if [ -x /sbin/udevadm ]; then
670 if [ `/sbin/udevadm --version` -ge 146 ]; then
671 # After version 146 option --retry-failed doesn't exist anymore
672 /sbin/udevadm triger --type=failed
673 else
674 /sbin/udevadm trigger --retry-failed
675 fi
676fi
677}
678
[287]679ExtractDataDisksAndLoadModules() {
680 echo "Installing additional tools ..."
681 install-additional-tools
[1800]682 # Keep the kernel silent again
683 PKLVL=`cut -f1 /proc/sys/kernel/printk`
[1802]684 echo 0 > /proc/sys/kernel/printk
[1922]685 ModprobeAllModules
[1800]686 echo $PKLVL > /proc/sys/kernel/printk
[2081]687
688 # Retry failed udev events now that local filesystems are mounted read-write
689 # (useful for rules creating network ifcfg files)
[2596]690 if [ "$USE_UDEV" = "yes" ]; then
[2816]691 UdevadmTrigger
[2081]692 fi
[287]693}
[1]694
695# ------------------------ main -----------------------
696
[1698]697MINDI_VER=PBVER
698MINDI_REV=PBREV
[1]699trap CaughtSoftReset SIGTERM
[1643]700LOGFILE=/var/log/mondorestore.log
[1236]701PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/mondo:/usr/games
[2487]702GROOVY=$MINDI_CACHE/groovy-stuff
[1]703USER=root
[2163]704ARCH=`uname -m`
[1]705
[2163]706export PATH GROOVY USER LOGFILE ARCH
707
[1716]708echo "Welcome to init (from mindi ${MINDI_VER}-r${MINDI_REV})"
[898]709
[1]710mount -o remount rw /
711[ ! "$GROOVY" ] && Die "I'm not groovy!"
[2487]712for i in /mnt/cdrom /mnt/isodir /var/local/petris /tmp/isodir; do
[1747]713 mkdir -p $i
[1]714done
715#/bin/update
716mount /proc/ /proc -v -t proc
[2607]717
718# Now we can look at command line
719if [ -e "/proc/cmdline" ]; then
720 # Linux
721 export CMDLINE="/proc/cmdline"
722elif [ -e "/tmp/cmdline" ]; then
723 # BSD ?
724 export CMDLINE="/tmp/cmdline"
725else
726 export CMDLINE="/dev/null"
727fi
728
[1]729mkdir /sys 2> /dev/null
730mount /sys/ /sys -v -t sysfs 2>> $LOGFILE
[1824]731# For ESX 3
732[ -d /proc/vmware ] && ! grep -q /vmfs /proc/mounts && mount -t vmfs /vmfs /vmfs
[1]733rm -f /foozero
734
[2329]735if [ "`grep -i denymods $CMDLINE`" ]; then
736 export DENY_MODS="`cat $CMDLINE | sed 's~.*denymods=\"\(.*\)\".*~\1~'` mondonone"
[1830]737else
738 export DENY_MODS=" "
[1829]739fi
[2591]740if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
[1958]741 # Do not try to load usb storage when dealing with OBDR it makes the modprobe hang :-(
[1960]742 export DENY_MODS="usb-storage $DENY_MODS"
[1958]743fi
[2329]744if [ "`grep -i forcemods $CMDLINE`" ]; then
745 export FORCE_MODS="`cat $CMDLINE | sed 's~.*forcemods=\"\(.*\)\".*~\1~'` mondonone"
[1830]746else
747 export FORCE_MODS=" "
[1829]748fi
[2603]749if [ "`grep -i excludedevs $CMDLINE`" ]; then
750 export MINDI_EXCLUDE_DEVS="`cat $CMDLINE | sed 's~.*excludedevs=\"\(.*\)\".*~\1~'` mondonone"
[2587]751 for d in $MINDI_EXCLUDE_DEVS ; do
752 echo "Mountlist exclusion == $d"
753 perl -i -ne 'print $_ unless m~$d~' $MINDI_CACHE/mountlist.txt
754 done
[2546]755else
[2569]756 export MINDI_EXCLUDE_DEVS=" "
[2546]757fi
[1829]758
[1826]759echo "Activating a potential USB keyboard/mouse"
[1787]760StartUSBKbd
761
[1720]762if [ -f /proc/sys/kernel/exec-shield ]; then
763 echo 0 > /proc/sys/kernel/exec-shield 2>> /dev/null
764fi
[1]765
[1729]766if [ -f /proc/modules ]; then
767 echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
768fi
769
[2596]770USE_UDEV=""
771if [ -f $MINDI_CACHE/mondorestore.cfg ]; then
772 USE_UDEV=`grep "use_udev" $MINDI_CACHE/mondorestore.cfg | cut -d' ' -f2`
773fi
774if [ "$USE_UDEV" = "yes" ]; then
[1747]775 RunUdevd
[1716]776fi
[1798]777ExtractDevTarballs
[1]778LaunchTerminals
[1718]779
[1789]780# Keeping kernel silent for module insertion
781PKLVL=`cut -f1 /proc/sys/kernel/printk`
782echo 0 > /proc/sys/kernel/printk
[1922]783ModprobeAllModules
[1789]784echo $PKLVL > /proc/sys/kernel/printk
[1718]785
[1]786EnableCcissIfAppropriate
787#-------------------------------
788#WHOLIVESINAPINEAPPLEUNDERTHESEA#;# --- don't touch this :)
789#-------------------------------
790UseTmpfs
[2462]791if [ ! -e "$MINDI_CACHE/mondorestore.cfg" ] ; then
792 LogIt "Warning - $MINDI_CACHE/mondorestore.cfg not found"
[1]793fi
[2329]794if [ "`grep -i pxe $CMDLINE`" ] || [ "`grep -i net $CMDLINE`" ]; then
[2382]795 # We need to get here exported variables from start-netfs
796 . /sbin/start-netfs
[2182]797fi
[1]798
[2596]799if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2>/dev/null`" ]; then
[1747]800 HandleTape
[287]801 ExtractDataDisksAndLoadModules
[2329]802elif [ "`grep -i pxe $CMDLINE`" ]; then
[287]803 # Simulate a local CD
[2487]804 echo "/mnt/cdrom" > $MINDI_CACHE/CDROM-LIVES-HERE
[1747]805 CD_MOUNTED_OK=yes
[287]806 ExtractDataDisksAndLoadModules
[2182]807 # Fake the conf file to force it to NFS mode, even if we made originally a CD (mandatory for mondorestore to work correctly)
[2591]808 [ -f $MINDI_CACHE/mondorestore.cfg ] && sed -i "s/backup-media-type.*/backup-media-type netfs/" $MINDI_CACHE/mondorestore.cfg
[2462]809elif [ "`grep -i usb= $CMDLINE`" ] || [ "`grep -i usb $MINDI_CACHE/mondorestore.cfg 2>/dev/null | grep media-type`" ]; then
[1747]810 . /sbin/start-usb
[1698]811
812 # Simulate a local CD
[2487]813 echo "/mnt/cdrom" > $MINDI_CACHE/CDROM-LIVES-HERE
[1747]814 CD_MOUNTED_OK=yes
[1698]815 ExtractDataDisksAndLoadModules
[1]816else
[2592]817 if [ -f "$MINDI_CACHE/mondorestore.cfg" ] ; then
818 HandleCDROM
819 fi
[287]820 ExtractDataDisksAndLoadModules
[2382]821 # We need to get here exported variables from start-netfs
822 . /sbin/start-netfs
[1]823fi
824res=$?
825ConfigureLoggingDaemons
[1813]826LoadKeymap
827WelcomeMessage
828RstHW
[2587]829[ -e "$MINDI_CACHE/mountlist.txt" ] && cp -f $MINDI_CACHE/mountlist.txt $MINDI_CACHE/mountlist.original
[1]830StartRaids
[2072]831StartMpath
[1]832StartLvms
833CopyBootDevEntry
834mkdir -p /tmp/tmpfs
835sleep 2
[2462]836if [ -e "/dev/md0" ] && [ ! -e "/dev/md/0" ] && [ "`grep /dev/md/ $MINDI_CACHE/mountlist.txt`" != "" ] ; then
[1747]837 LogIt "Creating /dev/md/* softlinks just in case." 1
838 mkdir -p /dev/md
839 cp -af /dev/md0 /dev/md/0 2> /dev/null
840 cp -af /dev/md1 /dev/md/1 2> /dev/null
841 cp -af /dev/md2 /dev/md/2 2> /dev/null
[1]842fi
843
[2329]844if ! [ "`grep -i "pxe" $CMDLINE`" ] ; then
[1]845 res="`cat /mnt/cdrom/archives/THIS-CD-NUMBER 2> /dev/null`"
846 [ "$res" != "1" ] && [ "$res" != "" ] && Die "This is CD #$res in the series. Please insert CD #1."
847 [ -e "/cdrom.lnk" ] && mv -f /cdrom.lnk /dev/cdrom && mount /dev/cdrom /mnt/cdrom && CD_MOUNTED_OK=yes
[2592]848 [ "$CD_MOUNTED_OK" != "yes" ] && [ -f $MINDI_CACHE/mondorestore.cfg ] && TryAgainToFindCD
[1]849fi
850hack-cfg-if-necessary || LogIt "Cannot find hack-cfg-if-necessary"
851
[1403]852# Log some useful info
[1837]853LogIt "init (from mindi v$MINDI_VER-r${MINDI_REV})"
[2329]854LogIt "$CMDLINE is:"
[2349]855LogIt "----------"
[2329]856cat $CMDLINE >> $LOGFILE
[2349]857LogIt "----------"
[1413]858LogIt "df result:"
859LogIt "----------"
[1403]860df >> $LOGFILE
[1413]861LogIt "-------------"
862LogIt "mount result:"
863LogIt "-------------"
[1403]864mount >> $LOGFILE
[1413]865LogIt "-------------"
866LogIt "lsmod result:"
867LogIt "-------------"
[1403]868lsmod >> $LOGFILE
[1413]869LogIt "-------------"
[1476]870LogIt "dmesg result:"
871LogIt "-------------"
872dmesg >> $LOGFILE
[2015]873LogIt "-------------"
874LogIt "/proc/swaps:" >> $LOGFILE
875LogIt "-------------"
876cat /proc/swaps >> $LOGFILE
877LogIt "-------------"
878LogIt "/proc/filesystems:" >> $LOGFILE
879LogIt "-------------"
880cat /proc/filesystems >> $LOGFILE
881LogIt "-------------"
882LogIt "/proc/partitions:" >> $LOGFILE
883LogIt "-------------"
884cat /proc/partitions >> $LOGFILE
[2349]885LogIt "-------------"
886LogIt "fdisk result:" >> $LOGFILE
887LogIt "-------------"
888fdisk -l >> $LOGFILE
[2816]889LogIt "-------------"
890LogIt "/tmp/mondo-restore.cfg result:" >> $LOGFILE
891LogIt "-------------"
892cat /tmp/mondo-restore.cfg >> $LOGFILE
[1403]893
[1983]894ide-opt
[1]895
[2081]896# Not sure it's still needed, but shouldn't hurt
[2596]897if [ "$USE_UDEV" = "yes" ]; then
[2081]898 if [ -x /sbin/udevadm ]; then
[2816]899 UdevadmTrigger
[2081]900 fi
[2596]901
[2081]902fi
[2607]903if [ -f $MINDI_CACHE/mondorestore.cfg ]; then
904 grep -q "backup-media-type" $MINDI_CACHE/mondorestore.cfg
905 if [ $? -eq 0 ]; then
906 LogIt "backup-media-type is specified in config file - great."
907 LogIt "Calling post-init"
908 # start-netfs moved it under /tmp as the NFS share is already unmounted
909 if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
910 pre=`echo $pre | sed 's|^/tmp/isodir|/tmp|'`
911 fi
912 if [ -x $pre ]; then
913 echo "Executing preliminary script $pre"
914 LogIt "Executing preliminary script $pre"
915 $pre
916 fi
917 post-init
918 else
919 LogIt "backup-media-type is not specified in config file."
920 LogIt "I think this media has no archives on it."
[2255]921 fi
[1]922else
[2607]923 LogIt "$MINDI_CACHE/mondorestore.cfg not found."
[1885]924 LogIt "I think this media has no archives on it."
[1]925fi
[2329]926if [ "`grep -i "post=" $CMDLINE`" ] ; then
927 for i in `cat $CMDLINE` ; do
[2255]928 echo $i | grep -qi post= && post=`echo $i | cut -d= -f2`
[2249]929 done
[2382]930 # start-netfs moved it under /tmp as the NFS share is already unmounted
[2255]931 if [ "`echo $post | grep -E '^/tmp/isodir'`" ]; then
932 post=`echo $post | sed 's|^/tmp/isodir|/tmp|'`
[2253]933 fi
[2587]934 if [ -r $post ]; then
[2255]935 echo "Executing final script $post"
936 LogIt "Executing final script $post"
937 if [ "`echo $post | grep -E '^/mnt/RESTORING'`" ]; then
[2253]938 mount-me
939 fi
[2587]940 chmod 755 $post
[2255]941 $post
942 if [ "`echo $post | grep -E '^/mnt/RESTORING'`" ]; then
[2253]943 unmount-me
944 fi
[2249]945 fi
946fi
[2329]947if grep "RESTORE" $CMDLINE > /dev/null 2> /dev/null ; then
[1612]948 echo "Rebooting in 10 seconds automatically as per reboot order"
949 echo -en "Press ^C to interrupt if you have to ..."
950 for i in 1 2 3 4 5 6 7 8 9 10 ; do
951 sleep 1
952 echo -en "."
953 done
954 echo "Boom."
955 sleep 1
956else
957 echo -en "Type 'exit' to reboot the PC\n"
958 umount /mnt/cdrom 2> /dev/null
959 mount / -o rw,remount > /dev/null 2> /dev/null
960 LogIt "Launching Shell"
961 sh
962fi
[1]963CaughtSoftReset
964# reboot
Note: See TracBrowser for help on using the repository browser.