add strace to bootcd, small print and may come in handy
[build.git] / config.planetlab / bootstrapfs.post
index d35618c..ff4976f 100644 (file)
@@ -7,9 +7,20 @@ if [ -z "${vdir}" ] ; then
        exit
 fi
 
+# Cleanup yum config entirely, waiting for the config files to populate this
+rm -rf ${vdir}/etc/yum.conf ${vdir}/etc/yum.repos.d
+
+# NOTE: we're enabling util-vserver to allow it to help shutdown all slices
+# before rebooting.  This has been problematic in the past.
+# Thierry : I'm enabling network since, for some reason, it ends up turned off on fedora9
+for service in network util-vserver; do
+    chroot ${vdir} /sbin/chkconfig $service on
+done
+
 # Remove unneeded services
-for service in util-vserver vprocunhide vservers-default; do
-    chroot ${vdir} /sbin/chkconfig $service off
+# turn off firstboot if present, might cause the node to hang
+for service in vprocunhide vservers-default firstboot; do
+    chroot ${vdir} /sbin/chkconfig $service off || :
 done
 
 # Disable splaying of cron.
@@ -18,18 +29,32 @@ echo > ${vdir}/etc/sysconfig/crontab
 # Add site_admin account
 chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
 
-( cat <<EOF ) | patch -d ${vdir}/etc/init.d/
---- halt        2007-10-08 19:18:54.000000000 +0000
-+++ halt2       2008-05-07 17:52:42.000000000 +0000
-@@ -65,8 +65,10 @@
- # Kill all processes.
- [ "\${BASH+bash}" = bash ] && enable kill
-
-+action $"Sending all VServers the TERM signal..."  ls -d /proc/virtual/[0-9]* | awk -F '/' '{print \$4}' | xargs -I{} /usr/sbin/vkill -s 15 --xid {} -- 0
- action $"Sending all processes the TERM signal..." /sbin/killall5 -15
- sleep 2
-+action $"Sending all VServers the KILL signal..."  ls -d /proc/virtual/[0-9]* | awk -F '/' '{print \$4}' | xargs -I{} /usr/sbin/vkill -s 9 --xid {} -- 0
- action $"Sending all processes the KILL signal..."  /sbin/killall5 -9
+# Remove 32bit packages from 64bit system (http://wiki.centos.org/FAQ/General#head-357346ff0bf7c14b0849c3bcce39677aaca528e9) 
+# use rpm instead of yum as /proc is not mounted at that poing 
+if echo ${vdir} | grep -q x86_64 ; then
+    chroot ${vdir} rpm -qa --qf '%{name}.%{arch}\n' | grep 'i[36]86$' | xargs chroot ${vdir} rpm -e
+fi
 
- # Write to wtmp file before unmounting /var
+# NOTE:  This is added to relieve one site's Cisco router configuration that
+# fails to recognize the host once the arping is sent out.
+# NOTE: this is pretty fragile, and fails on fedora 10 that as of today (oct. 20 2009) 
+# has initscripts-8.86.3-1.i386 which reads almost identical but with /sbin/arping instead
+cat <<\EOF | patch -d ${vdir}/etc/sysconfig/network-scripts/
+--- ifup-eth   2008-07-08 13:19:49.000000000 -0400
++++ ifup-eth-orig      2008-07-08 13:20:02.000000000 -0400
+@@ -263,10 +263,10 @@
+     fi
+     
+     if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then
+-       if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
+-          echo $"Error, some other host already uses address ${IPADDR}."
+-          exit 1
+-       fi
++       #if ! arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
++       #   echo $"Error, some other host already uses address ${IPADDR}."
++       #   exit 1
++       #fi
+        if ! ip addr add ${IPADDR}/${PREFIX} \
+           brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
+           echo $"Error adding address ${IPADDR} for ${DEVICE}."
 EOF