Changeset 2591


Ignore:
Timestamp:
Mar 11, 2010, 2:56:00 AM (10 years ago)
Author:
bruno
Message:

r3723@localhost: bruno | 2010-03-09 23:56:51 +0100

  • No error msg if mondorestore.cfg doesn't exist (mindi alone)
Location:
branches/2.2.10/mindi
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/deplist.d/minimal.conf

    r2508 r2591  
    8585/sbin/mount.ntfs
    8686/sbin/mount.ntfs-3g
     87/sbin/fstab-decode
    8788
    8889# For udev/devfs
     
    102103/sbin/create_static_dev_nodes
    103104/etc/init.d/functions
     105/etc/sysconfig/udev
     106/sbin/consoletype
    104107
    105108# Modules
  • branches/2.2.10/mindi/rootfs/sbin/find-and-mount-cdrom

    r2488 r2591  
    77    for device in /dev/hd? /dev/scd? /dev/rcd? /dev/sr? /dev/cd? /dev/ide/*/*/*/*/cd /dev/scsi/*/*/*/*/cd; do
    88        [ ! "$SECOND_TRY" ] && LogIt "Trying $device"
    9         if [ "`grep "using-cdstream yes" $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
     9        if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep "using-cdstream yes" $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
    1010            pwd=`pwd`
    1111            cd $GROOVY
     
    7575fi
    7676[ "$1" = "--second-try" ] && exit 1;
    77 if [ "`grep "using-cdstream yes" $MINDI_CACHE/mondorestore.cfg 2 > /dev/null`" ] ; then
     77if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep "using-cdstream yes" $MINDI_CACHE/mondorestore.cfg 2 > /dev/null`" ] ; then
    7878    LogIt "Because you are using cdstream, I won't try to mount CD."
    7979    exit 0
  • branches/2.2.10/mindi/rootfs/sbin/hack-cfg-if-necessary

    r2462 r2591  
    1616LogIt "OK, we've found /mnt/cdrom/archives/*; great."
    1717
    18 if ! grep "backup-media-type iso" $MINDI_CACHE/mondorestore.cfg 2 > /dev/null ; then
    19     LogIt "Config file is fine, BTW."
    20     exit 0
     18if [ -f $MINDI_CACHE/mondorestore.cfg ]; then
     19    if [ !  grep "backup-media-type iso" $MINDI_CACHE/mondorestore.cfg 2 > /dev/null] ; then
     20        LogIt "Config file is fine, BTW."
     21        exit 0
     22    fi
    2123fi
    2224
    23 LogIt "Re-jigging mondorestore.cfg because you backed up to ISOs and then burned them to CDs" 1
    24 sed -i 's/backup-media-type iso/backup-media-type cdr/' $MINDI_CACHE/mondorestore.cfg
    25 LogIt "Done re-jigging. Yay."
     25if [ -f $MINDI_CACHE/mondorestore.cfg ]; then
     26    LogIt "Re-jigging mondorestore.cfg because you backed up to ISOs and then burned them to CDs" 1
     27    sed -i 's/backup-media-type iso/backup-media-type cdr/' $MINDI_CACHE/mondorestore.cfg
     28    LogIt "Done re-jigging. Yay."
     29fi
    2630exit 0
  • branches/2.2.10/mindi/rootfs/sbin/init

    r2587 r2591  
    123123    cd $GROOVY
    124124    [ "$1" != "" ] && tapedev=$1
    125     [ ! "$tapedev" ] && tapedev=`grep media-dev $MINDI_CACHE/mondorestore.cfg 2>/dev/null | tr -s ' ' ' ' | cut -d' ' -f2`
     125    [ ! "$tapedev" ] && [ -f $MINDI_CACHE/mondorestore.cfg ] && tapedev=`grep media-dev $MINDI_CACHE/mondorestore.cfg 2>/dev/null | tr -s ' ' ' ' | cut -d' ' -f2`
    126126    mt -f $tapedev rewind
    127127    mt -f $tapedev fsf 2
     
    563563    local res
    564564    mount | grep /mnt/cdrom && return 0
    565     [ "`grep "backup_media_type" $MINDI_CACHE/mondorestore.cfg 2> /dev/null | grep "cdstream"`" ] && return
     565    [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep "backup_media_type" $MINDI_CACHE/mondorestore.cfg 2> /dev/null | grep "cdstream"`" ] && return
    566566    LogIt "Trying to mount CD-ROM a 2nd time..."
    567567    find-and-mount-cdrom --second-try
     
    719719    export DENY_MODS=" "
    720720fi
    721 if [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
     721if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
    722722    # Do not try to load usb storage when dealing with OBDR it makes the modprobe hang :-(
    723723    export DENY_MODS="usb-storage $DENY_MODS"
     
    774774fi
    775775
    776 if [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2>/dev/null`" ] || [ "`grep -i ' udev' $MINDI_CACHE/mondorestore.cfg 2>/dev/null`" ]; then
     776if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2>/dev/null`" ] || [ "`grep -i ' udev' $MINDI_CACHE/mondorestore.cfg 2>/dev/null`" ]; then
    777777    HandleTape
    778778    ExtractDataDisksAndLoadModules
     
    783783    ExtractDataDisksAndLoadModules
    784784    # Fake the conf file to force it to NFS mode, even if we made originally a CD (mandatory for mondorestore to work correctly)
    785     sed -i "s/backup-media-type.*/backup-media-type netfs/" $MINDI_CACHE/mondorestore.cfg
     785    [ -f $MINDI_CACHE/mondorestore.cfg ] && sed -i "s/backup-media-type.*/backup-media-type netfs/" $MINDI_CACHE/mondorestore.cfg
    786786elif [ "`grep -i usb= $CMDLINE`" ] || [ "`grep -i usb $MINDI_CACHE/mondorestore.cfg 2>/dev/null | grep media-type`" ]; then
    787787    . /sbin/start-usb
     
    878878    fi
    879879fi
    880 if grep "backup-media-type" $MINDI_CACHE/mondorestore.cfg > /dev/null 2> /dev/null ; then
     880if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ grep "backup-media-type" $MINDI_CACHE/mondorestore.cfg > /dev/null 2> /dev/null ]; then
    881881    LogIt "backup-media-type is specified in config file - great."
    882882    LogIt "Calling post-init"
  • branches/2.2.10/mindi/rootfs/sbin/post-init

    r2462 r2591  
    4747
    4848mondoopt=""
    49 if [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
     49if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep -i 'obdr ' $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ]; then
    5050    mondoopt="$mondoopt -o -d $TAPEDEV"
    5151fi
     
    6262    mondorestore $mondoopt -Z nuke
    6363elif [ "$expert" ] ; then
    64     if [ "`grep tapedev $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
     64    if [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep tapedev $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
    6565    LogIt "-------------------TAPE MODE-------------------" 1
    6666    loc=`which mondorestore 2> /dev/null`
     
    7575            fi
    7676    fi
    77     elif [ "`grep using-cdstream $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
     77    elif [ -f $MINDI_CACHE/mondorestore.cfg ] && [ "`grep using-cdstream $MINDI_CACHE/mondorestore.cfg 2> /dev/null`" ] ; then
    7878        LogIt "------------------CDSTREAM MODE------------------" 1
    7979        loc=`which mondorestore 2> /dev/null`
  • branches/2.2.10/mindi/rootfs/sbin/start-netfs

    r2508 r2591  
    1010ipcount=3
    1111
    12 # Get info from config file
    13 ipdev=`grep netfs-dev $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
    14 ipaddress=`grep netfs-client-ipaddr $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
    15 ipnetmask=`grep netfs-client-netmask $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
    16 ipbroadcast=`grep netfs-client-broadcast $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
    17 ipgateway=`grep netfs-client-defgw $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
    18 proto=`grep netfs-proto $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
    1912ipconf=""
    2013pre=""
    2114post=""
    22 export netfsmount=`grep netfs-server-mount $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
    23 export imgname=`grep iso-prefix $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     15ipdev=""
     16ipaddress=""
     17ipnetmask=""
     18ipbroadcast=""
     19ipgateway=""
     20proto=""
     21netfsmount=""
     22imgname=""
     23dirimg=""
     24
     25# Get info from config file
     26if [ -f $MINDI_CACHE/mondorestore.cfg ]; then
     27    ipdev=`grep netfs-dev $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     28    ipaddress=`grep netfs-client-ipaddr $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     29    ipnetmask=`grep netfs-client-netmask $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     30    ipbroadcast=`grep netfs-client-broadcast $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     31    ipgateway=`grep netfs-client-defgw $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     32    proto=`grep netfs-proto $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     33    export netfsmount=`grep netfs-server-mount $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     34    export imgname=`grep iso-prefix $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     35    export dirimg=`grep netfs-server-path $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     36fi
     37
    2438if [ "$imgname" = "" ]; then
    2539    export imgname="mondorescue"
    2640fi
    27 export dirimg=`grep netfs-server-path $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
    2841if [ "$dirimg" = "" ]; then
    2942    export dirimg="/"
     
    5467    if [ $? -eq 0 ]; then
    5568        ipdev=`echo $ipconf | cut -d: -f1`
    56         LogIt "Making DHCP request on $ipdev"
    57         udhcpc -i $ipdev
     69        dhc="/sbin/dhclient"
     70        if [ ! -x $dhc ]; then
     71            dhc="/sbin/dhcpcd"
     72            if [ ! -x $dhc ]; then
     73                dhc="/sbin/udhcpc"
     74                if [ ! -x $dhc ]; then
     75                    dhc=""
     76                else
     77                    dhc="$dhc -i"
     78                fi
     79            fi
     80        fi
     81        if [ -x $dhc ]; then
     82            LogIt "Making DHCP request on $ipdev with $dhc"
     83            $dhc $ipdev
     84        else
     85            LogIt "Unable to make a DHCP request on $ipdev - no client found"
     86        fi
    5887    else
    5988        if [ "$ipconf" != "" ]; then
     
    7099
    71100    # ping server helps waking interface up
    72     LogIt "Pinging Remote server..."
    73101    netfs_server_ipaddr=`echo $netfsmount | cut -d: -f1 | cut -d@ -f2`
    74     ping -c $ipcount $netfs_server_ipaddr
     102    if [ $netfs_server_ipaddr != "" ]; then
     103        LogIt "Pinging Remote server $netfs_server_ipaddr ($ipcount times)..."
     104        ping -c $ipcount $netfs_server_ipaddr
     105    fi
    75106
    76107    # Which is our protocol for file sharing
     
    80111    fi
    81112
    82     if [ "$proto" = "sshfs" ]; then
    83         LogIt "Mounting SSHFS share ($netfsmount) on /tmp/isodir..."
    84         # We need a correct console for ssh
    85         ln -sf /dev/console /dev/tty
    86         sshfs -o ro,StrictHostKeyChecking=no $netfsopt $netfsmount /tmp/isodir
    87     elif [ "$proto" != "" ]; then
    88         LogIt "Mounting Network share ($netfsmount) on /tmp/isodir..."
    89         touch /etc/mtab
    90         mount -t $proto -o nolock,ro $netfsopt $netfsmount /tmp/isodir
     113    if [ "$netfsmount" != "" ]; then
     114        if [ "$proto" = "sshfs" ]; then
     115            LogIt "Mounting SSHFS share ($netfsmount) on /tmp/isodir..."
     116            # We need a correct console for ssh
     117            ln -sf /dev/console /dev/tty
     118            sshfs -o ro,StrictHostKeyChecking=no $netfsopt $netfsmount /tmp/isodir
     119        elif [ "$proto" != "" ]; then
     120            LogIt "Mounting Network share ($netfsmount) on /tmp/isodir..."
     121            touch /etc/mtab
     122            mount -t $proto -o nolock,ro $netfsopt $netfsmount /tmp/isodir
     123        else
     124            LogIt "Unknown protocol $proto"
     125        fi
     126
     127        # In all these cases we should have an image
     128        LogIt "Mounting Remote image ${imgname}-1.iso in $dirimg on /mnt/cdrom in loopback"
     129        mount -o ro,loop -t iso9660 /tmp/isodir/$dirimg/${imgname}-1.iso /mnt/cdrom
    91130    else
    92         LogIt "Unknown protocol $proto"
     131        LogIt "No image to mount"
    93132    fi
    94133   
    95     LogIt "Mounting Remote image ${imgname}-1.iso in $dirimg on /mnt/cdrom in loopback"
    96     mount -o ro,loop -t iso9660 /tmp/isodir/$dirimg/${imgname}-1.iso /mnt/cdrom
    97 
    98134    # Save the scripts on the Network share locally
    99135    if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
  • branches/2.2.10/mindi/rootfs/sbin/start-usb

    r2462 r2591  
    77
    88# Get info from config file
    9 MRUSBDEV=`grep usb-dev $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     9MRUSBDEV=""
     10if [ -f $MINDI_CACHE/mondorestore.cfg ]; then
     11    MRUSBDEV=`grep usb-dev $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
     12fi
    1013
    1114# info from cmdline are predominent
Note: See TracChangeset for help on using the changeset viewer.