Changeset 2380 in MondoRescue for branches/2.2.9/mindi/rootfs/sbin/start-netfs


Ignore:
Timestamp:
Sep 9, 2009, 8:30:47 PM (15 years ago)
Author:
Bruno Cornec
Message:
  • Change NFS support into a NetFS support to allow for multiple protocol in addition to NFS (NEEDS TESTING)
  • Better logging to detect a potential nuke issue
File:
1 moved

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi/rootfs/sbin/start-netfs

    r2377 r2380  
    33# $Id$
    44#
    5 # This script sets up the network + NFS environment if needed.
     5# This script sets up the network + Network FS environment if needed.
    66#
    77
     
    1111
    1212# Get info from config file
    13 ipdev=`grep nfs-dev /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    14 ipaddress=`grep nfs-client-ipaddr /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    15 ipnetmask=`grep nfs-client-netmask /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    16 ipbroadcast=`grep nfs-client-broadcast /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    17 ipgateway=`grep nfs-client-defgw /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     13ipdev=`grep netfs-dev /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     14ipaddress=`grep netfs-client-ipaddr /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     15ipnetmask=`grep netfs-client-netmask /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     16ipbroadcast=`grep netfs-client-broadcast /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     17ipgateway=`grep netfs-client-defgw /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     18proto=`grep netfs-proto /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    1819ipconf=""
    1920pre=""
    2021post=""
    21 export nfsmount=`grep nfs-server-mount /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     22export netfsmount=`grep netfs-server-mount /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    2223export imgname=`grep iso-prefix /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    2324if [ "$imgname" = "" ]; then
    2425    export imgname="mondorescue"
    2526fi
    26 export dirimg=`grep nfs-server-path /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
     27export dirimg=`grep netfs-server-path /tmp/mondo-restore.cfg 2> /dev/null | cut -d' ' -f2-`
    2728if [ "$dirimg" = "" ]; then
    2829    export dirimg="/"
     
    3334    echo $i | grep -qi ping= && ipcount=`echo $i | cut -d= -f2`
    3435    echo $i | grep -qi ipconf= && ipconf=`echo $i | cut -d= -f2`
    35     echo $i | grep -qi nfsmount= && export nfsmount=`echo $i | cut -d= -f2`
     36    echo $i | grep -qi netfsmount= && export netfsmount=`echo $i | cut -d= -f2`
    3637    echo $i | grep -qi prefix= && export imgname=`echo $i | cut -d= -f2`
    37     echo $i | grep -qi nfspath= && export dirimg=`echo $i | cut -d= -f2`
     38    echo $i | grep -qi netfspath= && export dirimg=`echo $i | cut -d= -f2`
    3839    echo $i | grep -qi pre= && pre=`echo $i | cut -d= -f2`
    3940    echo $i | grep -qi post= && post=`echo $i | cut -d= -f2`
     41    echo $i | grep -qi proto= && proto=`echo $i | cut -d= -f2`
    4042done
    4143
     
    6769
    6870    # ping server helps waking interface up
    69     LogIt "Pinging NFS server..."
    70     nfs_server_ipaddr=`echo $nfsmount | cut -d: -f1`
    71     ping -c $ipcount $nfs_server_ipaddr
     71    LogIt "Pinging Remote server..."
     72    netfs_server_ipaddr=`echo $netfsmount | cut -d: -f1 | cut -d@ -f2`
     73    ping -c $ipcount $netfs_server_ipaddr
    7274
    73     # Finally mounts the NFS share
    74     LogIt "Mounting NFS share ($nfsmount) on /tmp/isodir..."
    75     touch /etc/mtab
    76     mount -t nfs -o nolock,ro $nfsmount /tmp/isodir
     75    # Which is our protocol for file sharing
     76    if [ "$proto" = "" ]; then
     77        LogIt "No protocol specified, defaulting to NFS"
     78        $proto = "nfs"
     79    fi
     80
     81    if [ "$proto" = "sshfs" ]; then
     82        LogIt "Mounting SSHFS share ($netfsmount) on /tmp/isodir..."
     83        sshfs -o ro $netfsmount /tmp/isodir
     84    elif [ "$proto" != "" ]; then
     85        LogIt "Mounting Network share ($netfsmount) on /tmp/isodir..."
     86        touch /etc/mtab
     87        mount -t $proto -o nolock,ro $netfsmount /tmp/isodir
     88    else
     89        LogIt "Unknown protocol $proto"
     90    fi
    7791   
    78     LogIt "Mounting NFS image ${imgname}-1.iso in $dirimg on /mnt/cdrom in loopback"
     92    LogIt "Mounting Remote image ${imgname}-1.iso in $dirimg on /mnt/cdrom in loopback"
    7993    mount -o ro,loop -t iso9660 /tmp/isodir/$dirimg/${imgname}-1.iso /mnt/cdrom
    8094
    81     # Save the scripts on the NFS share locally
     95    # Save the scripts on the Network share locally
    8296    if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
    8397        cp $pre /tmp
Note: See TracChangeset for help on using the changeset viewer.