debootstrap create: activate serial console
authorGuido Trotter <ultrotter@google.com>
Thu, 14 Aug 2008 15:15:12 +0000 (15:15 +0000)
committerGuido Trotter <ultrotter@google.com>
Thu, 14 Aug 2008 15:15:12 +0000 (15:15 +0000)
If we make sure that the instance os spawns a getty on /dev/console we
cover both the case where console is on tty1 and the serial console one
where it's on ttyS0. In order to do this we modify /etc/inittab on
debian, and /etc/event.d on ubuntu.

Reviewed-by: imsnah

create.in

index 16c16ad..123e081 100755 (executable)
--- a/create.in
+++ b/create.in
@@ -142,6 +142,16 @@ auto lo
 iface lo inet loopback
 EOF
 
+if [ -e $TMPDIR/etc/inittab ]; then
+  cat $TMPDIR/etc/inittab | sed -re 's/\stty1$/ console/' \
+    > $TMPDIR/etc/inittab.new
+  mv $TMPDIR/etc/inittab.new $TMPDIR/etc/inittab
+elif [ -e $TMPDIR/etc/event.d/tty1 ]; then
+  cat $TMPDIR/etc/event.d/tty1 | sed -re 's/tty1/console/' \
+    > $TMPDIR/etc/event.d/console
+  rm $TMPDIR/etc/event.d/tty1
+fi
+
 umount $TMPDIR
 rmdir $TMPDIR
 trap - EXIT