Changeset 2255 in MondoRescue


Ignore:
Timestamp:
Jul 5, 2009, 2:58:53 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Fix #336 by extending the previous feature to a double call (pre and post) on the boot loader line to be able to call cripts either before mondorestore and/or after its execution
Location:
branches/2.2.9/mindi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi/README.bootparam

    r2251 r2255  
    1717
    1818--------------
     19
     20debug
     21    Call mondorestore with -K99
    1922
    2023denymods="mod1 mod2"
     
    4548    Do not resize partitions using a multiplication factor of (New disk size)/(Old disk size) to use your unallocated hard disk space
    4649
    47 script=/path/to/script
    48     Execute a final script before rebooting the machine at the end of the restoration. Could be an NFS shared script e.g., or a script located on the restored disk
     50obdr
     51    Call mondorestore with -o and the tape device
     52
     53pre=/path/to/script
     54    Execute a pre-configuration script before calling mondorestore. Could be an NFS shared script e.g., or a script located in the initrd.
     55
     56post=/path/to/script
     57    Execute a final script before rebooting the machine at the end of the restoration. Could be an NFS shared script e.g., or a script located on the restored disk or in the initrd.
    4958
    5059textonly
  • branches/2.2.9/mindi/rootfs/sbin/init

    r2253 r2255  
    826826    LogIt "backup-media-type is specified in config file - great."
    827827    LogIt "Calling post-init"
     828    # start-nfs moved it under /tmp as the NFS share is already unmounted
     829    if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
     830        post=`echo $pre | sed 's|^/tmp/isodir|/tmp|'`
     831    fi
     832    if [ -x $pre ]; then
     833        echo "Executing preliminary script $pre"
     834        LogIt "Executing preliminary script $pre"
     835        $pre
     836    fi
    828837    post-init
    829838else
     
    831840    LogIt "I think this media has no archives on it."
    832841fi
    833 if [ "`grep -i "script=" /proc/cmdline`" ] ; then
     842if [ "`grep -i "post=" /proc/cmdline`" ] ; then
    834843    for i in `cat /proc/cmdline` ; do
    835         echo $i | grep -qi script= && script=`echo $i | cut -d= -f2`
     844        echo $i | grep -qi post= && post=`echo $i | cut -d= -f2`
    836845    done
    837846    # start-nfs moved it under /tmp as the NFS share is already unmounted
    838     if [ "`echo $script | grep -E '^/tmp/isodir'`" ]; then
    839         script=`echo $script | sed 's|^/tmp/isodir|/tmp|'`
    840     fi
    841     if [ -x $script ]; then
    842         echo "Executing final script $script"
    843         LogIt "Executing final script $script"
    844         if [ "`echo $script | grep -E '^/mnt/RESTORING'`" ]; then
     847    if [ "`echo $post | grep -E '^/tmp/isodir'`" ]; then
     848        post=`echo $post | sed 's|^/tmp/isodir|/tmp|'`
     849    fi
     850    if [ -x $post ]; then
     851        echo "Executing final script $post"
     852        LogIt "Executing final script $post"
     853        if [ "`echo $post | grep -E '^/mnt/RESTORING'`" ]; then
    845854            mount-me
    846855        fi
    847         $script
    848         if [ "`echo $script | grep -E '^/mnt/RESTORING'`" ]; then
     856        $post
     857        if [ "`echo $post | grep -E '^/mnt/RESTORING'`" ]; then
    849858            unmount-me
    850859        fi
  • branches/2.2.9/mindi/rootfs/sbin/start-nfs

    r2254 r2255  
    1717ipgateway=`grep nfs-client-defgw /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    1818ipconf=""
    19 script=""
     19pre=""
     20post=""
    2021export nfsmount=`grep nfs-server-mount /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    2122export imgname=`grep iso-prefix /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     
    3536    echo $i | grep -qi prefix= && export imgname=`echo $i | cut -d= -f2`
    3637    echo $i | grep -qi nfspath= && export dirimg=`echo $i | cut -d= -f2`
    37     echo $i | grep -qi script= && script=`echo $i | cut -d= -f2`
     38    echo $i | grep -qi pre= && pre=`echo $i | cut -d= -f2`
     39    echo $i | grep -qi post= && post=`echo $i | cut -d= -f2`
    3840done
    3941
     
    7779    mount -o ro,loop -t iso9660 /tmp/isodir/$dirimg/${imgname}-1.iso /mnt/cdrom
    7880
    79     # Save the script on the NFS share locally
    80     if [ "`echo $script | grep -E '^/tmp/isodir'`" ]; then
    81         cp $script /tmp
    82         LogIt "Copying $script under /tmp"
     81    # Save the scripts on the NFS share locally
     82    if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
     83        cp $pre /tmp
     84        LogIt "Copying $pre under /tmp"
     85    fi
     86    if [ "`echo $post | grep -E '^/tmp/isodir'`" ]; then
     87        cp $post /tmp
     88        LogIt "Copying $post under /tmp"
    8389    fi
    8490fi
Note: See TracChangeset for help on using the changeset viewer.