source: MondoRescue/branches/3.1/mindi/rootfs/sbin/start-netfs@ 2937

Last change on this file since 2937 was 2937, checked in by Bruno Cornec, 12 years ago

svn merge -r 2849:2935 ../3.0

  • Adds 3 binaries called potentially by udev o support USB key mount at restore time (Victor Gattegno)
  • mindi only sets the boot flag of a USB device if none is present already (should avoid flip/flop situation)
  • Fix a compatibility bug in analyze-my-lvm whete exclude lists with '|' was incorrectly analyzed (' ' still expected)
  • Precise that -J is not supported by mondorestore yet.
  • Fix a compatibility bug in mindi where exclude lists with '|' was incorrectly analyzed (' ' still expected)
  • Install an MBR on USB devices when possible
  • Improve error message in case mondorestore isn't found
  • Adds support for more virtio devices for KVM restore
  • Improve mbr.bin handling
  • Fix an issue in test of FindKernel for Xen and non Xen cases
    • Fix #492 by removing an extra useless fi
    • Move fvat nd fat modules to CDROM_MODS in order to have them in the initrd to support saving logs to a USB device e.g.
    • Fix an error when dmidecode reports comments before system name
    • Fix previous broken patch on comment management for bkphw
    • Improve msgs printed during kbd analysis
    • Fix a small remaining pb with new comment support
    • Try to again improve the mount/umount stuff in mondo -Adds mention to OEL, CentOS, ScientifLinux as RHEL clones
  • Fix a panadoid_free done on the wrong variable (solve a memory leak)
  • Solve #495 by skipping the potential (auto-read-only) when analyzin /proc/mdstat result
  • Fix some markup in man pages
  • adds the post-nuke script sample for Debian (Guillaume Pernot/Andrée Leidenfrost)
  • Avoid a useless umount when changing of afio set, let insist_on_cd check and perform if needed
  • Copy everything under .ssh of root account to allow for sshfs mount without passwd at restore time.
  • Adds support for bnx2i driver
  • Try to fix #496 by supporting the protocol in the output of the mount command (sshfs#...)
  • Uses the -d option of the mount command to avoid leaving loop devices in use. Probably provoked by the usage of a more recent busybox, but anyway that option doesn't hurt, and does nothing for non-loop devices. Should fix the problems reported on the ML with NFS and more than 8 ISO images (8 being the default number of loop devices available)
  • Attempt to fix #436 by adding some newtDrawForm where appropriate.
  • Fix bugs in the kernel detection routine of mindi (some echo were done without capturing their output, confusing the return). This should also help the Xen detection issue
  • Change the logging function to be nearer from 2.2.10, and start using some
  • Initialize some global fields with an empty string, now that newt Draws more regularly progress forms
  • Mindi progression still not good, but showing now 3% when calling mindi. Would need a specific handling for the progress bar to evolve more afterwards
  • Add compatibility with the latest SSSTK + PSP content for HP ProLiant + branding homogeneous now. We only take conrep out of the SSSTK pending a package availability. Using hpacuscripting now. Review of parameters called following test made.
  • Fix #501 by pushing BOOT_SIZE to 36864 for certain Ubuntu cases
  • Fix some remaining inconsistencis in the ProLiant HW backup. ready for usage.
  • Fix an issue on udevadm call (needs an intermediate variable)
  • Fix a remaining ProLiant tool call
  • Remove again some wrong variable initialization for Net in order to not have strange messages now we call Draw more often
  • Adds support for hwaddr (MAC addresses) at restore time, and map to the correct NIC if it's found at restore time (based on code from Stefan Heijmans)
  • Try to Fix #499 by changing init in order to never exit, and rebooting using sysrq in /proc (not portable). Maybe should move to using a real init, and a separated rcS script.
  • Fixes the shell msg error by using setsid as per Busybox FAQ
  • Fix #491 by correctly checking Xen kernel used for a dom0 env (apollo13)
  • Improves logging in Die()
  • Improve again ProLiant HW support, by adding references to the yet to come SSSTK rpm so that conrep is called at its future right place.
  • Improve mindi support for kernel 3.x
  • Fix #499 for good, by using a real init from busybox and moving our init script to etc/init.d/rcS. We also now call the reboot from busybox to exit, which indeed reset the system correctly (in a VM at least which wasn't the case before). Reauires a new mindi-busybox as well.
  • Attempt to solve #503 by handling /lib64 separately for udev and only if not a link (to /lib) for Ubuntu 64
  • Improve again previous tests for bug #503
  • Improve -d option description for NFS
  • Allow http download for ftp content
  • New italian mirror
  • Fix #505 by documenting environment variables
    • Fix a bug where on OBDR mode compression was turned off to create the OBDR content but not back on (report from the mailing list)
  • solve http://trac.mondorescue.org/ticket/520 by Victor Gattegno
  • Fix #524 as option -U needs a size also
  • Removes useless gendf option
  • Fix #511 now stabgrub is called also after conf file modifications
  • Adds support for SUID binaries
  • remove a useless xenkernelname variable from mindi
  • Should fix #512 by clearing old scratchdir before changing to a new
  • Simplify the function engaging SCSI for Smart Array controllers, and support as many controller as we have
  • Add some binaries used on SLES 10 by udev
  • Fix a syntax issue in newt-specific.c
  • Fix a memory free bug where a used variable was freed to early
  • Fix a memory free bug where a used variable was misused in asprintf/free
  • Fix #498 by using an external program (hpsa_obdr_mode) which can set the mode of the tape to CD-ROM or Sequential at will.

