From a0a692eacba93d0a1b48d59aa845b00e224708ac Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 29 Jan 2008 21:22:34 +0000 Subject: [PATCH] Relocate the nbroot to /opt/xcat/share/netboot -Override init with our own in order to preserve control of PID 1 (for switch_root) -Change nbroot shell to actually call shell and loop, rather than exit since that would be init trying to exit now -Increase destiny retrieval interval a bit to be less harsh, don't background as this must continue to be PID 1 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@363 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-nbroot/overlay/bin/dodestiny | 2 +- xCAT-nbroot/overlay/bin/restart | 2 +- .../etc/init.d/{S99xcat => S99xcat.sh} | 7 ++-- xCAT-nbroot/overlay/init | 36 +++++++++++++++++++ xCAT-nbroot/xcat-core-nbroot.spec | 5 +-- xCAT-server-2.0/sbin/mknb | 4 +-- 6 files changed, 47 insertions(+), 9 deletions(-) rename xCAT-nbroot/overlay/etc/init.d/{S99xcat => S99xcat.sh} (77%) create mode 100755 xCAT-nbroot/overlay/init diff --git a/xCAT-nbroot/overlay/bin/dodestiny b/xCAT-nbroot/overlay/bin/dodestiny index afc4557d0..82d57ebbe 100755 --- a/xCAT-nbroot/overlay/bin/dodestiny +++ b/xCAT-nbroot/overlay/bin/dodestiny @@ -27,7 +27,7 @@ while :; do fi if [ $DESTINY == "shell" ]; then echo "Server notified us to stay in shell state, stopping destiny requests" - exit + while :; do /bin/sh; done #exit fi if [ $DESTINY == "discover" ]; then echo "MAC discovery begins" diff --git a/xCAT-nbroot/overlay/bin/restart b/xCAT-nbroot/overlay/bin/restart index 0bafa7b1b..6cc6bb621 100755 --- a/xCAT-nbroot/overlay/bin/restart +++ b/xCAT-nbroot/overlay/bin/restart @@ -4,4 +4,4 @@ rm /restart killall -12 udhcpc;killall -10 udhcpc sleep 5 /etc/init.d/S11stunnel #redo stunnel config -/etc/init.d/S99xcat +exec /etc/init.d/S99xcat.sh diff --git a/xCAT-nbroot/overlay/etc/init.d/S99xcat b/xCAT-nbroot/overlay/etc/init.d/S99xcat.sh similarity index 77% rename from xCAT-nbroot/overlay/etc/init.d/S99xcat rename to xCAT-nbroot/overlay/etc/init.d/S99xcat.sh index 2e5d36a0f..35e748979 100755 --- a/xCAT-nbroot/overlay/etc/init.d/S99xcat +++ b/xCAT-nbroot/overlay/etc/init.d/S99xcat.sh @@ -1,9 +1,10 @@ #!/bin/sh # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -( + while ! /bin/getdestiny do echo "Retrying destiny retrieval" + sleep 3 + ifconfig done -/bin/dodestiny -) & +. /bin/dodestiny diff --git a/xCAT-nbroot/overlay/init b/xCAT-nbroot/overlay/init new file mode 100755 index 000000000..f3e2e829c --- /dev/null +++ b/xCAT-nbroot/overlay/init @@ -0,0 +1,36 @@ +#!/bin/sh +PATH=/sbin:/bin:/usr/bin:/usr/sbin +export PATH +/bin/mount -t proc none /proc +/bin/mount -t sysfs none /sys +/bin/mount -t tmpfs -o size=64k,mode=0755 none /dev +/bin/mkdir /dev/pts +/bin/mount -t devpts devpts /dev/pts +/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug +/sbin/mdev -s +/bin/mount -o remount,rw / +/bin/mount -a +/bin/hostname -F /etc/hostname +/sbin/ifconfig lo 127.0.0.1 up +/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo +# now run any rc scripts +for i in /etc/init.d/S??* ;do + + # Ignore dangling symlinks (if any). + [ ! -f "$i" ] && continue + + case "$i" in + *.sh) + # Source shell script for speed. + ( + trap - INT QUIT TSTP + set start + . $i + ) + ;; + *) + # No sh extension, so fork subprocess. + $i start + ;; + esac +done diff --git a/xCAT-nbroot/xcat-core-nbroot.spec b/xCAT-nbroot/xcat-core-nbroot.spec index 871254564..5f46bd352 100644 --- a/xCAT-nbroot/xcat-core-nbroot.spec +++ b/xCAT-nbroot/xcat-core-nbroot.spec @@ -13,6 +13,7 @@ BuildArch: noarch %define name xCAT-nbroot-core-%{tarch} Release: snap%(date +"%Y%m%d%H%M") AutoReq: false +Prefix: /opt/xcat AutoProv: false @@ -43,8 +44,8 @@ All files included are as they were downloadable on 4/7/2007 %Install rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/usr/share/xcat/netboot/%{tarch}/nbroot -cd $RPM_BUILD_ROOT/usr/share/xcat/netboot/%{tarch}/nbroot +mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/%{tarch}/nbroot +cd $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/%{tarch}/nbroot tar zxvf %{SOURCE1} chmod 755 etc/init.d/S40network bin/getdestiny bin/getdestiny.awk bin/getipmi bin/getipmi.awk cd - diff --git a/xCAT-server-2.0/sbin/mknb b/xCAT-server-2.0/sbin/mknb index 609bdd74d..ebeb2f05c 100755 --- a/xCAT-server-2.0/sbin/mknb +++ b/xCAT-server-2.0/sbin/mknb @@ -4,7 +4,7 @@ if [ $# -ne 1 ]; then echo "Usage: mknb " exit 1 fi -if [ ! -d /usr/share/xcat/netboot/$1 ]; then +if [ ! -d /opt/xcat/share/xcat/netboot/$1 ]; then echo "Unsupported architecture: $1" exit 1 fi @@ -14,7 +14,7 @@ if [ ! -r ~/.ssh/id_rsa.pub ]; then #exit 1 fi mkdir -p /tmp/mknb.$$ -cp -a /usr/share/xcat/netboot/$1/nbroot/* /tmp/mknb.$$/ +cp -a /opt/xcat/share/xcat/netboot/$1/nbroot/* /tmp/mknb.$$/ mkdir -p /tmp/mknb.$$/root/.ssh cp ~/.ssh/id_rsa.pub /tmp/mknb.$$/root/.ssh/authorized_keys if [ -f /install/postscripts/hostkeys/ssh_host_key ]; then