[PATCH 7/7] sysvinit: Fix getty path in /etc/inittab on Hurd.
This is essentially the same as
89f6476d8979174f395a1bf784486254464c349d but fixes the existing
/etc/inittab file in the postinstall script.
---
debian/changelog | 1 +
debian/sysvinit.config | 43 +++++++++++++++++++++++++++++++++++++++++++
debian/sysvinit.postinst | 13 +++++++++++++
debian/sysvinit.templates | 15 +++++++++++++++
4 files changed, 72 insertions(+)
create mode 100755 debian/sysvinit.config
create mode 100644 debian/sysvinit.templates
diff --git a/debian/changelog b/debian/changelog
index dd1861d..441f395 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -62,6 +62,7 @@ sysvinit (2.88dsf-42) UNRELEASED; urgency=low
have /dev/root and the device ids used here are specific to Linux.
* killall5.c: Use sysconf(_SC_SYMLOOP_MAX) instead of MAXSYMLINKS.
Fixes build on Hurd.
+ * sysvinit.postinst: Fix file name of gettys in /etc/inittab on Hurd.
-- Roger Leigh <rleigh@debian.org> Sat, 04 May 2013 13:13:51 +0100
diff --git a/debian/sysvinit.config b/debian/sysvinit.config
new file mode 100755
index 0000000..ce34f63
--- /dev/null
+++ b/debian/sysvinit.config
@@ -0,0 +1,43 @@
+#!/bin/sh
+# config script for sysvinit
+#
+# see: dh_installdeb(1)
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+# summary of how this script can be called:
+# * <config> `configure' <installed-version>
+# * <config> `reconfigure' <installed-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+case "$1" in
+ configure|reconfigure)
+
+ if [ "$(uname)" = GNU ]; then
+ db_set sysvinit/hurd-fix-inittab "true"
+ if echo '3e3693078d18d4696c83a76531433cd4 /etc/inittab' \
+ | md5sum --status --check -; then
+ # The file is unmodified, update it silently.
+ :
+ elif fgrep -q '/libexec/getty' /etc/inittab; then
+ db_input low sysvinit/hurd-fix-inittab || true
+ db_go
+ fi
+ fi
+ ;;
+
+ *)
+ echo "config script called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/sysvinit.postinst b/debian/sysvinit.postinst
index 1750412..d78fe86 100755
--- a/debian/sysvinit.postinst
+++ b/debian/sysvinit.postinst
@@ -5,6 +5,9 @@
set -e
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
# Restart init, and migrate to /run/initctl if needed.
do_restart() {
INITCTL=/run/initctl
@@ -83,6 +86,16 @@ rm -f /etc/ioctl.save
if [ ! -f /etc/inittab ]
then
cp -p /usr/share/sysvinit/inittab /etc/inittab
+elif [ "$(uname)" = GNU ] && fgrep -q '/libexec/getty' /etc/inittab; then
+ rm -f -- /etc/inittab.dpkg-new
+ sed -e '/^[^#]/ s|/libexec/getty|/sbin/getty|' \
+ < /etc/inittab > /etc/inittab.dpkg-new
+
+ db_get sysvinit/hurd-fix-inittab
+ if [ "${RET}" = "true" ]; then
+ mv -- /etc/inittab /etc/inittab.dpkg-old
+ mv -- /etc/inittab.dpkg-new /etc/inittab
+ fi
fi
restart=yes
diff --git a/debian/sysvinit.templates b/debian/sysvinit.templates
new file mode 100644
index 0000000..935ae84
--- /dev/null
+++ b/debian/sysvinit.templates
@@ -0,0 +1,15 @@
+Template: sysvinit/hurd-fix-inittab
+Type: boolean
+_Description: Update getty file names in /etc/inittab?
+ Your /etc/inittab seems to use /libexec/getty as getty. The default
+ inittab has been changed, however your /etc/inittab has been
+ modified. Note that sysvinit has never been used to boot an Hurd
+ system, so any errors in that file would not have shown up.
+ .
+ Do you want me to change /etc/inittab to use /sbin/getty as getty?
+ .
+ If you choose yes, a backup will be stored in /etc/inittab.dpkg-old.
+ .
+ If you choose no, an updated inittab will be written to
+ /etc/inittab.dpkg-new. Please review the changes and update your
+ /etc/inittab accordingly.
--
1.7.10.4
Reply to: