[PATCH 1/2] Fix hurd-console addition and getty pathnames in inittab [hurd].
---
debian/changelog | 8 ++++++++
debian/sysvinit-core.config | 3 ++-
debian/sysvinit-core.postinst | 30 +++++++++++++++++++++---------
debian/sysvinit-core.templates | 16 ++++++++--------
4 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index e4e68ba..e169360 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+sysvinit (2.88dsf-53) UNRELEASED; urgency=medium
+
+ * sysv-rc:
+ - [hurd] Fix hurd-console addition to inittab if inittab already existent.
+ - [hurd] Replace /libexec/getty in commented out lines as well.
+
+ -- Gabriele Giacone <1o5g4r8o@gmail.com> Mon, 31 Mar 2014 12:55:18 +0200
+
sysvinit (2.88dsf-52) experimental; urgency=low
* Upload to experimental to test the startpar migration.
diff --git a/debian/sysvinit-core.config b/debian/sysvinit-core.config
index ce34f63..a828037 100755
--- a/debian/sysvinit-core.config
+++ b/debian/sysvinit-core.config
@@ -22,7 +22,8 @@ case "$1" in
| md5sum --status --check -; then
# The file is unmodified, update it silently.
:
- elif fgrep -q '/libexec/getty' /etc/inittab; then
+ elif [ `fgrep -c -e '/libexec/getty' /etc/inittab` -gt 0 ] || \
+ [ `grep -c '^c:' /etc/inittab` -eq 0 ]; then
db_input low sysvinit/hurd-fix-inittab || true
db_go
fi
diff --git a/debian/sysvinit-core.postinst b/debian/sysvinit-core.postinst
index d78fe86..44b6fba 100755
--- a/debian/sysvinit-core.postinst
+++ b/debian/sysvinit-core.postinst
@@ -86,15 +86,27 @@ 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
+elif [ "$(uname)" = GNU ]; then
+ ITAB=/etc/inittab
+ ITABNEW=${ITAB}.dpkg-new
+ cp $ITAB $ITABNEW
+ if fgrep -q '/libexec/getty' $ITABNEW; then
+ sed -e 's|/libexec/getty|/sbin/getty|' \
+ -i $ITABNEW
+ fi
+ if ! grep -q '^c:' $ITABNEW; then
+ sed -e '/^6:/a c:23:respawn:/sbin/getty 38400 console' \
+ -i $ITABNEW
+ fi
+
+ if ! diff $ITAB $ITABNEW >/dev/null; then
+ db_get sysvinit/hurd-fix-inittab
+ if [ "${RET}" = "true" ]; then
+ mv -- $ITAB ${ITAB}.dpkg-old
+ mv -- $ITABNEW $ITAB
+ fi
+ else
+ rm -f -- $ITABNEW
fi
fi
diff --git a/debian/sysvinit-core.templates b/debian/sysvinit-core.templates
index 06c693c..759bbff 100644
--- a/debian/sysvinit-core.templates
+++ b/debian/sysvinit-core.templates
@@ -1,14 +1,14 @@
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.
+_Description: Update getty pathnames and add hurd-console?
+ Your /etc/inittab seems to use /libexec/getty as getty and/or to miss
+ hurd-console entry. 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.
.
- If you want to change /etc/inittab to use /sbin/getty as getty, choose
- yes. If you choose yes, a backup will be stored in /etc/inittab.dpkg-old.
+ If you allow this change, a backup will be stored in /etc/inittab.dpkg-old.
.
- If you choose no, an updated inittab will be written to
+ If you don't allow this change, an updated inittab will be written to
/etc/inittab.dpkg-new. Please review the changes and update your
/etc/inittab accordingly.
--
1.9.1
Reply to: