Changeset 764 in MondoRescue for trunk/mindi/rootfs/sbin/init


Ignore:
Timestamp:
Aug 8, 2006, 12:34:37 AM (18 years ago)
Author:
Bruno Cornec
Message:

merge -r728:763 $SVN_M/branches/stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mindi/rootfs/sbin/init

    r649 r764  
    11#!/bin/sh
    22#
    3 # 04/20/2005
    4 # - fix for 'skip the tape datadisks' bug (Joseph Smith)
     3# $Id$
    54#
    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 #
     5# init script launched during the restore process
    1606#------------------------------------------------------------
    1617
     
    23278    openvt 6 /bin/sh
    23379    openvt 7 /bin/sh /sbin/wait-for-petris
    234 #    openvt 8 /usr/bin/tail -f /tmp/mondo-restore.log
    23580}
    23681
     
    385230    LogIt "Devfs found. Testing kernel support..."
    386231    if [ ! -e "/dev/.devfsd" ] ; then
    387         mount -t devfs devfs /dev 2>> /tmp/mondo-restore.log
     232        mount -t devfs devfs /dev 2>> $LOGFILE
    388233            if [ "$?" -ne "0" ] ; then
    389234        LogIt "Error while trying to mount devfs"
     
    441286    if [ -e "/tmp/i-want-my-lvm" ] ; then
    442287        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
     288        if which lvm ; then
     289            MyInsmod dm-mod
     290            MyInsmod dm_mod
     291            lvm vgscan --mknodes
     292        else
     293            vgscan
     294        fi
     295        grep -E "^#.*vgchange" /tmp/i-want-my-lvm | sed "s/^#[ ]*//" > /tmp/start-lvm
    451296        chmod +x /tmp/start-lvm
    452297        echo -en "Starting LVM's..."
     
    461306# pipe vgscan's output, strip it, run 'vgchange' on its output, etc.etc.
    462307    LogIt "LVM's have been started."
    463 }
    464 
    465 
    466 
    467 StartNfs() {
    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
    479308}
    480309
     
    539368        mount_cmd="mount /dev/shm -t tmpfs -o size=$size" ; # was 34m until 04/2003
    540369        LogIt "Trying '$mount_cmd'"
    541     $mount_cmd /tmp/tmpfs 2>> /tmp/mondo-restore.log
     370    $mount_cmd /tmp/tmpfs 2>> /$LOGFILE
    542371    res=$?
    543372    [ "$res" -eq "0" ] && break
     
    635464fi
    636465
    637 #if [ -e "/tmp/2880.siz" ] ; then
    638 #    HandleCDROMorFloppies
    639 #el
    640466if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ] ; then
    641         HandleTape
     467    HandleTape
    642468    ExtractDataDisksAndLoadModules
    643 elif [ -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
     469elif [ "`grep -i pxe /proc/cmdline`" ]; then
     470    /sbin/start-nfs
     471
    663472    # Simulate a local CD
    664473    echo "/mnt/cdrom" > /tmp/CDROM-LIVES-HERE
    665         CD_MOUNTED_OK=yes
     474    CD_MOUNTED_OK=yes
    666475    ExtractDataDisksAndLoadModules
    667476else
    668477    HandleCDROMorFloppies
    669478    ExtractDataDisksAndLoadModules
    670     if [ -e "/sbin/start-nfs" ]; then
    671         StartNfs
    672     fi
     479    /sbin/start-nfs
    673480fi
    674481res=$?
     
    710517fi
    711518hack-cfg-if-necessary || LogIt "Cannot find hack-cfg-if-necessary"
    712 openvt 8 /usr/bin/tail -f /tmp/mondo-restore.log
     519openvt 8 /usr/bin/tail -f $LOGFILE
    713520
    714521#-------------------------------
Note: See TracChangeset for help on using the changeset viewer.