Hi,

the patch as in the NMU is in the attachment. (Proposed changes +
changelog entry.)

bye,
  Roland
diff -ruN update-inetd-4.27.orig/debian/changelog update-inetd-4.27/debian/changelog
--- update-inetd-4.27.orig/debian/changelog	2006-09-10 12:24:46.000000000 +0200
+++ update-inetd-4.27/debian/changelog	2006-11-12 13:55:03.000000000 +0100
@@ -1,3 +1,11 @@
+update-inetd (4.27-0.1) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Changes interactive configuration acknowledgements to debconf questions
+    (Closes: #282147)
+
+ -- Roland Stigge <[EMAIL PROTECTED]>  Sun, 12 Nov 2006 13:30:32 +0100
+
 update-inetd (4.27) unstable; urgency=low
 
   * First upload.
diff -ruN update-inetd-4.27.orig/debian/control update-inetd-4.27/debian/control
--- update-inetd-4.27.orig/debian/control	2006-09-10 21:53:05.000000000 +0200
+++ update-inetd-4.27/debian/control	2006-11-12 13:54:45.000000000 +0100
@@ -10,6 +10,7 @@
 Package: update-inetd
 Architecture: all
 Conflicts: netbase (<< 4.27)
+Depends: debconf
 Description: inetd.conf updater
  This package provides a program used by other packages to automatically
  update /etc/inetd.conf.
diff -ruN update-inetd-4.27.orig/debian/postinst update-inetd-4.27/debian/postinst
--- update-inetd-4.27.orig/debian/postinst	1970-01-01 01:00:00.000000000 +0100
+++ update-inetd-4.27/debian/postinst	2006-11-12 13:54:45.000000000 +0100
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+# Abort if any command returns an error value
+set -e
+
+if [ "$1" == "configure" -o "$1" == "reconfigure" ] ; then
+	. /usr/share/debconf/confmodule
+	db_capb
+fi
diff -ruN update-inetd-4.27.orig/debian/rules update-inetd-4.27/debian/rules
--- update-inetd-4.27.orig/debian/rules	2006-09-10 21:53:01.000000000 +0200
+++ update-inetd-4.27/debian/rules	2006-11-12 13:54:45.000000000 +0100
@@ -22,6 +22,7 @@
 
 	dh_installchangelogs
 	dh_installdocs
+	dh_installdebconf
 	dh_installman DebianNet.3pm update-inetd.8
 	dh_compress
 	dh_fixperms
diff -ruN update-inetd-4.27.orig/debian/templates update-inetd-4.27/debian/templates
--- update-inetd-4.27.orig/debian/templates	1970-01-01 01:00:00.000000000 +0100
+++ update-inetd-4.27/debian/templates	2006-11-12 13:54:45.000000000 +0100
@@ -0,0 +1,37 @@
+Template: update-inetd/ask-several-entries
+Type: select
+Choices: yes, no
+Default: yes
+Description: Ignore multiple entries and continue without changes?
+ There are several entries for ${sservice} in ${inetdcf}.
+
+Template: update-inetd/ask-entry-present
+Type: select
+Choices: yes, no
+Default: yes
+Description: Leave existing entry and continue without changes?
+ Trying to add the following entry:
+ .
+ ${newentry}
+ .
+ There is already an entry for ${sservice} in ${inetdcf},
+ but I don't recognise it.  Here is what it looks like:
+ .
+ ${lookslike}
+
+Template: update-inetd/ask-remove-entries
+Type: select
+Choices: yes, no
+Default: no
+Description: Remove inetd entries?
+ ${inetdcf} contains multiple entries for
+ the `${service}' service. You're about to remove these entries.
+
+Template: update-inetd/ask-disable-entries
+Type: select
+Choices: yes, no
+Default: no
+Description: Disable inetd entries?
+ ${inetdcf} contains multiple entries for
+ the `${service}' service. You're about to disable these entries.
+
diff -ruN update-inetd-4.27.orig/DebianNet.pm update-inetd-4.27/DebianNet.pm
--- update-inetd-4.27.orig/DebianNet.pm	2005-03-21 19:54:31.000000000 +0100
+++ update-inetd-4.27/DebianNet.pm	2006-11-12 13:54:45.000000000 +0100
@@ -14,6 +14,8 @@
 
 require 5.000;
 
+use Debconf::Client::ConfModule ':all';
+
 $inetdcf="/etc/inetd.conf";
 $sep = "#<off># ";
 $version = "1.11";
@@ -46,12 +48,31 @@
         } else {
             if (grep(m/^$sservice\s+/,@inetd)) {
                 if (grep(m/^$sservice\s+/,@inetd) > 1) {
-                    &inetde("There are several entries for $sservice in $inetdcf\n");
+		    set("update-inetd/ask-several-entries", "yes");
+		    fset("update-inetd/ask-several-entries", "seen", "false");
+		    subst("update-inetd/ask-several-entries", "sservice", "$sservice");
+		    subst("update-inetd/ask-several-entries", "inetdcf", "$inetdcf");
+		    input("high", "update-inetd/ask-several-entries");
+		    @ret = go();
+		    if ($ret[0] == 0) {
+		        @ret = get("update-inetd/ask-several-entries");
+			exit(1) if ($ret[1] !~ m/y/i);
+		    }
                 } elsif (!grep(m:^#?.*$searchentry.*:, @inetd)) {
-                    print"\nTrying to add the following entry:\n\n $newentry\n\n";
-                    &inetde("There is already an entry for $sservice in $inetdcf,
-but I don't recognise it.  Here is what it looks like:\n
- ".join(' ',grep(m/^$sservice\s+/,@inetd)));
+		    set("update-inetd/ask-entry-present", "yes");
+		    fset("update-inetd/ask-entry-present", "seen", "false");
+		    subst("update-inetd/ask-entry-present", "newentry", "$newentry");
+		    subst("update-inetd/ask-entry-present", "sservice", "$sservice");
+		    subst("update-inetd/ask-entry-present", "inetdcf", "$inetdcf");
+		    my $lookslike = (grep(m/^$sservice\s+/,@inetd))[0];
+		    $lookslike =~ s/\n//g;
+		    subst("update-inetd/ask-entry-present", "lookslike", "$lookslike");
+		    input("high", "update-inetd/ask-entry-present");
+		    @ret = go();
+		    if ($ret[0] == 0) {
+		        @ret = get("update-inetd/ask-entry-present");
+			exit(1) if ($ret[1] !~ m/y/i);
+		    }
                 }
             } elsif (grep(m/^#\s*$sservice\s+/, @inetd) >= 1 or
               (($service =~ s/^#//) and grep(m/^$service\s+/, @inetd)>=1)) {
@@ -90,17 +111,6 @@
         }
     }
 
-    sub inetde {
-        my($response);
-        do {
-            print @_,
-"\nDo you want to ignore this potential problem and continue, or would
-you rather not do so now ?  Continue?  (n/y) ";
-            $!=0; defined($response=<STDIN>) || die "netconfig: EOF/error on stdin: $!\n";
-        } while ($response !~ m/^\s*[yn]?\s*$/i);
-        return(1) if($response =~ m/y/i);
-        exit(1);
-    }
     return(1);
 }
 
@@ -109,21 +119,20 @@
     unless(defined($service)) { return(-1) };
     chomp($service);
     if($service eq "") {
-         print "DebianNet::remove_service called with empty argument\n";
+         print STDERR "DebianNet::remove_service called with empty argument\n";
          return(-1);
     }
 
     if ((&scan_entries("$service") > 1) and (not defined($multi))) {
-        print "\nWARNING!!!!!! $inetdcf contains multiple entries for \n";
-        print "the \`$service' service. You're about to remove these entries.\n";
-        print "Do you want to continue? [n] ";
-        if (<STDIN> =~ /^[^y]/i) {
-            print "\nOk, I'll stop ...\n";
-            return(1);
-        } else {
-            if ($want_continue == 0) {
-                print "\nOk, I'll continue ...\n";
-            }
+	set("update-inetd/ask-remove-entries", "no");
+	fset("update-inetd/ask-remove-entries", "seen", "false");
+        subst("update-inetd/ask-remove-entries", "service", "$service");
+	subst("update-inetd/ask-remove-entries", "inetdcf", "$inetdcf");
+	input("high", "update-inetd/ask-remove-entries");
+	@ret = go();
+	if ($ret[0] == 0) {
+	    @ret = get("update-inetd/ask-remove-entries");
+	    return(1) if ($ret[1] =~ /^[^y]/i);
         }
     }
 
@@ -154,16 +163,15 @@
     chomp($service);
 
     if ((&scan_entries("$service", $pattern) > 1) and (not defined($multi))) {
-        print "\nWARNING!!!!!! $inetdcf contains multiple entries for \n";
-        print "the \`$service' service. You're about to disable these entries.\n";
-        print "Do you want to continue? [n] ";
-        if (<STDIN> =~ /^[^y]/i) {
-            print "\nOk, I'll stop ...\n";
-            return(1);
-        } else {
-            if ($want_continue == 0) {
-                print "\nOk, I'll continue ...\n";
-            }
+	set("update-inetd/ask-disable-entries", "no");
+	fset("update-inetd/ask-disable-entries", "seen", "false");
+        subst("update-inetd/ask-disable-entries", "service", "$service");
+	subst("update-inetd/ask-disable-entries", "inetdcf", "$inetdcf");
+	input("high", "update-inetd/ask-disable-entries");
+	@ret = go();
+	if ($ret[0] == 0) {
+	    @ret = get("update-inetd/ask-disable-entries");
+	    return(1) if ($ret[1] =~ /^[^y]/i);
         }
     }
 
@@ -240,7 +248,7 @@
 }
 
 sub printv {
-    print @_ if (defined($verbose));
+    print STDERR @_ if (defined($verbose));
 }
 
 1;
diff -ruN update-inetd-4.27.orig/update-inetd update-inetd-4.27/update-inetd
--- update-inetd-4.27.orig/update-inetd	2005-03-21 19:21:53.000000000 +0100
+++ update-inetd-4.27/update-inetd	2006-11-12 13:54:45.000000000 +0100
@@ -22,15 +22,6 @@
 require 5.000;
 require DebianNet;
 
-# hack to make update-inetd work in a script which calls debconf
-if($ENV{DEBIAN_HAS_FRONTEND}) {
-    my $file = ($ENV{DEBIAN_FRONTEND} eq 'noninteractive') ?
-	'/dev/null' : '/dev/tty'; # see 4.13 changelog entry
-    open(STDIN,  "<$file") or die "Couldn't reopen stdin($file): $!";
-    open(STDOUT, ">$file") or die "Couldn't reopen stdout($file): $!";
-    open(STDERR, ">$file") or die "Couldn't reopen stderr($file): $!";
-}
-
 $| = 1;
 
 $version = "1.12";
@@ -73,8 +64,8 @@
         $pattern = shift(@ARGV);
         die "$0: Option \`--pattern' requires an argument\n" unless ($pattern and not ($pattern =~ m/^--/));
     } else {
-        print "$0: Unknown option: $_\n";
-        print "Try \`$0 --help' for more information.\n";
+        print STDERR "$0: Unknown option: $_\n";
+        print STDERR "Try \`$0 --help' for more information.\n";
         exit(1);
     }
 }
@@ -86,29 +77,29 @@
 # die "You must be root to run this script.\n" if ($> != 0);
 
 if ($#ARGV > 0) {
-    print "Too many arguments!\n";
+    print STDERR "Too many arguments!\n";
 } elsif ($#ARGV == -1) {
-    print "Too few arguments!\n";
+    print STDERR "Too few arguments!\n";
 } else {
     $modearg = $ARGV[0];
     die "The service name may not include a whitespace character!\n" if (($mode eq "enable" or $mode eq "disable") and ($modearg =~ /\s+|\\t/));
     die "The entry definition does not contain any whitespace characters!\n" if ($mode eq "add" and not ($modearg =~ /\s+|\\t/));
 }
 
-print "Processing $DebianNet::inetdcf\n" if (defined($DebianNet::verbose));
-print "Using mode \"$mode\", group \"$group\", pattern \"$pattern\" and seperator \"$DebianNet::sep\"\n" if (defined($debug));
-print "Multiple remove/disable: $DebianNet::multi\n" if (defined($debug) and defined($DebianNet::multi));
-print "ARGUMENT: $modearg\n" if (defined($debug));
+print STDERR "Processing $DebianNet::inetdcf\n" if (defined($DebianNet::verbose));
+print STDERR "Using mode \"$mode\", group \"$group\", pattern \"$pattern\" and seperator \"$DebianNet::sep\"\n" if (defined($debug));
+print STDERR "Multiple remove/disable: $DebianNet::multi\n" if (defined($debug) and defined($DebianNet::multi));
+print STDERR "ARGUMENT: $modearg\n" if (defined($debug));
 
 if ($mode eq "add") {
     if (( -f "/etc/xinetd.conf" ) && ( -x "/usr/sbin/xinetd" )) {
-        print "--------- IMPORTANT INFORMATION FOR XINETD USERS ----------\n";
-        print "The following line will be added to your /etc/inetd.conf file:\n\n";
-        print "$modearg\n\n";
-        print "If you are indeed using xinetd, you will have to convert the\n";
-        print "above into /etc/xinetd.conf format, and add it manually. See\n";
-        print "/usr/share/doc/xinetd/README.Debian for more information.\n";
-        print "-----------------------------------------------------------\n\n";
+        print STDERR "--------- IMPORTANT INFORMATION FOR XINETD USERS ----------\n";
+        print STDERR "The following line will be added to your /etc/inetd.conf file:\n\n";
+        print STDERR "$modearg\n\n";
+        print STDERR "If you are indeed using xinetd, you will have to convert the\n";
+        print STDERR "above into /etc/xinetd.conf format, and add it manually. See\n";
+        print STDERR "/usr/share/doc/xinetd/README.Debian for more information.\n";
+        print STDERR "-----------------------------------------------------------\n\n";
     }
 
     DebianNet::add_service($modearg, $group);
@@ -131,13 +122,13 @@
 }
 
 sub version {
-    print "$0 $version\n";
-    print "DebianNet module $DebianNet::version\n";
+    print STDERR "$0 $version\n";
+    print STDERR "DebianNet module $DebianNet::version\n";
     exit(0);
 }
 
 sub usage {
-    print <<EOF;
+    print STDERR <<EOF;
 Usage: $0 [OPTION] MODE ARGUMENT
 
 Options:

Reply via email to