Changeset 740 in MondoRescue


Ignore:
Timestamp:
Aug 4, 2006, 12:02:27 PM (18 years ago)
Author:
Bruno Cornec
Message:

start-nfs is now an external script under /sbin
No more generation in init (variable substitution errors thus avoided)

Location:
branches/stable/mindi/rootfs/sbin
Files:
1 added
1 edited

Legend:

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

    r739 r740  
    464464    LogIt "Warning - /tmp/mondo-restore.cfg not found"
    465465fi
    466 
    467 #
    468 # Create NFS configuration
    469 #
    470 cat > /sbin/start-nfs << EOF
    471 #!/bin/sh
    472 #
    473 # number of ping
    474 #
    475 ipcount=3
    476 
    477 # Get info from config file
    478 ipdev=`grep nfs-dev /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    479 ipaddress=`grep nfs-client-ipaddr /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    480 ipnetmask=`grep nfs-client-netmask /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    481 ipbroadcast=`grep nfs-client-broadcast /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    482 ipgateway=`grep nfs-client-defgw /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    483 ipconf=""
    484 nfsmount=`grep nfs-server-mount /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    485 imgname=`grep iso-prefix /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    486 if [ "\$imgname" = "" ]; then
    487     imgname="mondorescue"
    488 fi
    489 dirimg=`grep nfs-server-path /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    490 if [ "\$dirimg" = "" ]; then
    491     dirimg="/"
    492 fi
    493 
    494 # info from cmdline are predominent
    495 for i in `cat /proc/cmdline` ; do
    496     echo \$i | grep -qi ping= && ipcount=`echo \$i | cut -d= -f2`
    497     echo \$i | grep -qi ipconf= && ipconf=`echo \$i | cut -d= -f2`
    498     echo \$i | grep -qi nfsmount= && nfsmount=`echo \$i | cut -d= -f2`
    499     echo \$i | grep -qi prefix= && imgname=`echo \$i | cut -d= -f2`
    500 done
    501 
    502 if [ \$ipdev = "" ] && [ \$ipconf = "" ]; then
    503     # No network configuration neither stored during archive
    504     # nor on cmdline so no network wanted => exiting
    505     exit 0
    506 else
    507     LogIt "Starting Network..."
    508 fi
    509 
    510 # Activate loobback
    511 ifconfig lo 127.0.0.1
    512 
    513 echo "\$ipconf" | grep -q "dhcp"
    514 if [ \$? -eq 0 ]; then
    515     ipdev=`echo \$ipconf | cut -d: -f1`
    516     echo "Making DHCP request on \$ipdev"
    517     udhcpc -i \$ipdev
    518 else
    519     if [ "\$ipconf" != "" ]; then
    520         ipdev=`echo \$ipconf | cut -d: -f1`
    521         ipaddress=`echo \$ipconf | cut -d: -f2`
    522         ipnetmask=`echo \$ipconf | cut -d: -f3`
    523         ipbroadcast=`echo \$ipconf | cut -d: -f4`
    524         ipgateway=`echo \$ipconf | cut -d: -f5`
    525     fi
    526     echo "Configuring \$ipdev statically (\$ipaddress/\$ipnetmask)"
    527     ifconfig \$ipdev \$ipaddress netmask \$ipnetmask broadcast \$ipbroadcast
    528     route add default gw \$ipgateway
    529 fi
    530 
    531 # ping server helps waking interface up
    532 LogIt "Pinging NFS server..."
    533 nfs_server_ipaddr=`echo \$nfsmount | cut -d: -f1`
    534 ping -c \$ipcount \$nfs_server_ipaddr
    535 
    536 # Finally mounts the NFS share
    537 LogIt "Mounting NFS share (\$nfsmount) on /tmp/isodir..."
    538 mount -t nfs -o nolock \$nfsmount /tmp/isodir
    539 
    540 LogIt "Mounting NFS image \$imgname-1.iso in \$dirimg on /mnt/cdrom in loopback"
    541 losetup /dev/loop7 /tmp/isodir/\$dirimg/\$imgname-1.iso
    542 mount -o ro -t iso9660 /dev/loop7 /mnt/cdrom
    543 EOF
    544 chmod 755 /sbin/start-nfs
    545466
    546467if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ] ; then
Note: See TracChangeset for help on using the changeset viewer.