source: MondoRescue/branches/stable/mindi/rootfs/sbin/init@ 429

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

Load module via82cxxx first in InsertEssentialModules() to get IDE DMA
working for 2.6 kernels with VIA chipsets.

  • Property svn:keywords set to Id
File size: 20.5 KB
RevLine 
[1]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
[241]258 [ ! "$tapedev" ] && tapedev=`grep media-dev /tmp/mondo-restore.cfg | tr -s ' ' ' ' | cut -d' ' -f2`
[1]259# tar -zxf $tapedev
260 dd if=$tapedev bs=32k count=1024 | tar -zx
261 res=$?
262 if [ "$res" -eq "0" ] ; then
[241]263 grep -v media-dev /tmp/mondo-restore.cfg > /tmp/mr.cfg
[1]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() {
[305]344 df -m -P | grep /dev/ram | head -n1 | tr -s '\t' ' ' | cut -d' ' -f4
[1]345}
346
347
348
349InsertEssentialModules() {
[429]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.
[1]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
[241]450 grep -E "^#.*vgchange" /tmp/i-want-my-lvm | sed s/#// > /tmp/start-lvm
[1]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
[241]484 raid_devices=`grep /dev/md /tmp/mountlist.txt | cut -d' ' -f1`
[1]485 for i in $raid_devices ; do
[241]486 if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
[1]487 LogIt "$i is started already; no need to run 'raidstart $i'" 1
488 else
489 LogIt "Running 'raidstart $i'" 1
490 raidstart $i
491 fi
492# sleep 1
493 done
494# [ "$raid_devices" != "" ] && PauseForRaid
495}
496
497
498SwapTheMountExecs() {
499 if [ -e "/bin/mount.libc5" ] ; then
500 LogIt "Swapping busybox's mount with libc5 mount"
501 mv /bin/mount /bin/mount.bb
502 mv /bin/mount.libc5 /bin/mount
503 sync
504 fi
505}
506
507
508TryAgainToFindCD() {
509 local res
510 mount | grep /mnt/cdrom && return 0
[241]511 [ "`grep "backup_media_type" /tmp/mondo-restore.cfg | grep "cdstream"`" ] && return
[1]512 LogIt "Trying to mount CD-ROM a 2nd time..."
513 find-and-mount-cdrom --second-try
514 res=$?
515 if [ "$res" -eq "0" ] ; then
516 CD_MOUNTED_OK=yes
517 LogIt "CD-ROM drive mounted successfully." 1
518 else
519 LogIt "I still cannot find or mount the CD-ROM drive, by the way."
520 fi
521}
522
523
524
525UseTmpfs()
526{
527 local mount_cmd
528 echo -en "Mounting /tmp/tmpfs..."
529 mkdir -p /tmp/tmpfs
530# For technical reasons, some sets are as large as 16MB.
531# I am allowing 32MB because selective restore occupies a lot of space.
532 for size in 64m 48m 40m 32m ; do
533 mount_cmd="mount /dev/shm -t tmpfs -o size=$size" ; # was 34m until 04/2003
534 LogIt "Trying '$mount_cmd'"
535 $mount_cmd /tmp/tmpfs 2>> /tmp/mondo-restore.log
536 res=$?
537 [ "$res" -eq "0" ] && break
538 done
539 if [ "$res" -ne "0" ] ; then
540 LogIt "Failed. I could not run '$mount_cmd /tmp/tmpfs'. Your kernel is BROKEN or you do not have enough RAM." 1
541 umount /tmp/tmpfs > /dev/null 2> /dev/null
542 rmdir /tmp/tmpfs
543 ln -sf /mnt/RESTORING/tmp /tmp/tmpfs; # used by mondo-restore
544 LogIt "Failed to mount /tmp/tmpfs; using ugly softlink instead"
545 else
546 LogIt "Great. Pivot succeeded w/ size=$size" 1
547 echo -en "Pivoting /tmp..."
548 umount /tmp/tmpfs
549 mkdir -p /tmp.old
550 mv -f /tmp/* /tmp.old/
551 $mount_cmd /tmp
552 mv /tmp.old/* /tmp/
553 rmdir /tmp.old
554 mkdir -p /tmp/tmpfs
555 mkdir -p $GROOVY
556 echo "Done."
557 LogIt "Successfully mounted dynamic /tmp ramdisk"
558# mkdir -p /tmp/tmpfs/var
559# mv -f /var/log /tmp/tmpfs/var/log
560# ln -sf /tmp/tmpfs/var/log /var/log
561 fi
562}
563
564
565WelcomeMessage()
566{
567 echo "********************************************************************"
568 echo "MINDI-LINUX by Hugo Rabson --- web site: http://www.mondorescue.org"
569 echo "Boot disk based on AlfaLinux & Trinux. BusyBox by Erik Andersen."
570which petris > /dev/null 2> /dev/null && echo "Petris was written by Peter Seidler <p.seidler@mail1.stofanet.dk>."
571 echo "Executables and source code are covered by the GNU GPL. No warranty."
572 echo "running on $ARCH"
573 echo "********************************************************************"
574}
575
576
577EnableCcissIfAppropriate() {
578 local i fname
579 for i in 0 1 2 3 ; do
580 fname="/proc/driver/cciss/cciss$i"
581 if [ -e "$fname" ] ; then
582 LogIt "Engaging $fname"
583 echo "engage scsi" > $fname
584 LogIt "...result=$?"
585 fi
586 done
587}
588
589
[287]590ExtractDataDisksAndLoadModules() {
591 echo "Installing additional tools ..."
592 install-additional-tools
593 echo "Inserting modules ..."
594 insert-all-my-modules > $LOGFILE 2> $LOGFILE
595}
[1]596
597# ------------------------ main -----------------------
598
599trap CaughtSoftReset SIGTERM
600LOGFILE=/tmp/mondo-restore.log
601PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/mondo:/usr/local/mondo:/usr/local/mindi:.
602GROOVY=/tmp/groovy-stuff
603USER=root
604export PATH GROOVY USER
605
606mount -o remount rw /
607[ ! "$GROOVY" ] && Die "I'm not groovy!"
608for i in $GROOVY /mnt/floppy /mnt/cdrom /mnt/isodir /var/local/petris /tmp/isodir; do
609 mkdir -p $i
610done
611#/bin/update
612mount /proc/ /proc -v -t proc
613mkdir /sys 2> /dev/null
614mount /sys/ /sys -v -t sysfs 2>> $LOGFILE
615rm -f /foozero
616
617echo 0 > /proc/sys/kernel/exec-shield 2>> /dev/null
618
619ExtractDevTarballs
620LaunchTerminals
621InsertEssentialModules
622EnableCcissIfAppropriate
623#-------------------------------
624#WHOLIVESINAPINEAPPLEUNDERTHESEA#;# --- don't touch this :)
625#-------------------------------
626UseTmpfs
627if [ ! -e "/tmp/mondo-restore.cfg" ] ; then
628 LogIt "Warning - /tmp/mondo-restore.cfg not found"
629fi
630
631#if [ -e "/tmp/2880.siz" ] ; then
632# HandleCDROMorFloppies
633#el
[180]634if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ] ; then
[287]635 HandleTape
636 ExtractDataDisksAndLoadModules
637elif [ -e "/sbin/start-nfs" ] && [ "`grep -i pxe /proc/cmdline`" ]; then
638 StartNfs
639 imgname=`grep iso-prefix /tmp/mondo-restore.cfg | cut -d' ' -f2-`
640 if [ "$imgname" = "" ]; then
641 imgname="mondorescue"
642 fi
643 if [ "`grep -i prefix /proc/cmdline`" ] ; then
644 for i in `cat /proc/cmdline` ; do
645 if [ "`echo $i | grep -i prefix`" ] ; then
646 imgname=`echo $i | cut -d'=' -f2`
647 fi
648 done
649 fi
650 dirimg=`grep nfs-server-path /tmp/mondo-restore.cfg | cut -d' ' -f2-`
651 if [ "$dirimg" = "" ]; then
652 dirimg="/"
653 fi
654 LogIt "Mounting NFS image $imgname-1.iso in $dirimg on /mnt/cdrom in loopback"
655 losetup /dev/loop7 /tmp/isodir/$dirimg/$imgname-1.iso
[365]656 mount -o ro -t iso9660 /dev/loop7 /mnt/cdrom
[287]657 # Simulate a local CD
658 echo "/mnt/cdrom" > /tmp/CDROM-LIVES-HERE
659 CD_MOUNTED_OK=yes
660 ExtractDataDisksAndLoadModules
[1]661else
[287]662 HandleCDROMorFloppies
663 ExtractDataDisksAndLoadModules
[227]664 if [ -e "/sbin/start-nfs" ]; then
[287]665 StartNfs
[1]666 fi
667fi
668res=$?
669SwapTheMountExecs
670ConfigureLoggingDaemons
671if [ -e "/tmp/USE-DEVFS" ] ; then
672 umount /mnt/cdrom 2> /dev/null
673 mv /dev/cdrom /cdrom.lnk 2> /dev/null
674 CD_MOUNTED_OK=""
675 RunDevfsd
676fi
[232]677echo "Starting potential Raid/LVMs ..."
[1]678PauseForRaids
679StartRaids
680StartLvms
681CopyBootDevEntry
682LoadKeymap
683mkdir -p /tmp/tmpfs
684sleep 2
685#clear
[241]686if [ -e "/dev/md0" ] && [ ! -e "/dev/md/0" ] && [ "`grep /dev/md/ /tmp/mountlist.txt`" != "" ] ; then
[1]687 LogIt "Creating /dev/md/* softlinks just in case." 1
688 mkdir -p /dev/md
689 cp -af /dev/md0 /dev/md/0 2> /dev/null
690 cp -af /dev/md1 /dev/md/1 2> /dev/null
691 cp -af /dev/md2 /dev/md/2 2> /dev/null
692fi
[220]693export ARCH=`uname -m`
[1]694WelcomeMessage
695# SpaceTests; # Mandrake Linux 8.1 doesn't like this
696[ -e "/tmp/mountlist.txt" ] && cp -f /tmp/mountlist.txt /tmp/mountlist.original
697
[241]698if ! [ "`grep -i "pxe" /proc/cmdline`" ] ; then
[1]699 res="`cat /mnt/cdrom/archives/THIS-CD-NUMBER 2> /dev/null`"
700 [ "$res" != "1" ] && [ "$res" != "" ] && Die "This is CD #$res in the series. Please insert CD #1."
701 [ -e "/cdrom.lnk" ] && mv -f /cdrom.lnk /dev/cdrom && mount /dev/cdrom /mnt/cdrom && CD_MOUNTED_OK=yes
702 [ "$CD_MOUNTED_OK" != "yes" ] && TryAgainToFindCD
703 #mount | grep cdrom > /dev/null 2> /dev/null || mount /dev/cdrom /mnt/cdrom >> $LOGFILE 2>> $LOGFILE
704fi
705hack-cfg-if-necessary || LogIt "Cannot find hack-cfg-if-necessary"
706openvt 8 /usr/bin/tail -f /tmp/mondo-restore.log
707
708#-------------------------------
709#ABSORBENTANDYELLOWANDPOROUSISHE#;# --- don't touch this either :)
710#-------------------------------
711
712lsmod > /tmp/ramdisk-lsmod.txt 2> /dev/null
[241]713cut -d' ' -f1 /tmp/original-lsmod.txt /tmp/original-lsmod.txt /tmp/ramdisk-lsmod.txt | sort | uniq -d > /tmp/missing-modules.txt
[1]714echo "Warning - these modules did not make it onto the ramdisk" >> $LOGFILE
715cat /tmp/missing-modules.txt >> $LOGFILE
716
717#ctrlaltdel soft
718for path in /usr.bin /usr/bin ; do
719 fname=$path/nano
720 [ -e "$fname" ] && ln -sf $fname /usr/bin/pico
721done
722res=`which nano 2> /dev/null`
723[ "$res" ] && ln -sf /usr/bin/
724for i in null stdout stdin stderr ; do
725 cp -af /dev/$i /tmp
726done
727if grep "backup-media-type" /tmp/mondo-restore.cfg > /dev/null 2> /dev/null ; then
728 LogIt "backup-media-type is specified in config file - great."
729 LogIt "Calling post-init $mountlist"
730 post-init
731else
732 LogIt "backup-media-type is not specified in config file."
733 LogIt "I think this CD/floppy has no archives on it."
734fi
735echo -en "Type 'exit' to reboot the PC\r"
736umount /mnt/cdrom 2> /dev/null
737mount / -o rw,remount > /dev/null 2> /dev/null
738sh
739CaughtSoftReset
740# reboot
Note: See TracBrowser for help on using the repository browser.