Changeset 2591 in MondoRescue for branches/2.2.10/mindi/rootfs/sbin/start-netfs
- Timestamp:
- Mar 11, 2010, 2:56:00 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mindi/rootfs/sbin/start-netfs
r2508 r2591 10 10 ipcount=3 11 11 12 # Get info from config file13 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-`19 12 ipconf="" 20 13 pre="" 21 14 post="" 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-` 15 ipdev="" 16 ipaddress="" 17 ipnetmask="" 18 ipbroadcast="" 19 ipgateway="" 20 proto="" 21 netfsmount="" 22 imgname="" 23 dirimg="" 24 25 # Get info from config file 26 if [ -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-` 36 fi 37 24 38 if [ "$imgname" = "" ]; then 25 39 export imgname="mondorescue" 26 40 fi 27 export dirimg=`grep netfs-server-path $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`28 41 if [ "$dirimg" = "" ]; then 29 42 export dirimg="/" … … 54 67 if [ $? -eq 0 ]; then 55 68 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 58 87 else 59 88 if [ "$ipconf" != "" ]; then … … 70 99 71 100 # ping server helps waking interface up 72 LogIt "Pinging Remote server..."73 101 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 75 106 76 107 # Which is our protocol for file sharing … … 80 111 fi 81 112 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 91 130 else 92 LogIt " Unknown protocol $proto"131 LogIt "No image to mount" 93 132 fi 94 133 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/cdrom97 98 134 # Save the scripts on the Network share locally 99 135 if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
Note:
See TracChangeset
for help on using the changeset viewer.