source: MondoRescue/branches/2.2.5/mindi/rootfs/sbin/init @ 1734

Last change on this file since 1734 was 1734, checked in by Bruno Cornec, 12 years ago
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Property svn:keywords set to Id
File size: 18.1 KB
Line 
1#!/bin/sh
2#
3# $Id: init 1734 2007-10-29 13:24:06Z bruno $
4#
5# init script launched during the restore process
6#------------------------------------------------------------
7
8
9CaughtSoftReset() {
10    trap SIGTERM
11    reboot
12}
13
14
15ConfigureLoggingDaemons() {
16    echo -en "Running klogd..."
17    klogd -c 2 > /dev/null 2> /dev/null
18    echo -en "Done.\nRunning syslogd..."
19    syslogd > /dev/null 2> /dev/null
20    echo "Done."
21    LogIt "klogd and syslogd have been started."
22}
23
24
25
26CopyBootDevEntry() {
27    local outfile devfile
28    devfile=/dev/boot_device
29    outfile=`cat /BOOTLOADER.DEVICE 2> /dev/null`
30    [ ! "$outfile" ] && return 0
31    echo -en "Copying boot device to $outfile..."
32    if [ -e "$outfile" ] ; then
33        echo "OK."
34        return 0
35    fi
36    mkdir -p $outfile
37    rmdir $outfile
38    cp -pRdf $devfile $outfile
39    if [ "$?" -ne "0" ] ; then
40        echo "Failed."
41        return 1
42    else
43        echo "OK."
44        return 0
45    fi
46}
47
48
49
50Die() {
51    LogIt "Fatal error! $1" 1
52    exit 1
53}
54
55
56
57ExtractDevTarballs() {
58    cd /
59    for fname in ataraid.tgz ida.tgz i2o.tgz rd.tgz raw.tgz cciss.tgz nst.tgz dm.tgz vc.tgz ; do
60        if [ ! -e "/$fname" ] ; then
61            LogIt "/$fname not found; cannot extract to /." 1
62        else
63            echo -en "\rExtracting /$fname...     "
64            tar -zxf /$fname || LogIt "Error occurred while extracting /$fname"
65        fi
66    done
67    echo -en "\r"
68    LogIt "Extracted additional /dev entries OK.     " 1
69}
70
71
72
73LaunchTerminals() {
74    openvt 2 /bin/sh
75    openvt 3 /bin/sh
76    openvt 4 /bin/sh
77    openvt 5 /bin/sh
78    openvt 6 /bin/sh
79    openvt 7 /bin/sh /sbin/wait-for-petris
80}
81
82
83LoadKeymap() {
84    local fname
85    fname=`cat /tmp/KEYMAP-LIVES-HERE 2> /dev/null`
86    [ "$fname" = "" ] && return
87    if which loadkeys > /dev/null 2> /dev/null ; then
88        loadkeys $fname
89# loadkmap != loadkeys
90#    elif which loadkmap > /dev/null 2> /dev/null ; then
91#        loadkmap < $fname
92    else
93        LogIt "Using default keyboard map." 1
94    fi
95}
96
97
98UntarTapeStuff() {
99    local old_pwd res
100    old_pwd=`pwd`
101    cd $GROOVY
102    [ "$1" != "" ] && tapedev=$1
103    [ ! "$tapedev" ] && tapedev=`grep media-dev /tmp/mondo-restore.cfg | tr -s ' ' ' ' | cut -d' ' -f2`
104#    tar -zxf $tapedev
105    dd if=$tapedev bs=32k count=1024 | tar -zx
106    res=$?
107    if [ "$res" -eq "0" ] ; then
108        grep -v media-dev /tmp/mondo-restore.cfg > /tmp/mr.cfg
109        echo "media-dev $tapedev" >> /tmp/mr.cfg
110        cp -f /tmp/mr.cfg /tmp/mondo-restore.cfg
111    fi
112    cd $old_pwd
113    return $res
114}
115
116HandleTape() {
117    local res tapedev
118    tapedev="" ; # will be set by UntarTapeStuff()
119    cd $GROOVY
120    UntarTapeStuff $tapedev || UntarTapeStuff /dev/st0 || UntarTapeStuff /dev/osst0 || UntarTapeStuff /dev/ht0
121    res=$?
122    while [ "$res" -ne "0" ] ; do
123        LogIt "$tapedev failed to act as extended data disk for booting." 1
124        LogIt "Please specify an alternate tape device," 1
125        LogIt "or hit <Enter> to boot from CD/floppies." 1
126        echo -en "---> "
127        read tapedev
128        if [ "$tapedev" ] ; then
129            LogIt "User specified $tapedev instead"
130            UntarTapeStuff $tapedev
131            res=$?
132        else
133            LogIt "User opted not to specify an alternate tapedev"
134            res=1
135        break
136        fi
137    done
138
139    if [ "$res" -ne "0" ] ; then
140        cd /
141        LogIt "Failed to use tape as extended datadisk. Reverting to floppies." 1
142        HandleCDROMorFloppies
143        res=$?
144    else
145#       clear
146        LogIt "Using tape as extended datadisk. Good." 3
147        echo "Using tape as extd ddisk." > /tmp/TAPEDEV-HAS-DATA-DISKS
148        res=0
149        CD_MOUNTED_OK=yes
150    fi
151    return $res
152}
153
154
155
156HandleCDROMorFloppies() {
157    find-and-mount-cdrom
158    res=$?
159    if [ "$res" -ne "0" ] ; then
160        LogIt "First call to find-and-mount-cdrom failed." 1
161        LogIt "Sleeping for 3 seconds and trying again." 1
162        sleep 3
163        find-and-mount-cdrom
164        res=$?
165    fi
166    if [ "$res" -eq "0" ] ; then
167        LogIt "OK, I am running on a CD-ROM. Good." 3
168        CD_MOUNTED_OK=yes
169    elif [ "$res" -eq "1" ] ; then
170        LogIt "OK, I am running on floppies. Good." 3
171        CD_MOUNTED_OK=""
172    else
173        LogIt "OK, I am falling back to floppy mode." 3
174        LogIt "That means you'll have to copy the data disk images from" 3
175        LogIt "the CD/hard disk/whatever to physical 1.44MB disks and" 3
176        LogIt "insert them, one after the other. Please see the manual." 3
177        LogIt "The images are in /images on the CD, or /root/images/mindi" 3
178        LogIt "on your hard disk. Your archives are probably fine but" 3
179        LogIt "your tape streamer and/or CD-ROM drive are eccentric. :-)" 3
180        CD_MOUNTED_OK=""
181    fi
182    return 0
183}
184
185
186HowMuchFreeSpaceOnRamdisk() {
187   df -m -P | grep /dev/ram | head -n1 | tr -s '\t' ' ' | cut -d' ' -f4
188}
189
190
191
192InsertEssentialModules() {
193#   Load the VIA IDE module first thing if it exists (requires ide-core).
194#   This is to ensure that DMA is working for VIA chipsets with 2.6 kernels.
195    for module in /ide-core.ko /via82cxxx.ko; do
196        [ -f "$module" ] && MyInsmod $module > /dev/null 2> /dev/null
197    done
198#   Then load the remaining modules in normal (i.e. arbitrary) order.
199    for j in 1 2 3 4 5 ; do
200        for i in `ls /*.*o* 2> /dev/null` ; do
201            [ -f "$i" ] && MyInsmod $i > /dev/null 2> /dev/null
202        done
203    done
204}
205
206
207
208PauseForRaids() {
209    if [ "`dmesg | grep -i "RAID Controller"`" != "" ] || [ "`dmesg | grep -i "Vendor: 3ware"`" != "" ] ; then
210        LogIt "RAID controller(s) detected. Pausing 10 seconds to let them warm up." 1
211        echo -en "Pausing..."
212        for i in 1 2 3 4 5 6 7 8 9 10 ; do
213            sleep 1
214            echo -en "$(($i*10))%..."
215        done
216        echo "Done."
217    fi
218}
219
220
221# 06/13/2002 --- DuckX's & Hugo's new routine
222# 10/11/2003 --- added a simple devfsd.conf file
223# 01/24/2005 --- cater for arbitrary locations of devfsd.conf by using the
224#                config file path compiled into devfsd
225RunDevfsd() {
226    loc=`which devfsd 2> /dev/null`
227    if [ "$loc" != "" ] ; then
228    LogIt "Devfs found. Testing kernel support..."
229    if [ ! -e "/dev/.devfsd" ] ; then
230        mount -t devfs devfs /dev 2>> $LOGFILE
231            if [ "$?" -ne "0" ] ; then
232        LogIt "Error while trying to mount devfs"
233        else
234        LogIt "Devfs mounted OK"
235        fi
236    fi
237    #check if the kernel supports devfs
238    if [ -e "/dev/.devfsd" ] ; then
239        [ -d "/proc/1" ] || mount -n /proc
240        LogIt "Kernel support found. Creating config file and starting devfsd"
241        conffile=`strings $loc | grep -E "devfsd.conf$"`
242        [ "$conffile" ] || conffile="/etc/devfsd.conf"
243        confpath=`echo $conffile | sed "s/\/devfsd\.conf$//"`
244        [ -d "$confpath" ] || mkdir -p $confpath
245        echo -en "REGISTER .* MKOLDCOMPAT\nUNREGISTER .* RMOLDCOMPAT\n" > $conffile
246        devfsd /dev &
247        sleep 5
248    else
249        LogIt "No devfs kernel support."
250    fi
251    fi
252}
253
254# Taken from udev management in Mandriva 2008.0. Kudos guys
255make_extra_nodes () {
256    # there are a few things that sysfs does not export for us.
257    # these things are listed in /etc/udev/links.conf
258    grep '^[^#]' /etc/udev-links.conf | \
259    while read type name arg1; do
260        [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue
261        case "$type" in
262            L) ln -s $arg1 /dev/$name ;;
263            D) mkdir -p /dev/$name ;;
264            M) mknod /dev/$name $arg1 && chmod 600 /dev/$name;;
265            *) echo "udev-links.conf: unparseable line (%s %s %s)\n" "$type" "$name" "$arg1" ;;
266        esac
267    done
268}
269
270
271RunUdevd() {
272    # Inspiration from Mandriva 2008.0 startup script
273    echo "Preparing udev environment..."
274    mv /dev /dev.static
275    mkdir /dev
276    mount -n -o size=5M,mode=0755 -t tmpfs none /dev
277    make_extra_nodes
278    mount -n -t devpts -o mode=620 none /dev/pts
279    mount -n -t tmpfs  none /dev/shm
280    PKLVL=`cut -f1 /proc/sys/kernel/printk`
281    echo 0 > /proc/sys/kernel/printk
282    /sbin/udevd --daemon
283    echo $PKLVL > /proc/sys/kernel/printk
284}
285
286
287
288
289#RunDevfsd() {
290#    loc=`which devfsd 2> /dev/null`
291#    if [ "$loc" != "" ] ; then
292#        LogIt "Starting devfsd"
293#        devfsd /dev &
294#        sleep 5
295#    fi
296#}
297
298
299
300SpaceTests() {
301    [ -e "/tmp/filelist.full" ] && cp /tmp/filelist.full /tmp/FLF
302    if [ "`HowMuchFreeSpaceOnRamdisk`" -le "3" ] ; then
303        LogIt "Ramdisk is a bit smaller than I would like." 1
304        LogIt "Please re-run Mondo/Mindi but edit /usr/local/mindi first" 1
305        LogIt "and set EXTRA_SPACE to something high, e.g. 8000" 1
306        Die "Aborting. Please reboot."
307    fi
308    rm -f /tmp/FLF
309}
310
311
312
313StartLvms() {
314    if [ -e "/tmp/i-want-my-lvm" ] ; then
315        LogIt "Scanning LVM's..." 1
316        if which lvm ; then
317            MyInsmod dm-mod
318            MyInsmod dm_mod
319            lvm vgscan --mknodes
320        else
321            vgscan
322        fi
323        grep -E "^#.*vgchange" /tmp/i-want-my-lvm | sed "s/^#[ ]*//" > /tmp/start-lvm
324        chmod +x /tmp/start-lvm
325        echo -en "Starting LVM's..."
326        /tmp/start-lvm &
327        for i in 1 2 3 4 5 ; do
328            echo -en "."
329            sleep 1
330        done
331        echo "Done."
332    fi
333# If necessary, cannibalize 'analyze-my-lvm'; copy some of its code here,
334# pipe vgscan's output, strip it, run 'vgchange' on its output, etc.etc.
335    LogIt "LVM's have been started."
336}
337
338
339StartRaids() {
340    local raid_devices i
341
342    raid_devices=`grep /dev/md /tmp/mountlist.txt | cut -d' ' -f1`
343    if which raidstart > /dev/null 2> /dev/null ; then
344        for i in $raid_devices ; do
345            if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
346                LogIt "$i is started already; no need to run 'raidstart $i'" 1
347            else
348                LogIt "Running 'raidstart $i'" 1
349                raidstart $i
350            fi
351        done
352    elif which mdrun > /dev/null 2> /dev/null ; then
353        LogIt "Running 'mdrun'" 1
354        mdrun
355    elif which mdadm > /dev/null 2> /dev/null ; then
356        LogIt "Running 'mdadm'" 1
357        for i in $raid_devices ; do
358            if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
359                LogIt "$i is started already; no need to run 'mdadm $i'" 1
360            else
361                if [ -f /etc/mdadm.conf ] ; then
362                    LogIt "Running 'mdadm $i' with user supplied /etc/mdadm.conf" 1
363                    mdadm -A $i -c /etc/mdadm.conf
364                elif [ -f /etc/mdadm/mdadm.conf ] ; then
365                    LogIt "Running 'mdadm $i' with user supplied /etc/mdadm/mdadm.conf" 1
366                    mdadm -A $i -c /etc/mdadm/mdadm.conf
367                else
368                    LogIt "Running 'mdadm $i'" 1
369                    mdadm -Ac partitions -m dev $i
370                fi
371            fi
372        done
373    else
374        LogIt "Warning: Neither 'raidstart' nor 'mdrun''found. RAID devices may not have started." 1
375    fi
376
377}
378
379
380TryAgainToFindCD() {
381    local res
382    mount | grep /mnt/cdrom && return 0
383    [ "`grep "backup_media_type" /tmp/mondo-restore.cfg | grep "cdstream"`" ] && return
384    LogIt "Trying to mount CD-ROM a 2nd time..."
385    find-and-mount-cdrom --second-try
386    res=$?
387    if [ "$res" -eq "0" ] ; then
388        CD_MOUNTED_OK=yes
389        LogIt "CD-ROM drive mounted successfully." 1
390    else
391        LogIt "I still cannot find or mount the CD-ROM drive, by the way."
392    fi
393}
394
395
396
397UseTmpfs()
398{
399    local mount_cmd
400    echo -en "Mounting /tmp/tmpfs..."
401    mkdir -p /tmp/tmpfs
402# For technical reasons, some sets are as large as 16MB.
403# I am allowing 32MB because selective restore occupies a lot of space.
404    for size in 64m 48m 40m 32m ; do
405        mount_cmd="mount /dev/shm -t tmpfs -o size=$size" ; # was 34m until 04/2003
406        LogIt "Trying '$mount_cmd'"
407    $mount_cmd /tmp/tmpfs 2>> $LOGFILE
408    res=$?
409    [ "$res" -eq "0" ] && break
410    done
411    if [ "$res" -ne "0" ] ; then
412        LogIt "Failed. I could not run '$mount_cmd /tmp/tmpfs'. Your kernel is BROKEN or you do not have enough RAM." 1
413        umount /tmp/tmpfs > /dev/null 2> /dev/null
414    rmdir /tmp/tmpfs
415        ln -sf /mnt/RESTORING/tmp /tmp/tmpfs; # used by mondo-restore
416    LogIt "Failed to mount /tmp/tmpfs; using ugly softlink instead"
417    else
418        LogIt "Great. Pivot succeeded w/ size=$size" 1
419        echo -en "Pivoting /tmp..."
420        umount /tmp/tmpfs
421        mkdir -p /tmp.old
422        mv -f /tmp/* /tmp.old/
423        $mount_cmd /tmp
424        mv /tmp.old/* /tmp/
425        rmdir /tmp.old
426        mkdir -p /tmp/tmpfs
427        mkdir -p $GROOVY
428    echo "Done."
429    LogIt "Successfully mounted dynamic /tmp ramdisk"
430#   mkdir -p /tmp/tmpfs/var
431#        mv -f /var/log /tmp/tmpfs/var/log
432#        ln -sf /tmp/tmpfs/var/log /var/log
433    fi
434}
435
436
437WelcomeMessage()
438{
439    echo "********************************************************************"
440    echo "MINDI-LINUX by Mondo Dev Team - web site: http://www.mondorescue.org"
441    echo "Boot disk based on AlfaLinux & Trinux. BusyBox by Erik Andersen."
442which petris > /dev/null 2> /dev/null && echo "Petris was written by Peter Seidler <p.seidler@mail1.stofanet.dk>."
443    echo "Executables and source code are covered by the GNU GPL. No warranty."
444    echo "running on $ARCH"
445    echo "********************************************************************"
446}
447
448
449EnableCcissIfAppropriate() {
450    local i fname
451    for i in 0 1 2 3 ; do
452        fname="/proc/driver/cciss/cciss$i"
453        if [ -e "$fname" ] ; then
454            LogIt "Engaging $fname"
455            echo "engage scsi" > $fname
456            LogIt "...result=$?"
457        fi
458    done
459}
460
461
462ExtractDataDisksAndLoadModules() {
463    echo "Installing additional tools ..."
464    install-additional-tools
465    echo "Inserting modules ..."
466    # Keep the kernel silent again
467    PKLVL=`cut -f1 /proc/sys/kernel/printk`
468    echo 0 > /proc/sys/kernel/printk
469    insert-all-my-modules >> $LOGFILE 2>> $LOGFILE
470    echo $PKLVL > /proc/sys/kernel/printk
471}
472
473# ------------------------ main -----------------------
474
475MINDI_VER=PBVER
476MINDI_REV=PBREV
477trap CaughtSoftReset SIGTERM
478LOGFILE=/var/log/mondorestore.log
479PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/mondo:/usr/games
480GROOVY=/tmp/groovy-stuff
481USER=root
482export PATH GROOVY USER LOGFILE
483
484echo "Welcome to init (from mindi ${MINDI_VER}-r${MINDI_REV})"
485
486mount -o remount rw /
487[ ! "$GROOVY" ] && Die "I'm not groovy!"
488for i in $GROOVY /mnt/floppy /mnt/cdrom /mnt/isodir /var/local/petris /tmp/isodir; do
489    mkdir -p $i
490done
491#/bin/update
492mount /proc/ /proc -v -t proc
493mkdir /sys 2> /dev/null
494mount /sys/ /sys -v -t sysfs 2>> $LOGFILE
495rm -f /foozero
496
497if [ -f /proc/sys/kernel/exec-shield ]; then
498    echo 0 > /proc/sys/kernel/exec-shield 2>> /dev/null
499fi
500
501if [ -f /proc/modules ]; then
502    echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
503fi
504
505if [ -e "/tmp/USE-UDEV" ] ; then
506    RunUdevd
507else
508    ExtractDevTarballs
509fi
510LaunchTerminals
511
512# Keeping kernel silent  for module insertion
513PKLVL=`cut -f1 /proc/sys/kernel/printk`
514echo 0 > /proc/sys/kernel/printk
515InsertEssentialModules
516echo $PKLVL > /proc/sys/kernel/printk
517
518EnableCcissIfAppropriate
519#-------------------------------
520#WHOLIVESINAPINEAPPLEUNDERTHESEA#;# --- don't touch this :)
521#-------------------------------
522UseTmpfs
523if [ ! -e "/tmp/mondo-restore.cfg" ] ; then
524    LogIt "Warning - /tmp/mondo-restore.cfg not found"
525fi
526
527if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ]; then
528    HandleTape
529    ExtractDataDisksAndLoadModules
530elif [ "`grep -i pxe /proc/cmdline`" ]; then
531    # We need to get here exported variables from start-nfs
532    . /sbin/start-nfs
533
534    # Simulate a local CD
535    echo "/mnt/cdrom" > /tmp/CDROM-LIVES-HERE
536    CD_MOUNTED_OK=yes
537    ExtractDataDisksAndLoadModules
538elif [ "`grep -i usb= /proc/cmdline`" ] || [ "`grep -i usb /tmp/mondo-restore.cfg | grep media-type`" ]; then
539    # We need to get here exported variables from start-nfs
540    . /sbin/start-usb
541
542    # Simulate a local CD
543    echo "/mnt/cdrom" > /tmp/CDROM-LIVES-HERE
544    CD_MOUNTED_OK=yes
545    ExtractDataDisksAndLoadModules
546else
547    HandleCDROMorFloppies
548    ExtractDataDisksAndLoadModules
549    # We need to get here exported variables from start-nfs
550    . /sbin/start-nfs
551fi
552res=$?
553ConfigureLoggingDaemons
554if [ -e "/tmp/USE-DEVFS" ] ; then
555    umount /mnt/cdrom 2> /dev/null
556    mv /dev/cdrom /cdrom.lnk 2> /dev/null
557    CD_MOUNTED_OK=""
558    RunDevfsd
559fi
560echo "Starting potential Raid/LVMs ..."
561PauseForRaids
562StartRaids
563StartLvms
564CopyBootDevEntry
565LoadKeymap
566mkdir -p /tmp/tmpfs
567sleep 2
568#clear
569if [ -e "/dev/md0" ] && [ ! -e "/dev/md/0" ] && [ "`grep /dev/md/ /tmp/mountlist.txt`" != "" ] ; then
570    LogIt "Creating /dev/md/* softlinks just in case." 1
571    mkdir -p /dev/md
572    cp -af /dev/md0 /dev/md/0 2> /dev/null
573    cp -af /dev/md1 /dev/md/1 2> /dev/null
574    cp -af /dev/md2 /dev/md/2 2> /dev/null
575fi
576export ARCH=`uname -m`
577WelcomeMessage
578# SpaceTests; # Mandrake Linux 8.1 doesn't like this
579[ -e "/tmp/mountlist.txt" ] && cp -f /tmp/mountlist.txt /tmp/mountlist.original
580
581if ! [ "`grep -i "pxe" /proc/cmdline`" ] ; then
582    res="`cat /mnt/cdrom/archives/THIS-CD-NUMBER 2> /dev/null`"
583    [ "$res" != "1" ] && [ "$res" != "" ] && Die "This is CD #$res in the series. Please insert CD #1."
584    [ -e "/cdrom.lnk" ] && mv -f /cdrom.lnk /dev/cdrom && mount /dev/cdrom /mnt/cdrom && CD_MOUNTED_OK=yes
585    [ "$CD_MOUNTED_OK" != "yes" ] && TryAgainToFindCD
586    #mount | grep cdrom > /dev/null 2> /dev/null || mount /dev/cdrom /mnt/cdrom >> $LOGFILE 2>> $LOGFILE
587fi
588hack-cfg-if-necessary || LogIt "Cannot find hack-cfg-if-necessary"
589openvt 8 /usr/bin/tail -f $LOGFILE
590
591# Log some useful info
592LogIt "init (from mindi v$MINDI_VER-r${MINDI_REV}"
593LogIt "/proc/cmdline is:"
594cat /proc/cmdline  >> $LOGFILE
595LogIt "df result:"
596LogIt "----------"
597df >> $LOGFILE
598LogIt "-------------"
599LogIt "mount result:"
600LogIt "-------------"
601mount >> $LOGFILE
602LogIt "-------------"
603LogIt "lsmod result:"
604LogIt "-------------"
605lsmod >> $LOGFILE
606LogIt "-------------"
607LogIt "dmesg result:"
608LogIt "-------------"
609dmesg >> $LOGFILE
610
611#-------------------------------
612#ABSORBENTANDYELLOWANDPOROUSISHE#;# --- don't touch this either :)
613#-------------------------------
614
615#ctrlaltdel soft
616for path in /usr.bin /usr/bin ; do
617    fname=$path/nano
618    [ -e "$fname" ] && ln -sf $fname /usr/bin/pico
619done
620res=`which nano 2> /dev/null`
621[ "$res" ] && ln -sf /usr/bin/
622for i in null stdout stdin stderr ; do
623    cp -af /dev/$i /tmp
624done
625if grep "backup-media-type" /tmp/mondo-restore.cfg > /dev/null 2> /dev/null ; then
626    LogIt "backup-media-type is specified in config file - great."
627    LogIt "Calling post-init $mountlist"
628    post-init
629else
630    LogIt "backup-media-type is not specified in config file."
631    LogIt "I think this CD/floppy has no archives on it."
632fi
633if grep "RESTORE" /proc/cmdline > /dev/null 2> /dev/null ; then
634    echo "Rebooting in 10 seconds automatically as per reboot order"
635    echo -en "Press ^C to interrupt if you have to ..."
636    for i in 1 2 3 4 5 6 7 8 9 10 ; do
637        sleep 1
638        echo -en "."
639    done
640    echo "Boom."
641    sleep 1
642else
643    echo -en "Type 'exit' to reboot the PC\n"
644    umount /mnt/cdrom 2> /dev/null
645    mount / -o rw,remount > /dev/null 2> /dev/null
646    LogIt "Launching Shell"
647    sh
648fi
649CaughtSoftReset
650# reboot
Note: See TracBrowser for help on using the repository browser.