source: MondoRescue/branches/2.0.8/mindi/rootfs/sbin/init@ 623

Last change on this file since 623 was 623, checked in by andree, 18 years ago

Make the init script mdadm-aware, i.e. make it look for mdrun if
raidstart is not found.

  • Property svn:keywords set to Id
File size: 20.6 KB
Line 
1#!/bin/sh
2#
3# 04/20/2005
4# - fix for 'skip the tape datadisks' bug (Joseph Smith)
5#
6# 10/13/2004
7# - echo 0 > /proc/sys/kernel/exec-shield to disable exec-shield
8#
9# 07/25
10# - removed sbminst
11#
12# 06/25
13# - klogd -c 2 (was -c 5)
14#
15# 06/21
16# - experimented w/ calling ctrlaltdel to setup soft reset
17# - don't softlink /var/log
18#
19# 06/16
20# - insmod dm_mod as well as dm-mod
21#
22# 05/24
23# - added Andree's vc.tgz
24#
25# 05/14
26# - open => openvt (part of busybox)
27# - nash removed. dm.tgz added
28#
29# 04/21
30# - compare original lsmod output w/ new lsmod output
31#
32# 04/13
33# - mount /sys if appropriate
34#
35# 04/03
36# - use 'dd if=$tapedev bs=32k count=1024' instead of 'tar -zxf $tapedev'
37# to extract aux datadisk files from tape
38#
39# 25/03
40# - wait 7s, not 2s, while installing modules
41#
42# 18/01/2004
43# - logging mondo-restore.cfg, not mondo-restore.log --- FIXED
44#
45# 11/23/2003
46# - if find-and-mount-cdrom fails once, try again
47# - open scrolling log of /tmp/mondo-restore.log later than previously
48#
49# 11/18
50# - disabled clear()'s
51# - reboot at end
52#
53# 11/15
54# - softlink /var/log to /tmp/tmpfs/var/log
55# - klogd -c 5 now (was -c 1)
56#
57# 11/10
58# - don't call mondorestore if backup-media-type is not specified in
59# config file /tmp/mondo-restore.cfg
60#
61# 10/21
62# - softlink nano to pico if nano found
63#
64# 10/16
65# - create /dev/md/* softlinks if necessary
66#
67# 10/12
68# - start devfs if /tmp/USE-DEVFS found
69# - create simple /etc/devfsd.conf file
70#
71# 10/09
72# - try various mount commands to get tmpfs online (use initiative)
73#
74# 09/24
75# - also try /dev/st0, /dev/osst0, /dev/ht0 if [tapedev] fails
76# - modify media-dev in mondo-restore.cfg if we succeed :)
77#
78# 09/15
79# - create /tmp/null and /tmp/stdout and /tmp/stderr
80# as copies of the real thing, just in case partimagehack
81# still uses them
82#
83# 08/01
84# - tmpfs ramdisk is now 48m
85#
86# 07/14
87# - added mkdirs at start
88#
89# 06/04
90# - remount root as rw just in case
91#
92# 05/04
93# - replaced /mnt/groovy-stuff with $GROOVY
94#
95# 04/30
96# - if your CD was created by Mondoarchive when it backed up
97# to ISO(s) then re-jig tmp/mondo-restore.cfg accordingly;
98# this is nec. if you backup to a hard disk directory but
99# then burn the ISOs to physical CDs
100#
101# 04/26
102# - offer user the chance to specify another tape device, if
103# the one they specified at backup-time refuses to act as
104# aux data disk at boot-time
105#
106# 04/21
107# - start scsi if cciss
108# - use ataraid.tgz too
109#
110# 05/03
111# - mount / -o rw,remount at end, just in case
112# RH9 futzes with the mountpoint
113#
114# 04/04
115# - increased tmpfs ramdisk size from 34m to 38m
116#
117# 01/01 - 01/31/2003
118# - fixed issue with LVM and SW Raid devices (Brian Borgeson)
119# - friendlier 'upgrade your ram' msg
120# - better fallback msg
121# - if /tmp/2880.siz exists then assume boot CD
122#
123# 11/01 - 12/31/2002
124# - updated intro msg
125# - if /dev/boot_device and /BOOTLOADER.DEVICE exist then
126# copy device /dev/boot_device to pathname contained
127# in /BOOTLOADER.DEVICE text file
128#
129# 04/01 - 08/31/2002
130# - handle new 'backup_media_type' entry in mondo-restore.cfg
131# - added 'sleep 2' at start of WelcomeMessage
132# - disabled a silly 'abort' line at end
133# - better handling of devfs (DuckX) --- new RunDevfsd()
134# - assume start-nfs is in /sbin
135# - extract rd.tgz, raw.tgz, ida.tgz, cciss.tgz to /; they include
136# /dev entries which would otherwise fill up the ramdisk at bkp-time
137#
138# 01/01 - 03/31/2002
139# - Carl Wilhelm Soderstrom disabled exec sh; replaced with exit 1
140# - if you are an idiot & your computer has very little RAM,
141# this script will no longer abort; it will merely warn you
142# - run chmod 755 `which start-nfs` before running start-nfs
143# - use a ramdisk for /tmp (after copying old /tmp stuff into it)
144# - fixed segfaults ('open') by replacing 'sh' call with '/bin/sh' call
145# - changed LaunchTerminals() to try to work with newly-compiled 'open'
146# - don't write 'start-nfs error' if start-nfs doesn't exist; just go on
147# - added tmpfs and some space-checking
148# - cleaned up script
149# - added stuff to start NFS services if necessary
150# - reordered some of the main() stuff, for elegance's sake
151# - added Petris and 'tail -f /tmp/mondo-restore.log' to LaunchTerminals()
152# - changed /usr/share/ to /usr/local/
153#
154# 2001
155# - fix some typos
156# - added lots of cool stuff to make Mindi _nearly_ boot from tape
157# - restructured the welcome msg echoed to screen
158# - broke up spaghetti code; made lots of subroutines
159#
160#------------------------------------------------------------
161
162
163CaughtSoftReset() {
164 trap SIGTERM
165 reboot
166}
167
168
169ConfigureLoggingDaemons() {
170 echo -en "Running klogd..."
171 klogd -c 2 > /dev/null 2> /dev/null
172 echo -en "Done.\nRunning syslogd..."
173 syslogd > /dev/null 2> /dev/null
174 echo "Done."
175 LogIt "klogd and syslogd have been started."
176}
177
178
179
180CopyBootDevEntry() {
181 local outfile devfile
182 devfile=/dev/boot_device
183 outfile=`cat /BOOTLOADER.DEVICE 2> /dev/null`
184 [ ! "$outfile" ] && return 0
185 echo -en "Copying boot device to $outfile..."
186 if [ -e "$outfile" ] ; then
187 echo "OK."
188 return 0
189 fi
190 mkdir -p $outfile
191 rmdir $outfile
192 cp -pRdf $devfile $outfile
193 if [ "$?" -ne "0" ] ; then
194 echo "Failed."
195 return 1
196 else
197 echo "OK."
198 return 0
199 fi
200}
201
202
203
204Die() {
205 LogIt "Fatal error! $1" 1
206 exit 1
207}
208
209
210
211ExtractDevTarballs() {
212 cd /
213 for fname in ataraid.tgz ida.tgz rd.tgz raw.tgz cciss.tgz nst.tgz dm.tgz vc.tgz ; do
214 if [ ! -e "/$fname" ] ; then
215 LogIt "/$fname not found; cannot extract to /." 1
216 else
217 echo -en "\rExtracting /$fname... "
218 tar -zxf /$fname || LogIt "Error occurred while extracting /$fname"
219 fi
220 done
221 echo -en "\r"
222 LogIt "Extracted additional /dev entries OK. " 1
223}
224
225
226
227LaunchTerminals() {
228 openvt 2 /bin/sh
229 openvt 3 /bin/sh
230 openvt 4 /bin/sh
231 openvt 5 /bin/sh
232 openvt 6 /bin/sh
233 openvt 7 /bin/sh /sbin/wait-for-petris
234# openvt 8 /usr/bin/tail -f /tmp/mondo-restore.log
235}
236
237
238LoadKeymap() {
239 local fname
240 fname=`cat /tmp/KEYMAP-LIVES-HERE 2> /dev/null`
241 [ "$fname" = "" ] && return
242 if which loadkeys > /dev/null 2> /dev/null ; then
243 loadkeys $fname
244# loadkmap != loadkeys
245# elif which loadkmap > /dev/null 2> /dev/null ; then
246# loadkmap < $fname
247 else
248 LogIt "Using default keyboard map." 1
249 fi
250}
251
252
253UntarTapeStuff() {
254 local old_pwd res
255 old_pwd=`pwd`
256 cd $GROOVY
257 [ "$1" != "" ] && tapedev=$1
258 [ ! "$tapedev" ] && tapedev=`grep media-dev /tmp/mondo-restore.cfg | tr -s ' ' ' ' | cut -d' ' -f2`
259# tar -zxf $tapedev
260 dd if=$tapedev bs=32k count=1024 | tar -zx
261 res=$?
262 if [ "$res" -eq "0" ] ; then
263 grep -v media-dev /tmp/mondo-restore.cfg > /tmp/mr.cfg
264 echo "media-dev $tapedev" >> /tmp/mr.cfg
265 cp -f /tmp/mr.cfg /tmp/mondo-restore.cfg
266 fi
267 cd $old_pwd
268 return $res
269}
270
271HandleTape() {
272 local res tapedev
273 tapedev="" ; # will be set by UntarTapeStuff()
274 cd $GROOVY
275 UntarTapeStuff $tapedev || UntarTapeStuff /dev/st0 || UntarTapeStuff /dev/osst0 || UntarTapeStuff /dev/ht0
276 res=$?
277 while [ "$res" -ne "0" ] ; do
278 LogIt "$tapedev failed to act as extended data disk for booting." 1
279 LogIt "Please specify an alternate tape device," 1
280 LogIt "or hit <Enter> to boot from CD/floppies." 1
281 echo -en "---> "
282 read tapedev
283 if [ "$tapedev" ] ; then
284 LogIt "User specified $tapedev instead"
285 UntarTapeStuff $tapedev
286 res=$?
287 else
288 LogIt "User opted not to specify an alternate tapedev"
289 res=1
290 break
291 fi
292 done
293
294 if [ "$res" -ne "0" ] ; then
295 cd /
296 LogIt "Failed to use tape as extended datadisk. Reverting to floppies." 1
297 HandleCDROMorFloppies
298 res=$?
299 else
300# clear
301 LogIt "Using tape as extended datadisk. Good." 3
302 echo "Using tape as extd ddisk." > /tmp/TAPEDEV-HAS-DATA-DISKS
303 res=0
304 CD_MOUNTED_OK=yes
305 fi
306 return $res
307}
308
309
310
311HandleCDROMorFloppies() {
312 find-and-mount-cdrom
313 res=$?
314 if [ "$res" -ne "0" ] ; then
315 LogIt "First call to find-and-mount-cdrom failed." 1
316 LogIt "Sleeping for 3 seconds and trying again." 1
317 sleep 3
318 find-and-mount-cdrom
319 res=$?
320 fi
321 if [ "$res" -eq "0" ] ; then
322# clear
323 LogIt "OK, I am running on a CD-ROM. Good." 3
324 CD_MOUNTED_OK=yes
325 elif [ "$res" -eq "1" ] ; then
326# clear
327 LogIt "OK, I am running on floppies. Good." 3
328 CD_MOUNTED_OK=""
329 else
330 LogIt "OK, I am falling back to floppy mode." 3
331 LogIt "That means you'll have to copy the data disk images from" 3
332 LogIt "the CD/hard disk/whatever to physical 1.44MB disks and" 3
333 LogIt "insert them, one after the other. Please see the manual." 3
334 LogIt "The images are in /images on the CD, or /root/images/mindi" 3
335 LogIt "on your hard disk. Your archives are probably fine but" 3
336 LogIt "your tape streamer and/or CD-ROM drive are eccentric. :-)" 3
337 CD_MOUNTED_OK=""
338 fi
339 return 0
340}
341
342
343HowMuchFreeSpaceOnRamdisk() {
344 df -m -P | grep /dev/ram | head -n1 | tr -s '\t' ' ' | cut -d' ' -f4
345}
346
347
348
349InsertEssentialModules() {
350# Load the VIA IDE module first thing if it exists (requires ide-core).
351# This is to ensure that DMA is working for VIA chipsets with 2.6 kernels.
352 for module in /ide-core.ko /via82cxxx.ko; do
353 [ -f "$module" ] && MyInsmod $module > /dev/null 2> /dev/null
354 done
355# Then load the remaining modules in normal (i.e. arbitrary) order.
356 for j in 1 2 3 4 5 ; do
357 for i in `ls /*.*o* 2> /dev/null` ; do
358 [ -f "$i" ] && MyInsmod $i > /dev/null 2> /dev/null
359 done
360 done
361}
362
363
364
365PauseForRaids() {
366 if [ "`dmesg | grep -i "RAID Controller"`" != "" ] || [ "`dmesg | grep -i "Vendor: 3ware"`" != "" ] ; then
367 LogIt "RAID controller(s) detected. Pausing 10 seconds to let them warm up." 1
368 echo -en "Pausing..."
369 for i in 1 2 3 4 5 6 7 8 9 10 ; do
370 sleep 1
371 echo -en "$(($i*10))%..."
372 done
373 echo "Done."
374 fi
375}
376
377
378# 06/13/2002 --- DuckX's & Hugo's new routine
379# 10/11/2003 --- added a simple devfsd.conf file
380# 01/24/2005 --- cater for arbitrary locations of devfsd.conf by using the
381# config file path compiled into devfsd
382RunDevfsd() {
383 loc=`which devfsd 2> /dev/null`
384 if [ "$loc" != "" ] ; then
385 LogIt "Devfs found. Testing kernel support..."
386 if [ ! -e "/dev/.devfsd" ] ; then
387 mount -t devfs devfs /dev 2>> /tmp/mondo-restore.log
388 if [ "$?" -ne "0" ] ; then
389 LogIt "Error while trying to mount devfs"
390 else
391 LogIt "Devfs mounted OK"
392 fi
393 fi
394 #check if the kernel supports devfs
395 if [ -e "/dev/.devfsd" ] ; then
396 [ -d "/proc/1" ] || mount -n /proc
397 LogIt "Kernel support found. Creating config file and starting devfsd"
398 conffile=`strings $loc | grep "devfsd.conf$"`
399 [ "$conffile" ] || conffile="/etc/devfsd.conf"
400 confpath=`echo $conffile | sed "s/\/devfsd\.conf$//"`
401 [ -d "$confpath" ] || mkdir -p $confpath
402 echo -en "REGISTER .* MKOLDCOMPAT\nUNREGISTER .* RMOLDCOMPAT\n" > $conffile
403 devfsd /dev &
404 sleep 5
405 else
406 LogIt "No devfs kernel support."
407 fi
408 fi
409}
410
411
412
413
414
415
416#RunDevfsd() {
417# loc=`which devfsd 2> /dev/null`
418# if [ "$loc" != "" ] ; then
419# LogIt "Starting devfsd"
420# devfsd /dev &
421# sleep 5
422# fi
423#}
424
425
426
427SpaceTests() {
428 [ -e "/tmp/filelist.full" ] && cp /tmp/filelist.full /tmp/FLF
429 if [ "`HowMuchFreeSpaceOnRamdisk`" -le "3" ] ; then
430 LogIt "Ramdisk is a bit smaller than I would like." 1
431 LogIt "Please re-run Mondo/Mindi but edit /usr/local/mindi first" 1
432 LogIt "and set EXTRA_SPACE to something high, e.g. 8000" 1
433 Die "Aborting. Please reboot."
434 fi
435 rm -f /tmp/FLF
436}
437
438
439
440StartLvms() {
441 if [ -e "/tmp/i-want-my-lvm" ] ; then
442 LogIt "Scanning LVM's..." 1
443 if which lvm ; then
444 MyInsmod dm-mod
445 MyInsmod dm_mod
446 lvm vgscan --mknodes
447 else
448 vgscan
449 fi
450 grep -E "^#.*vgchange" /tmp/i-want-my-lvm | sed s/#// > /tmp/start-lvm
451 chmod +x /tmp/start-lvm
452 echo -en "Starting LVM's..."
453 /tmp/start-lvm &
454 for i in 1 2 3 4 5 ; do
455 echo -en "."
456 sleep 1
457 done
458 echo "Done."
459 fi
460# If necessary, cannibalize 'analyze-my-lvm'; copy some of its code here,
461# pipe vgscan's output, strip it, run 'vgchange' on its output, etc.etc.
462 LogIt "LVM's have been started."
463}
464
465
466
467StartNfs() {
468 # using mount -o nolock avoids portmap requirement
469 #if which portmap > /dev/null 2> /dev/null ; then
470 #LogIt "Running portmap"
471 #portmap
472 #[ "$?" -eq "0" ] && LogIt "Portmap started OK" || LogIt "Portmap error"
473 if [ -e "/sbin/start-nfs" ] ; then
474 chmod 755 /sbin/start-nfs
475 LogIt "Starting NFS..."
476 /sbin/start-nfs
477 fi
478 #fi
479}
480
481
482StartRaids() {
483 local raid_devices i
484 if which raidstart > /dev/null 2> /dev/null ; then
485 raid_devices=`grep /dev/md /tmp/mountlist.txt | cut -d' ' -f1`
486 for i in $raid_devices ; do
487 if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
488 LogIt "$i is started already; no need to run 'raidstart $i'" 1
489 else
490 LogIt "Running 'raidstart $i'" 1
491 raidstart $i
492 fi
493 done
494 elif which mdrun > /dev/null 2> /dev/null ; then
495 LogIt "Running 'mdrun'" 1
496 mdrun
497 else
498 LogIt "Warning: Neither 'raidstart' nor 'mdrun''found. RAID devices may not have started." 1
499 fi
500
501}
502
503
504SwapTheMountExecs() {
505 if [ -e "/bin/mount.libc5" ] ; then
506 LogIt "Swapping busybox's mount with libc5 mount"
507 mv /bin/mount /bin/mount.bb
508 mv /bin/mount.libc5 /bin/mount
509 sync
510 fi
511}
512
513
514TryAgainToFindCD() {
515 local res
516 mount | grep /mnt/cdrom && return 0
517 [ "`grep "backup_media_type" /tmp/mondo-restore.cfg | grep "cdstream"`" ] && return
518 LogIt "Trying to mount CD-ROM a 2nd time..."
519 find-and-mount-cdrom --second-try
520 res=$?
521 if [ "$res" -eq "0" ] ; then
522 CD_MOUNTED_OK=yes
523 LogIt "CD-ROM drive mounted successfully." 1
524 else
525 LogIt "I still cannot find or mount the CD-ROM drive, by the way."
526 fi
527}
528
529
530
531UseTmpfs()
532{
533 local mount_cmd
534 echo -en "Mounting /tmp/tmpfs..."
535 mkdir -p /tmp/tmpfs
536# For technical reasons, some sets are as large as 16MB.
537# I am allowing 32MB because selective restore occupies a lot of space.
538 for size in 64m 48m 40m 32m ; do
539 mount_cmd="mount /dev/shm -t tmpfs -o size=$size" ; # was 34m until 04/2003
540 LogIt "Trying '$mount_cmd'"
541 $mount_cmd /tmp/tmpfs 2>> /tmp/mondo-restore.log
542 res=$?
543 [ "$res" -eq "0" ] && break
544 done
545 if [ "$res" -ne "0" ] ; then
546 LogIt "Failed. I could not run '$mount_cmd /tmp/tmpfs'. Your kernel is BROKEN or you do not have enough RAM." 1
547 umount /tmp/tmpfs > /dev/null 2> /dev/null
548 rmdir /tmp/tmpfs
549 ln -sf /mnt/RESTORING/tmp /tmp/tmpfs; # used by mondo-restore
550 LogIt "Failed to mount /tmp/tmpfs; using ugly softlink instead"
551 else
552 LogIt "Great. Pivot succeeded w/ size=$size" 1
553 echo -en "Pivoting /tmp..."
554 umount /tmp/tmpfs
555 mkdir -p /tmp.old
556 mv -f /tmp/* /tmp.old/
557 $mount_cmd /tmp
558 mv /tmp.old/* /tmp/
559 rmdir /tmp.old
560 mkdir -p /tmp/tmpfs
561 mkdir -p $GROOVY
562 echo "Done."
563 LogIt "Successfully mounted dynamic /tmp ramdisk"
564# mkdir -p /tmp/tmpfs/var
565# mv -f /var/log /tmp/tmpfs/var/log
566# ln -sf /tmp/tmpfs/var/log /var/log
567 fi
568}
569
570
571WelcomeMessage()
572{
573 echo "********************************************************************"
574 echo "MINDI-LINUX by Mondo Dev Team - web site: http://www.mondorescue.org"
575 echo "Boot disk based on AlfaLinux & Trinux. BusyBox by Erik Andersen."
576which petris > /dev/null 2> /dev/null && echo "Petris was written by Peter Seidler <p.seidler@mail1.stofanet.dk>."
577 echo "Executables and source code are covered by the GNU GPL. No warranty."
578 echo "running on $ARCH"
579 echo "********************************************************************"
580}
581
582
583EnableCcissIfAppropriate() {
584 local i fname
585 for i in 0 1 2 3 ; do
586 fname="/proc/driver/cciss/cciss$i"
587 if [ -e "$fname" ] ; then
588 LogIt "Engaging $fname"
589 echo "engage scsi" > $fname
590 LogIt "...result=$?"
591 fi
592 done
593}
594
595
596ExtractDataDisksAndLoadModules() {
597 echo "Installing additional tools ..."
598 install-additional-tools
599 echo "Inserting modules ..."
600 insert-all-my-modules > $LOGFILE 2> $LOGFILE
601}
602
603# ------------------------ main -----------------------
604
605trap CaughtSoftReset SIGTERM
606LOGFILE=/tmp/mondo-restore.log
607PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/mondo:/usr/local/mondo:/usr/local/mindi:.
608GROOVY=/tmp/groovy-stuff
609USER=root
610export PATH GROOVY USER
611
612mount -o remount rw /
613[ ! "$GROOVY" ] && Die "I'm not groovy!"
614for i in $GROOVY /mnt/floppy /mnt/cdrom /mnt/isodir /var/local/petris /tmp/isodir; do
615 mkdir -p $i
616done
617#/bin/update
618mount /proc/ /proc -v -t proc
619mkdir /sys 2> /dev/null
620mount /sys/ /sys -v -t sysfs 2>> $LOGFILE
621rm -f /foozero
622
623echo 0 > /proc/sys/kernel/exec-shield 2>> /dev/null
624
625ExtractDevTarballs
626LaunchTerminals
627InsertEssentialModules
628EnableCcissIfAppropriate
629#-------------------------------
630#WHOLIVESINAPINEAPPLEUNDERTHESEA#;# --- don't touch this :)
631#-------------------------------
632UseTmpfs
633if [ ! -e "/tmp/mondo-restore.cfg" ] ; then
634 LogIt "Warning - /tmp/mondo-restore.cfg not found"
635fi
636
637#if [ -e "/tmp/2880.siz" ] ; then
638# HandleCDROMorFloppies
639#el
640if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ] ; then
641 HandleTape
642 ExtractDataDisksAndLoadModules
643elif [ -e "/sbin/start-nfs" ] && [ "`grep -i pxe /proc/cmdline`" ]; then
644 StartNfs
645 imgname=`grep iso-prefix /tmp/mondo-restore.cfg | cut -d' ' -f2-`
646 if [ "$imgname" = "" ]; then
647 imgname="mondorescue"
648 fi
649 if [ "`grep -i prefix /proc/cmdline`" ] ; then
650 for i in `cat /proc/cmdline` ; do
651 if [ "`echo $i | grep -i prefix`" ] ; then
652 imgname=`echo $i | cut -d'=' -f2`
653 fi
654 done
655 fi
656 dirimg=`grep nfs-server-path /tmp/mondo-restore.cfg | cut -d' ' -f2-`
657 if [ "$dirimg" = "" ]; then
658 dirimg="/"
659 fi
660 LogIt "Mounting NFS image $imgname-1.iso in $dirimg on /mnt/cdrom in loopback"
661 losetup /dev/loop7 /tmp/isodir/$dirimg/$imgname-1.iso
662 mount -o ro -t iso9660 /dev/loop7 /mnt/cdrom
663 # Simulate a local CD
664 echo "/mnt/cdrom" > /tmp/CDROM-LIVES-HERE
665 CD_MOUNTED_OK=yes
666 ExtractDataDisksAndLoadModules
667else
668 HandleCDROMorFloppies
669 ExtractDataDisksAndLoadModules
670 if [ -e "/sbin/start-nfs" ]; then
671 StartNfs
672 fi
673fi
674res=$?
675SwapTheMountExecs
676ConfigureLoggingDaemons
677if [ -e "/tmp/USE-DEVFS" ] ; then
678 umount /mnt/cdrom 2> /dev/null
679 mv /dev/cdrom /cdrom.lnk 2> /dev/null
680 CD_MOUNTED_OK=""
681 RunDevfsd
682fi
683echo "Starting potential Raid/LVMs ..."
684PauseForRaids
685StartRaids
686StartLvms
687CopyBootDevEntry
688LoadKeymap
689mkdir -p /tmp/tmpfs
690sleep 2
691#clear
692if [ -e "/dev/md0" ] && [ ! -e "/dev/md/0" ] && [ "`grep /dev/md/ /tmp/mountlist.txt`" != "" ] ; then
693 LogIt "Creating /dev/md/* softlinks just in case." 1
694 mkdir -p /dev/md
695 cp -af /dev/md0 /dev/md/0 2> /dev/null
696 cp -af /dev/md1 /dev/md/1 2> /dev/null
697 cp -af /dev/md2 /dev/md/2 2> /dev/null
698fi
699export ARCH=`uname -m`
700WelcomeMessage
701# SpaceTests; # Mandrake Linux 8.1 doesn't like this
702[ -e "/tmp/mountlist.txt" ] && cp -f /tmp/mountlist.txt /tmp/mountlist.original
703
704if ! [ "`grep -i "pxe" /proc/cmdline`" ] ; then
705 res="`cat /mnt/cdrom/archives/THIS-CD-NUMBER 2> /dev/null`"
706 [ "$res" != "1" ] && [ "$res" != "" ] && Die "This is CD #$res in the series. Please insert CD #1."
707 [ -e "/cdrom.lnk" ] && mv -f /cdrom.lnk /dev/cdrom && mount /dev/cdrom /mnt/cdrom && CD_MOUNTED_OK=yes
708 [ "$CD_MOUNTED_OK" != "yes" ] && TryAgainToFindCD
709 #mount | grep cdrom > /dev/null 2> /dev/null || mount /dev/cdrom /mnt/cdrom >> $LOGFILE 2>> $LOGFILE
710fi
711hack-cfg-if-necessary || LogIt "Cannot find hack-cfg-if-necessary"
712openvt 8 /usr/bin/tail -f /tmp/mondo-restore.log
713
714#-------------------------------
715#ABSORBENTANDYELLOWANDPOROUSISHE#;# --- don't touch this either :)
716#-------------------------------
717
718lsmod > /tmp/ramdisk-lsmod.txt 2> /dev/null
719cut -d' ' -f1 /tmp/original-lsmod.txt /tmp/original-lsmod.txt /tmp/ramdisk-lsmod.txt | sort | uniq -d > /tmp/missing-modules.txt
720echo "Warning - these modules did not make it onto the ramdisk" >> $LOGFILE
721cat /tmp/missing-modules.txt >> $LOGFILE
722
723#ctrlaltdel soft
724for path in /usr.bin /usr/bin ; do
725 fname=$path/nano
726 [ -e "$fname" ] && ln -sf $fname /usr/bin/pico
727done
728res=`which nano 2> /dev/null`
729[ "$res" ] && ln -sf /usr/bin/
730for i in null stdout stdin stderr ; do
731 cp -af /dev/$i /tmp
732done
733if grep "backup-media-type" /tmp/mondo-restore.cfg > /dev/null 2> /dev/null ; then
734 LogIt "backup-media-type is specified in config file - great."
735 LogIt "Calling post-init $mountlist"
736 post-init
737else
738 LogIt "backup-media-type is not specified in config file."
739 LogIt "I think this CD/floppy has no archives on it."
740fi
741echo -en "Type 'exit' to reboot the PC\r"
742umount /mnt/cdrom 2> /dev/null
743mount / -o rw,remount > /dev/null 2> /dev/null
744sh
745CaughtSoftReset
746# reboot
Note: See TracBrowser for help on using the repository browser.