From 6e4cf2ad59d9985eedd1f4d77351cdd0156586fb Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Sat, 12 Sep 2009 15:18:44 -0700 Subject: debian/local/pam-auth-update: only reset the seen flag on the template when there's new information; this avoids reprompting users for the same information on upgrade, regardless of the debconf priority used. Closes: #544805. --- debian/changelog | 4 ++++ debian/local/pam-auth-update | 25 ++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7e03fb7a..cd50eb8a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,10 @@ pam (1.1.0-4) UNRELEASED; urgency=low to make pam_securetty always return success on a secure tty regardless of what username was passed. Thanks to Nicolas François for the patch. Closes: #537848 + * debian/local/pam-auth-update: only reset the seen flag on the template + when there's new information; this avoids reprompting users for the same + information on upgrade, regardless of the debconf priority used. + Closes: #544805. -- Steve Langasek Thu, 10 Sep 2009 03:20:33 -0700 diff --git a/debian/local/pam-auth-update b/debian/local/pam-auth-update index acfb4002..1a1a452d 100755 --- a/debian/local/pam-auth-update +++ b/debian/local/pam-auth-update @@ -38,8 +38,9 @@ my $overridetemplate = 'libpam-runtime/override'; my $blanktemplate = 'libpam-runtime/no_profiles_chosen'; my $confdir = '/etc/pam.d'; my $savedir = '/var/lib/pam'; -my (%profiles, @sorted, @enabled, @conflicts, %removals); +my (%profiles, @sorted, @enabled, @conflicts, @new, %removals); my $force = 0; +my $package = 0; my $priority = 'high'; my %md5sums = ( 'auth' => ['8d4fe17e66ba25de16a117035d1396aa'], @@ -79,17 +80,19 @@ while ($#ARGV >= 0) { if ($opt eq '--force') { $force = 1; } elsif ($opt eq '--package') { - $priority = 'medium'; + $package = 1; } elsif ($opt eq '--remove') { while ($#ARGV >= 0) { last if ($ARGV[0] =~ /^--/); $removals{shift @ARGV} = 1; } # --remove implies --package - $priority = 'medium' if (keys(%removals)); + $package = 1 if (keys(%removals)); } } +$priority = 'medium' if ($package); + x_loadtemplatefile('/var/lib/dpkg/info/libpam-runtime.templates','libpam-runtime'); # always sort by priority, so we have consistency and don't have to @@ -141,9 +144,9 @@ push(@enabled, my $prev = ''; @enabled = grep { $_ ne $prev && (($prev) = $_) } @enabled; - -fset($template,'seen','false'); -set($template,join(', ', @enabled)); +# Do we have any new options to show? If not, we shouldn't reprompt the +# user, at any priority level, unless explicitly called. +@new = grep { !$seen{$_} } @sorted; # if diff_profiles() fails, and we weren't passed a 'force' argument # (because this isn't an upgrade from an old version, or the checksum @@ -170,6 +173,12 @@ umask(0022); do { @conflicts = (); + + if (@new || !$package) { + fset($template,'seen','false'); + } + set($template,join(', ', @enabled)); + input($priority,$template); go(); @@ -194,10 +203,12 @@ do { subst($errtemplate, 'conflicts', join("\n", @conflicts)); input('high',$errtemplate); } - fset($template,'seen','false'); set($template, join(', ', @enabled)); if (!@enabled) { input('high',$blanktemplate); + # we can only end up here by user error, but give them another + # shot at selecting a correct config anyway. + fset($template,'seen','false'); } } while (@conflicts || !@enabled); -- cgit v1.2.3