Sfoglia il codice sorgente

update-alternatives: --all can be used to restore broken alternatives

Since alternatives are repaired every time they are reconfigured,
the user can use --all to reconfigure them all with the current choice
and repair everything. Document this in the manual pages and ensure
that it really works that way by returning a valid choice.
Closes: #250258, #395556
Raphael Hertzog 17 anni fa
parent
commit
b633f89b56
4 ha cambiato i file con 14 aggiunte e 1 eliminazioni
  1. 9 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 2 0
      man/update-alternatives.8
  4. 1 1
      scripts/update-alternatives.pl

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+2009-02-22  Raphael Hertzog  <hertzog@debian.org>
+
+	* man/update-alternatives.8: Document how --all can be used to
+	repair all alternatives on the system in a single command.
+	* scripts/update-alternatives.pl: Ensure the above explanation
+	is true by ensuring that --config does something sensible when
+	no alternative is currently selected and when the user input is
+	empty: it will auto-select the best alternative.
+
 2009-02-22  Raphael Hertzog  <hertzog@debian.org>
 
 	* scripts/update-alternatives.pl: Implement --set-selections.

+ 2 - 0
debian/changelog

@@ -168,6 +168,8 @@ dpkg (1.15.0) UNRELEASED; urgency=low
       alternatives. Closes: #273406, #392429
     - new option --set-selections to reconfigure a set of alternatives in
       a single command.
+  * Document in update-alternatives(8) how one can repair all broken
+    alternatives with a single command. Closes: #250258, #395556
 
   [ Pierre Habouzit ]
   * Add a --query option to update-alternatives. Closes: #336091, #441904

+ 2 - 0
man/update-alternatives.8

@@ -270,6 +270,8 @@ is a name in the alternatives directory.
 Call \fB\-\-config\fP on all alternatives. It can be usefully combined with
 \fB\-\-skip\-auto\fP to review and configure all alternatives which are
 not configured in automatic mode. Broken alternatives are also displayed.
+Thus a simple way to fix all broken alternatives is to call
+\fByes \[aq]\[aq] | update-alternatives \-\-force \-\-all\fR.
 .TP
 \fB\-\-auto\fR \fIname\fR
 Switch the link group behind the alternative name

+ 1 - 1
scripts/update-alternatives.pl

@@ -908,7 +908,7 @@ sub select_choice {
         my $selection = <STDIN>;
         return undef unless defined($selection);
         chomp($selection);
-        return $current if $selection eq "";
+        return ($current || $best) if $selection eq "";
         if (exists $sel{$selection}) {
             $self->set_status(($selection eq "0") ? "auto" : "manual");
             return $sel{$selection};