For upstart, we create the file /etc/init/hvc0.conf instead of adding a
line to /etc/inittab.

Signed-off-by: Ben Lipton <benlip...@google.com>
---
 instance-p2v-target/Makefile.am                  |    1 +
 instance-p2v-target/fixes/30_add_console_upstart |   35 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100755 instance-p2v-target/fixes/30_add_console_upstart

diff --git a/instance-p2v-target/Makefile.am b/instance-p2v-target/Makefile.am
index b83ccab..5385887 100644
--- a/instance-p2v-target/Makefile.am
+++ b/instance-p2v-target/Makefile.am
@@ -23,6 +23,7 @@ dist_fixes_SCRIPTS = \
        fixes/10_fix_fstab \
        fixes/20_remove_persistent_rules \
        fixes/30_add_console_inittab \
+       fixes/30_add_console_upstart \
        fixes/40_copy_hostname
 
 dist_fixlib_DATA = \
diff --git a/instance-p2v-target/fixes/30_add_console_upstart 
b/instance-p2v-target/fixes/30_add_console_upstart
new file mode 100755
index 0000000..0127ffe
--- /dev/null
+++ b/instance-p2v-target/fixes/30_add_console_upstart
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 Google Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+if [ -e /dev/hvc0 -a -d /target/etc/init ]; then  # xen, using upstart
+  if ! grep -q "/sbin/getty .* hvc0" /target/etc/init/*; then
+    cat >/target/etc/init/hvc0.conf <<EOF
+# hvc0 - getty
+#
+# This service maintains a getty on hvc0 from the point the system is
+# started until it is shut down again.
+
+start on stopped rc RUNLEVEL=[2345]
+stop on runlevel [!2345]
+
+respawn
+exec /sbin/getty -8 38400 hvc0
+EOF
+  fi
+fi
-- 
1.7.3.1

Reply via email to