-
-# Write nodefamily stamp, to help bootmanager do the right thing
-mkdir -p $bootcd/etc/planetlab
-echo $nodefamily > $bootcd/etc/planetlab/nodefamily
+# ditto for f14 and higher init style
+if [ -d $bootcd/etc/init ] ; then
+ echo "* Tuning /etc/init/ for upstart"
+ pushd $bootcd/etc/init
+ # use our system initialisation script
+ sed -i -e 's,/etc/rc\.d/rc\.sysinit[a-z\.]*,/bin/bash -c /etc/init.d/pl_sysinit,g' rcS.conf
+ # use our startup script in runlevel 2
+ sed -i -e 's,/etc/rc.d/rc[a-z\.]*,/etc/init.d/pl_boot,g' rc.conf
+ popd
+fi
+# Install systemd files for f16 and above
+if [ -d $bootcd/etc/systemd/system ] ; then
+ echo "* Installing systemd files"
+ for file in pl_boot.service pl_boot.target ; do
+ install -D -m 644 systemd/$file $bootcd/etc/systemd/system
+ done
+ echo "* Enabling getty on tty2"
+ # select pl_boot target this way instead of using kargs, as kargs apply to kexec boot as well
+ ln -sf /etc/systemd/system/pl_boot.target $bootcd/etc/systemd/system/default.target
+ [ -d $bootcd/etc/systemd/system/pl_boot.target.wants ] || mkdir -p $bootcd/etc/systemd/system/pl_boot.target.wants
+ ln -sf /usr/lib/systemd/system/getty@.service $bootcd/etc/systemd/system/pl_boot.target.wants/getty@tty2.service
+fi