That program will have to be downloaded from http://cciss.sf.net

  • Adds support for the route command in mindi-busybox
  • Force block size back to 32768 in OBDR mode after skipping the 2 tape marks, to read the additional rootfs data corerctly - Fix #498 for good it seems
  • Adds support for a new pata_atiixp driver
  • Fix #525 and improve printing when no /etc/raidtab, but still md devices
  • Exclude /run similarly to /sys and /proc
  • Fix a bug in mindi when having multiple swap partiions with same starting string (/dev/dm-1 and /dev/dm-16). We now add a space in the grep to avoid mischoice.
  • Fix grub installation if we had to go in the hack part which wasn't using the correct variables to make decisions !
  • Remove all mention of mondorescue.com from code
  • Fix some website typo on the download page and precise that we now develop on Mageia
  • Exclude sysfs devpts and tmpfs partitions found in RHEL 6.2 from analyze by mindi (made error messages)
  • Force activation of first partition which should not be optional as everything is destroyed before
  • Fix a bug in analyze-my-lvm where LVs were created in random order (the one of lvscan) instead of using the dm-xxx order, which creates issues at restore time between the mapping created then and the one we had at backup time which could be inconssistent

-mondoarchive now exists if the mt command is missing when needed

  • Proper fix for analyze-my-lvm
  • Fix #500 and #473 by adding support of old metadata format for mdadm if using grub < 0.9x or lilo on a md boot device (to be tested)
  • Really never inject or eject when the -e option is passed or device is inappropriate (USB, Net, ...)
  • Fix #577 by having factor back as a float (not a long ! it's a decimal value) and making the appropriate cast.
  • Fix #578 by improving the regexp used for CD/DVD detection with -scanbus option
  • Adds more verbosity when LVM creation fails.
  • Fix #579 by checking with pipes on both sides of the string
  • debugfs should be excluded from the device considered for fstab analysis
  • Property svn:executable set to *
