Package: sysvinit
Version: 2.88dsf-53
Severity: wishlist
Tags: patch

On hurd, attached patch fixes hurd-console addition to inittab if inittab file
is already present and fixes /libexec/getty replacement in commented out lines
as well.

Thanks for considering.
commit c7eb1326cf1bfb930298a13cb30a5e4902ead65d
Author: Gabriele Giacone <1o5g4...@gmail.com>
Date:   Tue Apr 1 10:54:01 2014 +0200

    Fix hurd-console addition and getty pathnames in inittab [hurd].

diff --git a/debian/changelog b/debian/changelog
index d3ba717..86a90a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+sysvinit (2.88dsf-55) 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 <1o5g4...@gmail.com>  Mon, 07 Apr 2014 12:59:55 +0200
+
 sysvinit (2.88dsf-54) experimental; urgency=medium
 
   [ Justus Winter ]
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.

Reply via email to