added from the stock planetlab build
authorthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Thu, 2 Apr 2009 17:40:42 +0000 (17:40 +0000)
committerthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Thu, 2 Apr 2009 17:40:42 +0000 (17:40 +0000)
bootstrapfs.post [new file with mode: 0644]

diff --git a/bootstrapfs.post b/bootstrapfs.post
new file mode 100644 (file)
index 0000000..dd6b93e
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+vdir=$1
+if [ -z "${vdir}" ] ; then
+       echo "ERROR: $0"
+       echo "Provide the directory of the root filesystem to operate on"
+       exit
+fi
+
+# 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 vprocunhide vservers-default; do
+    chroot ${vdir} /sbin/chkconfig $service off
+done
+
+# Disable splaying of cron.
+echo > ${vdir}/etc/sysconfig/crontab
+
+# Add site_admin account
+chroot ${vdir} /usr/sbin/useradd -p "" -u 502 -m site_admin
+
+# NOTE:  Removed due to incompatibility between fedora and centos, and b/c we
+# expect that enabling util-vserver above will help with shutdown.
+#
+# : this is added to ensure that processes running within the slices that
+# may have special permissions and other parts of the filesystem engated are
+# killed before shutdown.  We experienced hangs when rebooting without this
+# step.
+#( 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
+#
+# # Write to wtmp file before unmounting /var
+#EOF
+
+# NOTE:  This is added to relieve one site's Cisco router configuration that
+# fails to recognize the host once the arping is sent out.
+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