source: MondoRescue/branches/2.05/mindi/rootfs/sbin/init@ 232

Last change on this file since 232 was 232, checked in by bcornec, 18 years ago

Some echo during init and code cleanup

  • Property svn:keywords set to Id
File size: 20.2 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=`cat /tmp/mondo-restore.cfg | grep media-dev | 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 cat /tmp/mondo-restore.cfg | grep -v media-dev > /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 | grep /dev/ram | head -n1 | tr -s '\t' ' ' | cut -d' ' -f4
345}
346
347
348
349InsertEssentialModules() {
350 for j in 1 2 3 4 5 ; do
351 for i in `ls /*.*o* 2> /dev/null` ; do
352 [ -f "$i" ] && MyInsmod $i > /dev/null 2> /dev/null
353 done
354 done
355}
356
357
358
359PauseForRaids() {
360 if [ "`dmesg | grep -i "RAID Controller"`" != "" ] || [ "`dmesg | grep -i "Vendor: 3ware"`" != "" ] ; then
361 LogIt "RAID controller(s) detected. Pausing 10 seconds to let them warm up." 1
362 echo -en "Pausing..."
363 for i in 1 2 3 4 5 6 7 8 9 10 ; do
364 sleep 1
365 echo -en "$(($i*10))%..."
366 done
367 echo "Done."
368 fi
369}
370
371
372# 06/13/2002 --- DuckX's & Hugo's new routine
373# 10/11/2003 --- added a simple devfsd.conf file
374# 01/24/2005 --- cater for arbitrary locations of devfsd.conf by using the
375# config file path compiled into devfsd
376RunDevfsd() {
377 loc=`which devfsd 2> /dev/null`
378 if [ "$loc" != "" ] ; then
379 LogIt "Devfs found. Testing kernel support..."
380 if [ ! -e "/dev/.devfsd" ] ; then
381 mount -t devfs devfs /dev 2>> /tmp/mondo-restore.log
382 if [ "$?" -ne "0" ] ; then
383 LogIt "Error while trying to mount devfs"
384 else
385 LogIt "Devfs mounted OK"
386 fi
387 fi
388 #check if the kernel supports devfs
389 if [ -e "/dev/.devfsd" ] ; then
390 [ -d "/proc/1" ] || mount -n /proc
391 LogIt "Kernel support found. Creating config file and starting devfsd"
392 conffile=`strings $loc | grep "devfsd.conf$"`
393 [ "$conffile" ] || conffile="/etc/devfsd.conf"
394 confpath=`echo $conffile | sed "s/\/devfsd\.conf$//"`
395 [ -d "$confpath" ] || mkdir -p $confpath
396 echo -en "REGISTER .* MKOLDCOMPAT\nUNREGISTER .* RMOLDCOMPAT\n" > $conffile
397 devfsd /dev &
398 sleep 5
399 else
400 LogIt "No devfs kernel support."
401 fi
402 fi
403}
404
405
406
407
408
409
410#RunDevfsd() {
411# loc=`which devfsd 2> /dev/null`
412# if [ "$loc" != "" ] ; then
413# LogIt "Starting devfsd"
414# devfsd /dev &
415# sleep 5
416# fi
417#}
418
419
420
421SpaceTests() {
422 [ -e "/tmp/filelist.full" ] && cp /tmp/filelist.full /tmp/FLF
423 if [ "`HowMuchFreeSpaceOnRamdisk`" -le "3" ] ; then
424 LogIt "Ramdisk is a bit smaller than I would like." 1
425 LogIt "Please re-run Mondo/Mindi but edit /usr/local/mindi first" 1
426 LogIt "and set EXTRA_SPACE to something high, e.g. 8000" 1
427 Die "Aborting. Please reboot."
428 fi
429 rm -f /tmp/FLF
430}
431
432
433
434StartLvms() {
435 if [ -e "/tmp/i-want-my-lvm" ] ; then
436 LogIt "Scanning LVM's..." 1
437 if which lvm ; then
438 MyInsmod dm-mod
439 MyInsmod dm_mod
440 lvm vgscan --mknodes
441 else
442 vgscan
443 fi
444 cat /tmp/i-want-my-lvm | grep -E "^#.*vgchange" | sed s/#// > /tmp/start-lvm
445 chmod +x /tmp/start-lvm
446 echo -en "Starting LVM's..."
447 /tmp/start-lvm &
448 for i in 1 2 3 4 5 ; do
449 echo -en "."
450 sleep 1
451 done
452 echo "Done."
453 fi
454# If necessary, cannibalize 'analyze-my-lvm'; copy some of its code here,
455# pipe vgscan's output, strip it, run 'vgchange' on its output, etc.etc.
456 LogIt "LVM's have been started."
457}
458
459
460
461StartNfs() {
462 # using mount -o nolock avoids portmap requirement
463 #if which portmap > /dev/null 2> /dev/null ; then
464 #LogIt "Running portmap"
465 #portmap
466 #[ "$?" -eq "0" ] && LogIt "Portmap started OK" || LogIt "Portmap error"
467 if [ -e "/sbin/start-nfs" ] ; then
468 chmod 755 /sbin/start-nfs
469 LogIt "Starting NFS..."
470 /sbin/start-nfs
471 fi
472 #fi
473}
474
475
476StartRaids() {
477 local raid_devices i
478 raid_devices=`cat /tmp/mountlist.txt | grep /dev/md | cut -d' ' -f1`
479 for i in $raid_devices ; do
480 if cat /proc/mdstat | grep `basename $i` > /dev/null 2> /dev/null ; then
481 LogIt "$i is started already; no need to run 'raidstart $i'" 1
482 else
483 LogIt "Running 'raidstart $i'" 1
484 raidstart $i
485 fi
486# sleep 1
487 done
488# [ "$raid_devices" != "" ] && PauseForRaid
489}
490
491
492SwapTheMountExecs() {
493 if [ -e "/bin/mount.libc5" ] ; then
494 LogIt "Swapping busybox's mount with libc5 mount"
495 mv /bin/mount /bin/mount.bb
496 mv /bin/mount.libc5 /bin/mount
497 sync
498 fi
499}
500
501
502TryAgainToFindCD() {
503 local res
504 mount | grep /mnt/cdrom && return 0
505 [ "`cat /tmp/mondo-restore.cfg | grep "backup_media_type" | grep "cdstream"`" ] && return
506 LogIt "Trying to mount CD-ROM a 2nd time..."
507 find-and-mount-cdrom --second-try
508 res=$?
509 if [ "$res" -eq "0" ] ; then
510 CD_MOUNTED_OK=yes
511 LogIt "CD-ROM drive mounted successfully." 1
512 else
513 LogIt "I still cannot find or mount the CD-ROM drive, by the way."
514 fi
515}
516
517
518
519UseTmpfs()
520{
521 local mount_cmd
522 echo -en "Mounting /tmp/tmpfs..."
523 mkdir -p /tmp/tmpfs
524# For technical reasons, some sets are as large as 16MB.
525# I am allowing 32MB because selective restore occupies a lot of space.
526 for size in 64m 48m 40m 32m ; do
527 mount_cmd="mount /dev/shm -t tmpfs -o size=$size" ; # was 34m until 04/2003
528 LogIt "Trying '$mount_cmd'"
529 $mount_cmd /tmp/tmpfs 2>> /tmp/mondo-restore.log
530 res=$?
531 [ "$res" -eq "0" ] && break
532 done
533 if [ "$res" -ne "0" ] ; then
534 LogIt "Failed. I could not run '$mount_cmd /tmp/tmpfs'. Your kernel is BROKEN or you do not have enough RAM." 1
535 umount /tmp/tmpfs > /dev/null 2> /dev/null
536 rmdir /tmp/tmpfs
537 ln -sf /mnt/RESTORING/tmp /tmp/tmpfs; # used by mondo-restore
538 LogIt "Failed to mount /tmp/tmpfs; using ugly softlink instead"
539 else
540 LogIt "Great. Pivot succeeded w/ size=$size" 1
541 echo -en "Pivoting /tmp..."
542 umount /tmp/tmpfs
543 mkdir -p /tmp.old
544 mv -f /tmp/* /tmp.old/
545 $mount_cmd /tmp
546 mv /tmp.old/* /tmp/
547 rmdir /tmp.old
548 mkdir -p /tmp/tmpfs
549 mkdir -p $GROOVY
550 echo "Done."
551 LogIt "Successfully mounted dynamic /tmp ramdisk"
552# mkdir -p /tmp/tmpfs/var
553# mv -f /var/log /tmp/tmpfs/var/log
554# ln -sf /tmp/tmpfs/var/log /var/log
555 fi
556}
557
558
559WelcomeMessage()
560{
561 echo "********************************************************************"
562 echo "MINDI-LINUX by Hugo Rabson --- web site: http://www.mondorescue.org"
563 echo "Boot disk based on AlfaLinux & Trinux. BusyBox by Erik Andersen."
564which petris > /dev/null 2> /dev/null && echo "Petris was written by Peter Seidler <p.seidler@mail1.stofanet.dk>."
565 echo "Executables and source code are covered by the GNU GPL. No warranty."
566 echo "running on $ARCH"
567 echo "********************************************************************"
568}
569
570
571EnableCcissIfAppropriate() {
572 local i fname
573 for i in 0 1 2 3 ; do
574 fname="/proc/driver/cciss/cciss$i"
575 if [ -e "$fname" ] ; then
576 LogIt "Engaging $fname"
577 echo "engage scsi" > $fname
578 LogIt "...result=$?"
579 fi
580 done
581}
582
583
584
585# ------------------------ main -----------------------
586
587trap CaughtSoftReset SIGTERM
588LOGFILE=/tmp/mondo-restore.log
589PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/mondo:/usr/local/mondo:/usr/local/mindi:.
590GROOVY=/tmp/groovy-stuff
591USER=root
592export PATH GROOVY USER
593
594mount -o remount rw /
595[ ! "$GROOVY" ] && Die "I'm not groovy!"
596for i in $GROOVY /mnt/floppy /mnt/cdrom /mnt/isodir /var/local/petris /tmp/isodir; do
597 mkdir -p $i
598done
599#/bin/update
600mount /proc/ /proc -v -t proc
601mkdir /sys 2> /dev/null
602mount /sys/ /sys -v -t sysfs 2>> $LOGFILE
603rm -f /foozero
604
605echo 0 > /proc/sys/kernel/exec-shield 2>> /dev/null
606
607ExtractDevTarballs
608LaunchTerminals
609InsertEssentialModules
610EnableCcissIfAppropriate
611#-------------------------------
612#WHOLIVESINAPINEAPPLEUNDERTHESEA#;# --- don't touch this :)
613#-------------------------------
614UseTmpfs
615# Allows PXE boot by starting NFS earlier
616StartNfs
617if [ ! -e "/tmp/mondo-restore.cfg" ] ; then
618 LogIt "Warning - /tmp/mondo-restore.cfg not found"
619fi
620
621#if [ -e "/tmp/2880.siz" ] ; then
622# HandleCDROMorFloppies
623#el
624if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ] ; then
625 HandleTape
626else
627 if [ -e "/sbin/start-nfs" ]; then
628 if [ "`cat /proc/cmdline | grep -i pxe`" ]; then
629 LogIt "PXE boot found"
630 fi
631 imgname=`grep iso-prefix /tmp/mondo-restore.cfg | cut -d' ' -f2-`
632 if [ "$imgname" = "" ]; then
633 imgname="mondorescue"
634 fi
635 if [ "`cat /proc/cmdline | grep -i prefix`" ] ; then
636 for i in `cat /proc/cmdline` ; do
637 if [ "`echo $i | grep -i prefix`" ] ; then
638 imgname=`echo $i | cut -d'=' -f2`
639 fi
640 done
641 fi
642 dirimg=`grep nfs-server-path /tmp/mondo-restore.cfg | cut -d' ' -f2-`
643 if [ "$dirimg" = "" ]; then
644 dirimg="/"
645 fi
646 LogIt "Mounting NFS image $imgname-1.iso in $dirimg on /mnt/cdrom in loopback"
647 losetup /dev/loop7 /tmp/isodir/$dirimg/$imgname-1.iso
648 mount -t iso9660 /dev/loop7 /mnt/cdrom
649 # Simulate a local CD
650 echo "/mnt/cdrom" > /tmp/CDROM-LIVES-HERE
651 CD_MOUNTED_OK=yes
652 else
653 HandleCDROMorFloppies
654 fi
655fi
656res=$?
657echo "Inserting modules ..."
658insert-all-my-modules > $LOGFILE 2> $LOGFILE
659echo "Installing additional tools ..."
660install-additional-tools
661SwapTheMountExecs
662ConfigureLoggingDaemons
663echo "Inserting modules again ..."
664insert-all-my-modules > $LOGFILE 2> $LOGFILE
665if [ -e "/tmp/USE-DEVFS" ] ; then
666 umount /mnt/cdrom 2> /dev/null
667 mv /dev/cdrom /cdrom.lnk 2> /dev/null
668 CD_MOUNTED_OK=""
669 RunDevfsd
670fi
671echo "Starting potential Raid/LVMs ..."
672PauseForRaids
673StartRaids
674StartLvms
675CopyBootDevEntry
676LoadKeymap
677mkdir -p /tmp/tmpfs
678sleep 2
679#clear
680if [ -e "/dev/md0" ] && [ ! -e "/dev/md/0" ] && [ "`cat /tmp/mountlist.txt | grep /dev/md/`" != "" ] ; then
681 LogIt "Creating /dev/md/* softlinks just in case." 1
682 mkdir -p /dev/md
683 cp -af /dev/md0 /dev/md/0 2> /dev/null
684 cp -af /dev/md1 /dev/md/1 2> /dev/null
685 cp -af /dev/md2 /dev/md/2 2> /dev/null
686fi
687export ARCH=`uname -m`
688WelcomeMessage
689# SpaceTests; # Mandrake Linux 8.1 doesn't like this
690[ -e "/tmp/mountlist.txt" ] && cp -f /tmp/mountlist.txt /tmp/mountlist.original
691
692if ! [ "`cat /proc/cmdline | grep -i "pxe"`" ] ; then
693 res="`cat /mnt/cdrom/archives/THIS-CD-NUMBER 2> /dev/null`"
694 [ "$res" != "1" ] && [ "$res" != "" ] && Die "This is CD #$res in the series. Please insert CD #1."
695 [ -e "/cdrom.lnk" ] && mv -f /cdrom.lnk /dev/cdrom && mount /dev/cdrom /mnt/cdrom && CD_MOUNTED_OK=yes
696 [ "$CD_MOUNTED_OK" != "yes" ] && TryAgainToFindCD
697 #mount | grep cdrom > /dev/null 2> /dev/null || mount /dev/cdrom /mnt/cdrom >> $LOGFILE 2>> $LOGFILE
698fi
699hack-cfg-if-necessary || LogIt "Cannot find hack-cfg-if-necessary"
700openvt 8 /usr/bin/tail -f /tmp/mondo-restore.log
701
702#-------------------------------
703#ABSORBENTANDYELLOWANDPOROUSISHE#;# --- don't touch this either :)
704#-------------------------------
705
706lsmod > /tmp/ramdisk-lsmod.txt 2> /dev/null
707cat /tmp/original-lsmod.txt /tmp/original-lsmod.txt /tmp/ramdisk-lsmod.txt | cut -d' ' -f1 | sort | uniq -d > /tmp/missing-modules.txt
708echo "Warning - these modules did not make it onto the ramdisk" >> $LOGFILE
709cat /tmp/missing-modules.txt >> $LOGFILE
710
711#ctrlaltdel soft
712for path in /usr.bin /usr/bin ; do
713 fname=$path/nano
714 [ -e "$fname" ] && ln -sf $fname /usr/bin/pico
715done
716res=`which nano 2> /dev/null`
717[ "$res" ] && ln -sf /usr/bin/
718for i in null stdout stdin stderr ; do
719 cp -af /dev/$i /tmp
720done
721if grep "backup-media-type" /tmp/mondo-restore.cfg > /dev/null 2> /dev/null ; then
722 LogIt "backup-media-type is specified in config file - great."
723 LogIt "Calling post-init $mountlist"
724 post-init
725else
726 LogIt "backup-media-type is not specified in config file."
727 LogIt "I think this CD/floppy has no archives on it."
728fi
729echo -en "Type 'exit' to reboot the PC\r"
730umount /mnt/cdrom 2> /dev/null
731mount / -o rw,remount > /dev/null 2> /dev/null
732sh
733CaughtSoftReset
734# reboot
Note: See TracBrowser for help on using the repository browser.