More tightly control/monitor network bringup
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9845 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -1,3 +1,3 @@ | ||||
| #!/bin/sh | ||||
| [ "$1" = "-d" ] && echo network  | ||||
| #[ "$1" = "-d" ] && echo network  #they pull in too much | ||||
| exit 0 | ||||
|   | ||||
| @@ -3,8 +3,10 @@ echo $drivers | ||||
| dracut_install wget openssl tar ipmitool cpio gzip dash  modprobe touch echo cut wc | ||||
| dracut_install grep ip hostname awk egrep grep dirname expr | ||||
| dracut_install mount.nfs sshd vi reboot lspci parted libvirtd /usr/share/libvirt/cpu_map.xml mkfs mkfs.ext4 mkfs.btrfs | ||||
| dracut_install mkswap df brctl vconfig ifenslave ssh-keygen /usr/libexec/qemu-kvm scp clear | ||||
| dracut_install mkswap df brctl vconfig ifenslave ssh-keygen /usr/libexec/qemu-kvm scp clear dhclient | ||||
| dracut_install poweroff | ||||
| inst "$moddir/xcatroot" "/sbin/xcatroot" | ||||
| inst "$moddir/dhclient-script" "/sbin/dhclient-script" | ||||
| inst "/root/.ssh/id_rsa.pub" "/.ssh/authorized_keys" | ||||
| inst "/lib/terminfo/l/linux" "/lib/terminfo/l/linux" | ||||
| inst_hook cmdline 10 "$moddir/xcat-cmdline.sh"  | ||||
|   | ||||
| @@ -2,13 +2,62 @@ root=1 | ||||
| rootok=1 | ||||
| netroot=xcat | ||||
| clear | ||||
| echo "Wating for network to become available..." | ||||
| echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/xcatroot.sh | ||||
| udevd --daemon | ||||
| udevadm trigger | ||||
| mkdir -p /var/lib/dhclient/ | ||||
| if [ ! -z "$BOOTIF" ]; then | ||||
| 	BOOTIF=`echo $BOOTIF|sed -e s/01-// -e s/-/:/g` | ||||
| 	echo -n "Waiting for device with address $BOOTIF to appear.." | ||||
| 	gripeiter=300 | ||||
| 	while [ -z "$bootnic" ]; do  | ||||
| 		bootnic=`ip link show|grep -B1 $BOOTIF|grep mtu|awk '{print $2}'` | ||||
| 		sleep 0.1 | ||||
| 		if [ $gripeiter = 0 ]; then | ||||
| 			echo "ERROR" | ||||
| 			echo "Unable to find boot device (maybe the nbroot is missing the driver for your nic?)" | ||||
| 			while :; do sleep 365d; done | ||||
| 		fi | ||||
| 		gripeiter=$((gripeiter-1)) | ||||
| 	done | ||||
| fi | ||||
| echo "Done" | ||||
| if [ -z "$bootnic" ]; then | ||||
| 	echo "ERROR: BOOTIF missing, can't detect boot nic" | ||||
| fi | ||||
|  | ||||
| if [ -r /sys/devices/virtual/dmi/id/product_uuid ]; then | ||||
| 	duid='default-duid "\\000\\004'; | ||||
| 	for i in `sed -e s/-//g -e 's/\(..\)/\1 /g' /sys/devices/virtual/dmi/id/product_uuid`; do | ||||
| 		octnum="\\"`printf "\\%03o" 0x$i` | ||||
| 		duid=$duid$octnum | ||||
| 	done | ||||
| 	duid=$duid'";' | ||||
| 	echo $duid > /var/lib/dhclient/dhclient6.leases | ||||
| fi | ||||
| #/bin/dash | ||||
| mkdir -p /etc/ssh | ||||
| mkdir -p /var/empty/sshd | ||||
| echo root:x:0:0::/:/bin/sh >> /etc/passwd | ||||
| echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd | ||||
| ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -C '' -N '' | ||||
| ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -C '' -N '' | ||||
| echo 'Protocol 2' >> /etc/ssh/sshd_config | ||||
| /usr/sbin/sshd | ||||
| dhclient $bootnic & | ||||
| dhclient -6 $bootnic -lf /var/lib/dhclient/dhclient6.leases & | ||||
| gripeiter=101 | ||||
| echo -n "Acquiring network addresses.." | ||||
| while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v  inet6|grep inet > /dev/null; do | ||||
| 	sleep 0.1 | ||||
| 	if [ $gripeiter = 1 ]; then | ||||
| 		echo | ||||
| 		echo "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..." | ||||
| 	fi | ||||
| 	gripeiter=$((gripeiter-1)) | ||||
| done | ||||
| echo -n "Acquired IPv4 address " | ||||
| ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v  inet6|grep inet|awk '{print $2}' | ||||
|  | ||||
|  | ||||
| /bin/dash | ||||
|   | ||||
		Reference in New Issue
	
	Block a user