Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Better output for mindi-busybox revision
  • Remove dummy file created on NFS - report from Arnaud Tiger <arnaud.tiger_at_hp.com>
  • strace useful for debug
  • fix new versions for pb (2.0.0 for mindi and 1.7.2 for mindi-busybox)
  • fix build process for mindi-busybox + options used in that version (dd for label-partitions-as-necessary)
  • fix typo in label-partitions-as-necessary which doesn't seem to work
  • Update to busybox 1.7.2
  • perl is now required at restore time to support uuid swap partitions (and will be used for many other thigs

in the future for sure)

  • next mindi version will be 2.0.0 due to all the changes made in it (udev may break working distros)
  • small optimization in mindi on keyboard handling (one single find instead of multiple)
  • better interaction for USB device when launching mindi manually
  • attempt to automatically guess block disk size for ramdisk
  • fix typos in bkphw
  • Fix the remaining problem with UUID support for swap partitions
  • Updates mondoarchive man page for USB support
  • Adds preliminary Hardware support to mindi (Proliant SSSTK)
  • Tries to add udev support also for rhel4
  • Fix UUID support which was still broken.
  • Be conservative in test for the start-nfs script
  • Update config file for mindi-busybox for 1.7.2 migration
  • Try to run around a busybox bug (1.2.2 pb on inexistant links)
  • Add build content for mindi-busybox in pb
  • Remove distributions content for mindi-busybox
  • Fix a warning on inexistant raidtab
  • Solve problem on tmpfs in restore init (Problem of inexistant symlink and busybox)
  • Create MONDO_CACHE and use it everywhere + creation at start
  • Really never try to eject a USB device
  • Fix a issue with &> usage (replaced with 1> and 2>)
  • Adds magic file to depllist in order to have file working + ldd which helps for debugging issues
  • tty modes correct to avoid sh error messages
  • Use ext3 normally and not ext2 instead
  • USB device should be corrected after reading (take 1st part)
  • Adds a mount_USB_here function derived from mount_CDROM_here
  • usb detection place before /dev detection in device name at restore time
  • Fix when restoring from USB: media is asked in interactive mode
  • Adds USB support for mondorestore
  • mount_cdrom => mount_media
  • elilo.efi is now searched throughout /boot/efi and not in a fixed place as there is no standard
  • 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
  • Adds group and tty link to udev conf
  • Always load usb-torage (even 2.6) to initiate USB bus discovery
  • Better printing of messages
  • Attempt to fix a bug in supporting OpenSusE 10.3 kernel for initramfs (mindi may now use multiple regex for kernel initrd detection)
  • Links were not correctly done as non relative for modules in mindi
  • exclusion of modules denied now works
  • Also create modules in their ordinary place, so that classical modprobe works + copy modules.dep
  • Fix bugs for DENY_MODS handling
  • Add device /dev/console for udev
  • ide-generic should now really be excluded
  • Fix a bug in major number for tty
  • If udev then adds modprobe/insmod to rootfs
  • tty0 is also cretaed with udev
  • ide-generic put rather in DENY_MODS
  • udevd remove from deplist s handled in mindi directly
  • better default for mindi when using --usb
  • Handles dynamically linked busybox (in case we want to use it soon ;-)
  • Adds fixed devices to create for udev
  • ide-generic should not be part of the initrd when using libata v2
  • support a dynamically linked udev (case on Ubuntu 7.10 and Mandriva 2008.0 so should be quite generic) This will give incitation to move to dyn. linked binaries in the initrd which will help for other tasks (ia6 4)
  • Improvement in udev support (do not use cl options not available in busybox)
  • Udev in mindi
    • auto creation of the right links at boot time with udev-links.conf(from Mandriva 2008.0)
    • rework startup of udev as current makes kernel crash (from Mandriva 2008.0)
    • add support for 64 bits udev
  • Try to render MyInsmod? silent at boot time
  • Adds udev support (mandatory for newest distributions to avoid remapping of devices in a different way as on the original system)
  • We also need vaft format support for USB boot
  • Adds libusual support (Ubuntu 7.10 needs it for USB)
  • Improve Ubuntu/Debian? keyboard detection and support
  • pbinit adapted to new pb (0.8.10). Filtering of docs done in it
  • Suppress some mondo warnings and errors on USB again
  • Tries to fix lack of files in deb mindi package
  • Verify should now work for USB devices
  • More log/mesages improvement for USB support
  • - Supress g_erase_tmpdir_and_scratchdir
  • Improve some log messages for USB support
  • Try to improve install in mindi to avoid issues with isolinux.cfg not installed vene if in the pkg :-(
  • Improve mindi-busybox build
  • In conformity with pb 0.8.9
  • Add support for Ubuntu 7.10 in build process
  • Add USB Key button to Menu UI (CD streamer removed)
  • Attempt to fix error messages on tmp/scratch files at the end by removing those dir at the latest possible.
  • Fix a bug linked to the size of the -E param which could be used (Arnaud Tiger/René? Ribaud).
  • Integrate ~/.pbrc content into mondorescue.pb (required project-builder >= 0.8.7)
  • Put mondorescue in conformity with new pb filtering rules
  • Add USB support at restore time (no test done yet). New start-usb script PB varibale added where useful
  • Unmounting USB device before removal of temporary scratchdir
  • Stil refining USB copy back to mondo (one command was not executed)
  • No need to have the image subdor in the csratchdir when USB.
  • umount the USB partition before attempting to use it
  • Remove useless copy from mindi to mondo at end of USB handling

(risky merge, we are raising the limits of 2 diverging branches. The status of stable is not completely sure as such. Will need lots of tests, but it's not yet done :-()
(merge -r1692:1769 $SVN_M/branches/2.2.5)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi/rootfs/sbin/init

    r1675 r1770  
    88
    99CaughtSoftReset() {
    10     trap SIGTERM
    11     reboot
     10    trap SIGTERM
     11    reboot
    1212}
    1313
    1414
    1515ConfigureLoggingDaemons() {
    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."
     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."
    2222}
    2323
     
    2525
    2626CopyBootDevEntry() {
    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
     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
    3333    echo "OK."
    3434    return 0
    35     fi
    36     mkdir -p $outfile
    37     rmdir $outfile
    38     cp -pRdf $devfile $outfile
    39     if [ "$?" -ne "0" ] ; then
     35    fi
     36    mkdir -p $outfile
     37    rmdir $outfile
     38    cp -pRdf $devfile $outfile
     39    if [ "$?" -ne "0" ] ; then
    4040    echo "Failed."
    4141    return 1
    42     else
     42    else
    4343    echo "OK."
    4444    return 0
    45     fi
     45    fi
    4646}
    4747
     
    4949
    5050Die() {
    51     LogIt "Fatal error! $1" 1
    52     exit 1
     51    LogIt "Fatal error! $1" 1
     52    exit 1
    5353}
    5454
     
    5656
    5757ExtractDevTarballs() {
    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
     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
    6969}
    7070
     
    7272
    7373LaunchTerminals() {
    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
     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
    8080}
    8181
    8282
    8383LoadKeymap() {
    84     local fname
    85     fname=`grep keymap-lives-here /tmp/mondo-restore.cfg | cut -d'=' -f2 2> /dev/null`
    86     [ "$fname" = "" ] && return
    87     if which loadkeys > /dev/null 2> /dev/null ; then
    88         loadkeys $fname
     84    local fname
     85    fname=`grep keymap-lives-here /tmp/mondo-restore.cfg | cut -d'=' -f2 2> /dev/null`
     86    [ "$fname" = "" ] && return
     87    if which loadkeys > /dev/null 2> /dev/null ; then
     88        loadkeys $fname
    8989# loadkmap != loadkeys
    9090#    elif which loadkmap > /dev/null 2> /dev/null ; then
    9191#        loadkmap < $fname
    92     else
    93         LogIt "Using default keyboard map." 1
    94     fi
     92    else
     93        LogIt "Using default keyboard map." 1
     94    fi
    9595}
    9696
    9797
    9898UntarTapeStuff() {
    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`
     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`
    104104#    tar -zxf $tapedev
    105     dd if=$tapedev bs=32k count=1024 | tar -zx
    106     res=$?
    107     if [ "$res" -eq "0" ] ; then
     105    dd if=$tapedev bs=32k count=1024 | tar -zx
     106    res=$?
     107    if [ "$res" -eq "0" ] ; then
    108108    grep -v media-dev /tmp/mondo-restore.cfg > /tmp/mr.cfg
    109109    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
     110        cp -f /tmp/mr.cfg /tmp/mondo-restore.cfg
     111    fi
     112    cd $old_pwd
     113    return $res
    114114}
    115115
    116116HandleTape() {
    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." 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
     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
    135135        break
    136         fi
    137     done
    138 
    139     if [ "$res" -ne "0" ] ; then
     136        fi
     137    done
     138
     139    if [ "$res" -ne "0" ] ; then
    140140        cd /
    141141        LogIt "Failed to use tape as extended datadisk. Reverting to cd." 1
    142142        HandleCDROM
    143143        res=$?
    144     else
     144    else
    145145    #   clear
    146146        LogIt "Using tape as extended datadisk. Good." 3
    147147        echo "Using tape as extd ddisk." > /tmp/TAPEDEV-HAS-DATA-DISKS
    148148        res=0
    149         CD_MOUNTED_OK=yes
    150     fi
    151     return $res
     149        CD_MOUNTED_OK=yes
     150    fi
     151    return $res
    152152}
    153153
     
    155155
    156156HHandleCDROM() {
    157     find-and-mount-cdrom
    158     res=$?
    159     if [ "$res" -ne "0" ] ; then
     157    find-and-mount-cdrom
     158    res=$?
     159    if [ "$res" -ne "0" ] ; then
    160160        LogIt "First call to find-and-mount-cdrom failed." 1
    161161        LogIt "Sleeping for 3 seconds and trying again." 1
     
    163163        find-and-mount-cdrom
    164164        res=$?
    165     fi
    166     if [ "$res" -eq "0" ] ; then
     165    fi
     166    if [ "$res" -eq "0" ] ; then
    167167        LogIt "OK, I am running on a CD-ROM. Good." 3
    168         CD_MOUNTED_OK=yes
    169     else
     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
    170173        LogIt "OK, I am unable to go on. You seem to be missing a driver" 3
    171174        LogIt "Your archives are probably fine but" 3
    172175        LogIt "your tape streamer and/or CD-ROM drive are eccentric. :-)" 3
    173176        CD_MOUNTED_OK=""
    174     fi
    175     return 0
     177    fi
     178    return 0
    176179}
    177180
     
    186189#   Load the VIA IDE module first thing if it exists (requires ide-core).
    187190#   This is to ensure that DMA is working for VIA chipsets with 2.6 kernels.
    188     for module in /ide-core.ko /via82cxxx.ko; do
    189         [ -f "$module" ] && MyInsmod $module > /dev/null 2> /dev/null
    190     done
     191    for module in /ide-core.ko /via82cxxx.ko; do
     192        [ -f "$module" ] && MyInsmod $module > /dev/null 2> /dev/null
     193    done
    191194#   Then load the remaining modules in normal (i.e. arbitrary) order.
    192     for j in 1 2 3 4 5 ; do
    193         for i in `ls /*.*o* 2> /dev/null` ; do
    194             [ -f "$i" ] && MyInsmod $i > /dev/null 2> /dev/null
    195         done
    196     done
     195    for j in 1 2 3 4 5 ; do
     196        for i in `ls /*.*o* 2> /dev/null` ; do
     197            [ -f "$i" ] && MyInsmod $i > /dev/null 2> /dev/null
     198        done
     199    done
    197200}
    198201
     
    200203
    201204PauseForRaids() {
    202     if [ "`dmesg | grep -i "RAID Controller"`" != "" ] || [ "`dmesg | grep -i "Vendor: 3ware"`" != "" ] ; then
    203         LogIt "RAID controller(s) detected. Pausing 10 seconds to let them warm up." 1
    204         echo -en "Pausing..."
    205         for i in 1 2 3 4 5 6 7 8 9 10 ; do
    206             sleep 1
    207             echo -en "$(($i*10))%..."
    208         done
    209         echo "Done."
    210     fi
     205    if [ "`dmesg | grep -i "RAID Controller"`" != "" ] || [ "`dmesg | grep -i "Vendor: 3ware"`" != "" ] ; then
     206        LogIt "RAID controller(s) detected. Pausing 10 seconds to let them warm up." 1
     207        echo -en "Pausing..."
     208        for i in 1 2 3 4 5 6 7 8 9 10 ; do
     209            sleep 1
     210            echo -en "$(($i*10))%..."
     211        done
     212        echo "Done."
     213    fi
    211214}
    212215
     
    217220#                config file path compiled into devfsd
    218221RunDevfsd() {
    219     loc=`which devfsd 2> /dev/null`
    220     if [ "$loc" != "" ] ; then
     222    loc=`which devfsd 2> /dev/null`
     223    if [ "$loc" != "" ] ; then
    221224    LogIt "Devfs found. Testing kernel support..."
    222225    if [ ! -e "/dev/.devfsd" ] ; then
    223226        mount -t devfs devfs /dev 2>> $LOGFILE
    224             if [ "$?" -ne "0" ] ; then
     227            if [ "$?" -ne "0" ] ; then
    225228        LogIt "Error while trying to mount devfs"
    226229        else
     
    242245        LogIt "No devfs kernel support."
    243246    fi
    244     fi
    245 }
    246 
    247 
    248 
    249 
     247    fi
     248}
     249
     250# Taken from udev management in Mandriva 2008.0. Kudos guys
     251make_extra_nodes () {
     252    # there are a few things that sysfs does not export for us.
     253    # these things are listed in /etc/udev/links.conf
     254    grep '^[^#]' /etc/udev-links.conf | \
     255    while read type name arg1; do
     256        [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue
     257        case "$type" in
     258            L) ln -s $arg1 /dev/$name ;;
     259            D) mkdir -p /dev/$name ;;
     260            M) mknod /dev/$name $arg1 && chmod 600 /dev/$name;;
     261            *) echo "udev-links.conf: unparseable line (%s %s %s)\n" "$type" "$name" "$arg1" ;;
     262        esac
     263    done
     264}
     265
     266
     267RunUdevd() {
     268    # Inspiration from Mandriva 2008.0 startup script
     269    echo "Preparing udev environment..."
     270    mv /dev /dev.static
     271    mkdir /dev
     272    mount -n -o size=5M,mode=0755 -t tmpfs none /dev
     273    make_extra_nodes
     274    mount -n -t devpts -o mode=620 none /dev/pts
     275    mount -n -t tmpfs  none /dev/shm
     276    PKLVL=`cut -f1 /proc/sys/kernel/printk`
     277    echo 0 > /proc/sys/kernel/printk
     278    if [ -x /sbin/startudev ]; then
     279        /sbin/startudev
     280    fi
     281    # Depending on udevd version it gives back the hand or not :-(
     282    /sbin/udevd --daemon &
     283    sleep 2
     284    echo $PKLVL > /proc/sys/kernel/printk
     285    # May avoid shell error messages
     286    chmod 644 /dev/tty*
     287}
     288
     289RstHW() {
     290
     291    # Restore the HW configuration if available (NOT by default)
     292    answer="NO"
     293
     294    if [ -x ./mindi-rsthw ]; then
     295        grep -q RESTORE /proc/cmdline
     296        if [ "$?" -ne 0 ]; then
     297            clear
     298            echo "*********************************************************************"
     299            echo "Do you want to restore the HW configuration of the original machine ?"
     300            echo "(This may dammage your hardware so be sure to check twice before saying yes)"
     301            echo "*********************************************************************"
     302            echo "Please confirm by typing YES exactly as written here (NO by default)"
     303            echo -n "--> "
     304            read answer
     305        else
     306            answer="YES"
     307        fi
     308        if [ "$answer" -eq "YES" ] ; then
     309            ./mindi-rsthw
     310        fi
     311    fi
     312}
    250313
    251314
     
    262325
    263326SpaceTests() {
    264     [ -e "/tmp/filelist.full" ] && cp /tmp/filelist.full /tmp/FLF
    265     if [ "`HowMuchFreeSpaceOnRamdisk`" -le "3" ] ; then
    266         LogIt "Ramdisk is a bit smaller than I would like." 1
    267         LogIt "Please re-run Mondo/Mindi but edit mindi first" 1
    268         LogIt "and set EXTRA_SPACE to something high, e.g. 8000" 1
    269         Die "Aborting. Please reboot."
    270     fi
    271     rm -f /tmp/FLF
     327    [ -e "/tmp/filelist.full" ] && cp /tmp/filelist.full /tmp/FLF
     328    if [ "`HowMuchFreeSpaceOnRamdisk`" -le "3" ] ; then
     329        LogIt "Ramdisk is a bit smaller than I would like." 1
     330        LogIt "Please re-run Mondo/Mindi but edit /usr/local/mindi first" 1
     331        LogIt "and set EXTRA_SPACE to something high, e.g. 8000" 1
     332        Die "Aborting. Please reboot."
     333    fi
     334    rm -f /tmp/FLF
    272335}
    273336
     
    275338
    276339StartLvms() {
    277     if [ -e "/tmp/i-want-my-lvm" ] ; then
    278         LogIt "Scanning LVM's..." 1
     340    if [ -e "/tmp/i-want-my-lvm" ] ; then
     341        LogIt "Scanning LVM's..." 1
    279342        if which lvm ; then
    280343            MyInsmod dm-mod
     
    284347            vgscan
    285348        fi
    286         grep -E "^#.*vgchange" /tmp/i-want-my-lvm | sed "s/^#[ ]*//" > /tmp/start-lvm
    287         chmod +x /tmp/start-lvm
    288         echo -en "Starting LVM's..."
    289         /tmp/start-lvm &
    290         for i in 1 2 3 4 5 ; do
     349        grep -E "^#.*vgchange" /tmp/i-want-my-lvm | sed "s/^#[ ]*//" > /tmp/start-lvm
     350        chmod +x /tmp/start-lvm
     351        echo -en "Starting LVM's..."
     352        /tmp/start-lvm &
     353        for i in 1 2 3 4 5 ; do
    291354        echo -en "."
    292355        sleep 1
    293         done
    294         echo "Done."
    295     fi
     356        done
     357        echo "Done."
     358    fi
    296359# If necessary, cannibalize 'analyze-my-lvm'; copy some of its code here,
    297360# pipe vgscan's output, strip it, run 'vgchange' on its output, etc.etc.
    298     LogIt "LVM's have been started."
     361    LogIt "LVM's have been started."
    299362}
    300363
    301364
    302365StartRaids() {
    303     local raid_devices i
    304 
    305     raid_devices=`grep /dev/md /tmp/mountlist.txt | cut -d' ' -f1`
     366    local raid_devices i
     367
     368    raid_devices=`grep /dev/md /tmp/mountlist.txt | cut -d' ' -f1`
    306369    if which raidstart > /dev/null 2> /dev/null ; then
    307         for i in $raid_devices ; do
    308             if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
    309                 LogIt "$i is started already; no need to run 'raidstart $i'" 1
    310             else
     370        for i in $raid_devices ; do
     371            if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
     372                LogIt "$i is started already; no need to run 'raidstart $i'" 1
     373            else
    311374                LogIt "Running 'raidstart $i'" 1
    312375                raidstart $i
    313             fi
    314         done
     376            fi
     377        done
    315378    elif which mdrun > /dev/null 2> /dev/null ; then
    316379        LogIt "Running 'mdrun'" 1
     
    319382        LogIt "Running 'mdadm'" 1
    320383        for i in $raid_devices ; do
    321             if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
    322                 LogIt "$i is started already; no need to run 'mdadm $i'" 1
    323             else
     384            if grep `basename $i` /proc/mdstat > /dev/null 2> /dev/null ; then
     385                LogIt "$i is started already; no need to run 'mdadm $i'" 1
     386            else
    324387                if [ -f /etc/mdadm.conf ] ; then
    325388                    LogIt "Running 'mdadm $i' with user supplied /etc/mdadm.conf" 1
     
    332395                    mdadm -Ac partitions -m dev $i
    333396                fi
    334             fi
    335         done
     397            fi
     398        done
    336399    else
    337400        LogIt "Warning: Neither 'raidstart' nor 'mdrun''found. RAID devices may not have started." 1
     
    342405
    343406TryAgainToFindCD() {
    344     local res
    345     mount | grep /mnt/cdrom && return 0
    346     [ "`grep "backup_media_type" /tmp/mondo-restore.cfg | grep "cdstream"`" ] && return
    347     LogIt "Trying to mount CD-ROM a 2nd time..."
    348     find-and-mount-cdrom --second-try
    349     res=$?
    350     if [ "$res" -eq "0" ] ; then
    351         CD_MOUNTED_OK=yes
    352         LogIt "CD-ROM drive mounted successfully." 1
    353     else
    354         LogIt "I still cannot find or mount the CD-ROM drive, by the way."
    355     fi
     407    local res
     408    mount | grep /mnt/cdrom && return 0
     409    [ "`grep "backup_media_type" /tmp/mondo-restore.cfg | grep "cdstream"`" ] && return
     410    LogIt "Trying to mount CD-ROM a 2nd time..."
     411    find-and-mount-cdrom --second-try
     412    res=$?
     413    if [ "$res" -eq "0" ] ; then
     414        CD_MOUNTED_OK=yes
     415        LogIt "CD-ROM drive mounted successfully." 1
     416    else
     417        LogIt "I still cannot find or mount the CD-ROM drive, by the way."
     418    fi
    356419}
    357420
     
    360423UseTmpfs()
    361424{
    362     local mount_cmd
    363     echo -en "Mounting /tmp/tmpfs..."
    364     mkdir -p /tmp/tmpfs
     425    local mount_cmd
     426    echo -en "Mounting /tmp/tmpfs..."
     427    mkdir -p /tmp/tmpfs
    365428# For technical reasons, some sets are as large as 16MB.
    366429# I am allowing 32MB because selective restore occupies a lot of space.
    367     for size in 64m 48m 40m 32m ; do
    368         mount_cmd="mount /dev/shm -t tmpfs -o size=$size" ; # was 34m until 04/2003
    369         LogIt "Trying '$mount_cmd'"
     430    for size in 64m 48m 40m 32m ; do
     431        mount_cmd="mount /dev/shm -t tmpfs -o size=$size" ; # was 34m until 04/2003
     432        LogIt "Trying '$mount_cmd'"
    370433        $mount_cmd /tmp/tmpfs 2>> $LOGFILE
    371434        res=$?
    372435        [ "$res" -eq "0" ] && break
    373     done
    374     if [ "$res" -ne "0" ] ; then
    375         LogIt "Failed. I could not run '$mount_cmd /tmp/tmpfs'. Your kernel is BROKEN or you do not have enough RAM." 1
    376         umount /tmp/tmpfs > /dev/null 2> /dev/null
     436    done
     437    if [ "$res" -ne "0" ] ; then
     438        LogIt "Failed. I could not run '$mount_cmd /tmp/tmpfs'. Your kernel is BROKEN or you do not have enough RAM." 1
     439        umount /tmp/tmpfs > /dev/null 2> /dev/null
    377440        rmdir /tmp/tmpfs
    378         ln -sf /mnt/RESTORING/tmp /tmp/tmpfs; # used by mondo-restore
     441        ln -sf /mnt/RESTORING/tmp /tmp/tmpfs; # used by mondo-restore
    379442        LogIt "Failed to mount /tmp/tmpfs; using ugly softlink instead"
    380     else
    381         LogIt "Great. Pivot succeeded w/ size=$size" 1
    382         echo -en "Pivoting /tmp..."
    383         umount /tmp/tmpfs
    384         mkdir -p /tmp.old
    385         mv -f /tmp/* /tmp.old/
    386         $mount_cmd /tmp
    387         mv /tmp.old/* /tmp/
    388         rmdir /tmp.old
    389         mkdir -p /tmp/tmpfs
    390         mkdir -p $GROOVY
     443    else
     444        LogIt "Great. Pivot succeeded w/ size=$size" 1
     445        echo -en "Pivoting /tmp..."
     446        umount /tmp/tmpfs
     447        mkdir -p /tmp.old
     448        mv /tmp/* /tmp.old/
     449        # Try to Deal with a busybox bug on inexistant links
     450        cp /tmp/* /tmp.old/
     451        rm -f /tmp/*
     452        $mount_cmd /tmp
     453        mv /tmp.old/* /tmp/
     454        # Try to Deal with a busybox bug on inexistant links
     455        cp /tmp.old/* /tmp/
     456        rm -rf /tmp.old
     457        mkdir -p /tmp/tmpfs
     458        mkdir -p $GROOVY
    391459    echo "Done."
    392460    LogIt "Successfully mounted dynamic /tmp ramdisk"
     
    394462#        mv -f /var/log /tmp/tmpfs/var/log
    395463#        ln -sf /tmp/tmpfs/var/log /var/log
    396     fi
     464    fi
    397465}
    398466
     
    400468WelcomeMessage()
    401469{
    402     echo "********************************************************************"
    403     echo "MINDI-LINUX by Mondo Dev Team - web site: http://www.mondorescue.org"
    404     echo "Boot disk based on AlfaLinux & Trinux. BusyBox by Erik Andersen."
     470    echo "********************************************************************"
     471    echo "MINDI-LINUX by Mondo Dev Team - web site: http://www.mondorescue.org"
     472    echo "Boot disk based on AlfaLinux & Trinux. BusyBox by Erik Andersen."
    405473which petris > /dev/null 2> /dev/null && echo "Petris was written by Peter Seidler <p.seidler@mail1.stofanet.dk>."
    406     echo "Executables and source code are covered by the GNU GPL. No warranty."
    407     echo "running on $ARCH"
    408     echo "********************************************************************"
     474    echo "Executables and source code are covered by the GNU GPL. No warranty."
     475    echo "running on $ARCH"
     476    echo "********************************************************************"
    409477}
    410478
    411479
    412480EnableCcissIfAppropriate() {
    413     local i fname
    414     for i in 0 1 2 3 4 5 6 7 8 9 ; do
     481    local i fname
     482    for i in 0 1 2 3 4 5 6 7 8 9 ; do
    415483        fname="/proc/driver/cciss/cciss$i"
    416484        if [ -e "$fname" ] ; then
     
    419487            LogIt "...result=$?"
    420488        fi
    421     done
     489    done
    422490}
    423491
     
    427495    install-additional-tools
    428496    echo "Inserting modules ..."
     497    # Keep the kernel silent again
     498    PKLVL=`cut -f1 /proc/sys/kernel/printk`
     499    echo 0 > /proc/sys/kernel/printk
    429500    insert-all-my-modules >> $LOGFILE 2>> $LOGFILE
     501    echo $PKLVL > /proc/sys/kernel/printk
    430502}
    431503
    432504# ------------------------ main -----------------------
    433505
    434 MINDI_VER=VVV
    435 MINDI_REV=RRR
     506MINDI_VER=PBVER
     507MINDI_REV=PBREV
    436508trap CaughtSoftReset SIGTERM
    437509LOGFILE=/var/log/mondorestore.log
     
    446518[ ! "$GROOVY" ] && Die "I'm not groovy!"
    447519for i in $GROOVY /mnt/floppy /mnt/cdrom /mnt/isodir /var/local/petris /tmp/isodir; do
    448     mkdir -p $i
     520    mkdir -p $i
    449521done
    450522#/bin/update
     
    454526rm -f /foozero
    455527
    456 echo 0 > /proc/sys/kernel/exec-shield 2>> /dev/null
    457 
    458 ExtractDevTarballs
     528if [ -f /proc/sys/kernel/exec-shield ]; then
     529    echo 0 > /proc/sys/kernel/exec-shield 2>> /dev/null
     530fi
     531
     532if [ -f /proc/modules ]; then
     533    echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
     534fi
     535
     536if [ -e "/tmp/USE-UDEV" ] ; then
     537    RunUdevd
     538else
     539    ExtractDevTarballs
     540fi
    459541LaunchTerminals
     542
     543# Keeping kernel silent  for module insertion
     544PKLVL=`cut -f1 /proc/sys/kernel/printk`
     545echo 0 > /proc/sys/kernel/printk
    460546InsertEssentialModules
     547echo $PKLVL > /proc/sys/kernel/printk
     548
    461549EnableCcissIfAppropriate
     550RstHW
    462551#-------------------------------
    463552#WHOLIVESINAPINEAPPLEUNDERTHESEA#;# --- don't touch this :)
     
    465554UseTmpfs
    466555if [ ! -e "/tmp/mondo-restore.cfg" ] ; then
    467     LogIt "Warning - /tmp/mondo-restore.cfg not found"
    468 fi
    469 
    470 if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ] ; then
    471     HandleTape
     556    LogIt "Warning - /tmp/mondo-restore.cfg not found"
     557fi
     558
     559if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ]; then
     560    HandleTape
    472561    ExtractDataDisksAndLoadModules
    473562elif [ "`grep -i pxe /proc/cmdline`" ]; then
    474563    # We need to get here exported variables from start-nfs
    475     . /sbin/start-nfs
     564    . /sbin/start-nfs
    476565
    477566    # Simulate a local CD
    478567    echo "/mnt/cdrom" > /tmp/CDROM-LIVES-HERE
    479     CD_MOUNTED_OK=yes
     568    CD_MOUNTED_OK=yes
     569    ExtractDataDisksAndLoadModules
     570elif [ "`grep -i usb= /proc/cmdline`" ] || [ "`grep -i usb /tmp/mondo-restore.cfg | grep media-type`" ]; then
     571    # We need to get here exported variables from start-nfs
     572    . /sbin/start-usb
     573
     574    # Simulate a local CD
     575    echo "/mnt/cdrom" > /tmp/CDROM-LIVES-HERE
     576    CD_MOUNTED_OK=yes
    480577    ExtractDataDisksAndLoadModules
    481578else
     
    483580    ExtractDataDisksAndLoadModules
    484581    # We need to get here exported variables from start-nfs
    485     . /sbin/start-nfs
     582    . /sbin/start-nfs
    486583fi
    487584res=$?
    488585ConfigureLoggingDaemons
    489586if [ -e "/tmp/USE-DEVFS" ] ; then
    490     umount /mnt/cdrom 2> /dev/null
    491     mv /dev/cdrom /cdrom.lnk 2> /dev/null
    492     CD_MOUNTED_OK=""
    493     RunDevfsd
     587    umount /mnt/cdrom 2> /dev/null
     588    mv /dev/cdrom /cdrom.lnk 2> /dev/null
     589    CD_MOUNTED_OK=""
     590    RunDevfsd
    494591fi
    495592echo "Starting potential Raid/LVMs ..."
     
    503600#clear
    504601if [ -e "/dev/md0" ] && [ ! -e "/dev/md/0" ] && [ "`grep /dev/md/ /tmp/mountlist.txt`" != "" ] ; then
    505     LogIt "Creating /dev/md/* softlinks just in case." 1
    506     mkdir -p /dev/md
    507     cp -af /dev/md0 /dev/md/0 2> /dev/null
    508     cp -af /dev/md1 /dev/md/1 2> /dev/null
    509     cp -af /dev/md2 /dev/md/2 2> /dev/null
     602    LogIt "Creating /dev/md/* softlinks just in case." 1
     603    mkdir -p /dev/md
     604    cp -af /dev/md0 /dev/md/0 2> /dev/null
     605    cp -af /dev/md1 /dev/md/1 2> /dev/null
     606    cp -af /dev/md2 /dev/md/2 2> /dev/null
    510607fi
    511608export ARCH=`uname -m`
     
    550647#ctrlaltdel soft
    551648for path in /usr.bin /usr/bin ; do
    552     fname=$path/nano
    553     [ -e "$fname" ] && ln -sf $fname /usr/bin/pico
     649    fname=$path/nano
     650    [ -e "$fname" ] && ln -sf $fname /usr/bin/pico
    554651done
    555652res=`which nano 2> /dev/null`
    556653[ "$res" ] && ln -sf /usr/bin/
    557654for i in null stdout stdin stderr ; do
    558     cp -af /dev/$i /tmp
     655    cp -af /dev/$i /tmp
    559656done
    560657if grep "backup-media-type" /tmp/mondo-restore.cfg > /dev/null 2> /dev/null ; then
    561     LogIt "backup-media-type is specified in config file - great."
    562     LogIt "Calling post-init $mountlist"
    563     post-init
     658    LogIt "backup-media-type is specified in config file - great."
     659    LogIt "Calling post-init $mountlist"
     660    post-init
    564661else
    565     LogIt "backup-media-type is not specified in config file."
    566     LogIt "I think this media has no archives on it."
     662    LogIt "backup-media-type is not specified in config file."
     663    LogIt "I think this CD/floppy has no archives on it."
    567664fi
    568665if grep "RESTORE" /proc/cmdline > /dev/null 2> /dev/null ; then
Note: See TracChangeset for help on using the changeset viewer.