refine strategy to spot ip address, keep on calling guest_ipv4
[build.git] / config.mlab / sliceimage.post
index dabcc1e..262a2ff 100644 (file)
@@ -16,9 +16,29 @@ sed -i -e "s/root:[\*|x]/root:/" ${vdir}/etc/passwd
 echo "in slice image: removing requiretty from /etc/sudoers"
 sed -i -e 's,^\(Defaults.*requiretty\),#\1,' ${vdir}/etc/sudoers
 
+# disable Upstart by creating a symlink to /bin/true
+#mv ${vdir}/sbin/initctl ${vdir}/sbin/initctl.orig
+chroot ${vdir} mv /sbin/initctl /sbin/initctl.orig
+chroot ${vdir} ln /bin/true /sbin/initctl 
+
 # Fix up /etc/init.d/halt 
+# xxx this would be wrong in f>=16 because there's no /sbin anymore
+# but I suspect this is for vserver only..
 echo "in slice image: fixing /etc/init.d/halt"
 cat > ${vdir}/etc/init.d/halt <<EOF
 #!/bin/bash
 exec /sbin/killall5 -15
 EOF
+
+# make sure we do not end up with an empty /selinux 
+# libvirt gets all confused when that happens
+cd ${vdir}
+if [ -d selinux ] ; then
+    if [ "$(ls -A selinux)" ] ; then
+       echo "sliceimage.post: WARNING: ${vdir}/selinux is not empty - preserving"
+    else
+       echo "sliceimage.post: REMOVING empty ${vdir}/selinux"
+       rmdir selinux
+    fi
+fi
+cd -