File size: 5.1 KB
Line 
1#!/bin/sh
2#
3# $Id$
4#
5# This script sets up the network + Network FS environment if needed.
6#
7
8
9# number of ping
10ipcount=3
11
12# Get info from config file
13ipdev=""
14hwaddr=""
15ipaddress=""
16ipnetmask=""
17ipbroadcast=""
18ipgateway=""
19proto=""
20ipconf=""
21pre=""
22post=""
23netfsmount=""
24imgname=""
25dirimg=""
26
27# Get info from config file
28if [ -f $MINDI_CACHE/mondorestore.cfg ]; then
29 ipdev=`grep netfs-dev $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
30 hwaddr=`grep netfs-client-hwaddr $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
31 ipaddress=`grep netfs-client-ipaddr $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
32 ipnetmask=`grep netfs-client-netmask $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
33 ipbroadcast=`grep netfs-client-broadcast $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
34 ipgateway=`grep netfs-client-defgw $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
35 proto=`grep netfs-proto $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
36 export netfsmount=`grep netfs-server-mount $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
37 export imgname=`grep iso-prefix $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
38 export dirimg=`grep netfs-server-path $MINDI_CACHE/mondorestore.cfg 2> /dev/null | cut -d' ' -f2-`
39fi
40
41if [ "$imgname" = "" ]; then
42 export imgname="mondorescue"
43fi
44if [ "$dirimg" = "" ]; then
45 export dirimg="/"
46fi
47
48# info from cmdline are predominent
49for i in `cat $CMDLINE` ; do
50 echo $i | grep -qi ping= && ipcount=`echo $i | cut -d= -f2`
51 echo $i | grep -qi hwaddr= && hwaddr=`echo $i | cut -d= -f2`
52 echo $i | grep -qi ipconf= && ipconf=`echo $i | cut -d= -f2`
53 echo $i | grep -qi netfsmount= && export netfsmount=`echo $i | cut -d= -f2`
54 echo $i | grep -qi netfsopt= && export netfsopt=`echo $i | cut -d= -f2`
55 echo $i | grep -qi prefix= && export imgname=`echo $i | cut -d= -f2`
56 echo $i | grep -qi netfspath= && export dirimg=`echo $i | cut -d= -f2`
57 echo $i | grep -qi pre= && pre=`echo $i | cut -d= -f2`
58 echo $i | grep -qi post= && post=`echo $i | cut -d= -f2`
59 echo $i | grep -qi proto= && proto=`echo $i | cut -d= -f2`
60done
61
62if [ "$ipdev" != "" ] || [ "$ipconf" != "" ]; then
63 # Network configuration stored during archive
64 # or on cmdline so network wanted => starting it
65 LogIt "Starting Network..."
66
67 # Activate loobback
68 ifconfig lo 127.0.0.1
69
70 echo "$ipconf" | grep -q "dhcp"
71 if [ $? -eq 0 ]; then
72 ipdev=`echo $ipconf | cut -d: -f1`
73 dhc="/sbin/dhclient"
74 if [ ! -x $dhc ]; then
75 dhc="/sbin/dhcpcd"
76 if [ ! -x $dhc ]; then
77 dhc="/sbin/udhcpc"
78 if [ ! -x $dhc ]; then
79 dhc=""
80 else
81 dhc="$dhc -i"
82 fi
83 fi
84 fi
85 if [ -x $dhc ]; then
86 LogIt "Making DHCP request on $ipdev with $dhc"
87 $dhc $ipdev
88 else
89 LogIt "Unable to make a DHCP request on $ipdev - no client found"
90 fi
91 else
92 if [ "$ipconf" != "" ]; then
93 ipdev=`echo $ipconf | cut -d: -f1`
94 ipaddress=`echo $ipconf | cut -d: -f2`
95 ipnetmask=`echo $ipconf | cut -d: -f3`
96 ipbroadcast=`echo $ipconf | cut -d: -f4`
97 ipgateway=`echo $ipconf | cut -d: -f5`
98 fi
99
100 # If same system, map to the right MAC address
101 hwaddr_found=`ifconfig $ipdev | /bin/grep HWaddr | awk '{print $NF}'`
102 if [ "$hwaddr" != "$hwaddr_found" ]; then
103 ipdev_new=`ifconfig -a | /bin/grep $hwaddr | awk '{print $1}'`
104 if [ "$ipdev_new" != "" ]; then
105 LogIt "Interface $ipdev changed to $ipdev_new (MAC: $hwaddr)"
106 ipdev=$ipdev_new
107 else
108 LogIt "NOTE: Interface $ipdev kept despite it doesn't match the $hwaddr MAC address"
109 fi
110 fi
111
112 LogIt "Configuring $ipdev statically ($ipaddress/$ipnetmask)"
113 ifconfig $ipdev $ipaddress netmask $ipnetmask broadcast $ipbroadcast
114 route add default gw $ipgateway
115
116 fi
117
118 # Leave time to the satck to wake up (reported by some users)
119 sleep 5
120
121 # ping server helps waking interface up
122 netfs_server_ipaddr=`echo $netfsmount | cut -d: -f1 | cut -d@ -f2`
123 if [ $netfs_server_ipaddr != "" ]; then
124 LogIt "Pinging Remote server $netfs_server_ipaddr ($ipcount times)..."
125 ping -c $ipcount $netfs_server_ipaddr
126 fi
127
128 # Which is our protocol for file sharing
129 if [ "$proto" = "" ]; then
130 LogIt "No protocol specified, defaulting to NFS"
131 proto="nfs"
132 fi
133
134 if [ "$netfsmount" != "" ]; then
135 if [ "$proto" = "sshfs" ]; then
136 LogIt "Mounting SSHFS share ($netfsmount) on /tmp/isodir..."
137 # We need a correct console for ssh
138 ln -sf /dev/console /dev/tty
139 sshfs -o ro,StrictHostKeyChecking=no $netfsopt $netfsmount /tmp/isodir
140 elif [ "$proto" != "" ]; then
141 LogIt "Mounting Network share ($netfsmount) on /tmp/isodir..."
142 touch /etc/mtab
143 mount -t $proto -o nolock,ro $netfsopt $netfsmount /tmp/isodir
144 else
145 LogIt "Unknown protocol $proto"
146 fi
147
148 # In all these cases we should have an image
149 LogIt "Mounting Remote image ${imgname}-1.iso in $dirimg on /mnt/cdrom in loopback"
150 mount -o ro,loop -t iso9660 /tmp/isodir/$dirimg/${imgname}-1.iso /mnt/cdrom
151 else
152 LogIt "No image to mount"
153 fi
154
155 # Save the scripts on the Network share locally
156 if [ "`echo $pre | grep -E '^/tmp/isodir'`" ]; then
157 cp $pre /tmp
158 LogIt "Copying $pre under /tmp"
159 fi
160 if [ "`echo $post | grep -E '^/tmp/isodir'`" ]; then
161 cp $post /tmp
162 LogIt "Copying $post under /tmp"
163 fi
164fi
Note: See TracBrowser for help on using the repository browser.