Package: dpkg
Version: 1.0.6

1.  Missing documentation:
  No man pages for dpkg, update-rc.d, and update-alternatives.

2.  dpkg/update-alternatives doesn't give me the level of installation
control I expected.  If one wants to install each of elvis/nvi/vim (each
of which provides vi), dpkg will automatically select the alternative it
thinks is best for vi to point to (it takes its que from the priority
that the package maintainers suggest).  The sysadmin gets no say during
installation.  And after installation, it requires some source code
reading to puzzle out how to configure things.

I think the problem is an inadequacy in update-alternatives and dpkg to
provide a choice among alternatives.  Perhaps, an option can be added to
update-alternatives (maybe update-alternatives --config or somesuch) that
would prompt the local sysadmin to choose which of the alternatives to
have the link point to.  Then, dpkg could be made to understand that if
a package with dependency "altdepend-name" (or somesuch) were selected
for installation, dpkg should run "update-alternatives --config name"
to let the sysadmin manually resolve the dependency (or choose a default
as it currently does).

update-alternatives --test isn't implemented.

I have patched update-alternatives to provide a --config option.  Here
is my patch:

--- /usr/sbin/update-alternatives       Tue Nov 21 15:30:53 1995
+++ update-alternatives Tue Nov 28 22:08:27 1995
@@ -16,6 +16,7 @@
        update-alternatives --remove <name> <path>
        update-alternatives --auto <name>
        update-alternatives --display <name>
+       update-alternatives --config <name>
 <name> is the name in /etc/alternatives.
 <path> is the name referred to.
 <link> is the link pointing to /etc/alternatives/<name>.
@@ -66,7 +67,7 @@
         @ARGV >= 2 || &badusage("--remove needs <name> <path>");
         ($name,$apath,@ARGV) = @ARGV;
         $mode= 'remove';
-    } elsif (m/^--(display|auto)$/) {
+    } elsif (m/^--(display|auto|config)$/) {
         &checkmanymodes;
         @ARGV || &badusage("--$1 needs <name>");
         $mode= $1;
@@ -164,6 +165,15 @@
     }
 }

+if ($mode eq 'config') {
+    if (!$dataread) {
+        &pr("No alternatives for $name.");
+    } else {
+        &config_alternatives($name);
+        exit 0;
+    }
+}
+
 if (defined($linkname= readlink("$altdir/$name"))) {
     if ($linkname eq $best) {
         $state= 'expected';
@@ -423,6 +433,42 @@
 }
 sub badfmt {
     &quit("internal error: $admindir/$name corrupt: $_[0]");
+}
+sub config_message {
+    printf(STDOUT "\nYou have selected %s package(s) which", $#versions+1);
+    printf(STDOUT " provide the $name command:\n");
+    printf(STDOUT "  Selection    Command-Name        Command\n");
+    printf(STDOUT "-----------------------------------------------\n");
+    for ($i=0; $i<=$#versions; $i++) {
+        if ($best eq $versions[$i]) {
+            printf(STDOUT "*     %s            %s           %s\n", $i+1,
+                $name, $versions[$i]);
+        } else {
+            printf(STDOUT "      %s            %s           %s\n", $i+1,
+                $name, $versions[$i]);
+        }
+    }
+    printf(STDOUT "Which program would you like to provide the $name 
command?\n");
+    printf(STDOUT "Enter the selection number [1-%s] or ENTER to keep the 
default.\n", $#versions+1);
+}
+sub config_alternatives {
+    do {
+        &config_message;
+        $preferred=<STDIN>;
+        chop($preferred);
+    } until $preferred eq '' || $preferred>=1 && $preferred<=$#versions+1 &&
+        length($preferred)==1;
+    if ($preferred ne '') {
+        $preferred--;
+        if ($bestpri > $priorities[$preferred]) {
+            $newpriority = 10 + $bestpri;
+            system("/bin/sed -e \'s/$priorities[$preferred]/$newpriority/\' 
$admindir/$name > $admindir/$name.dpkg-tmp");
+            rename("$admindir/$name.dpkg-tmp", "$admindir/$name") ||
+                &quit("unable to rename \
+                    $admindir/$name.dpkg-tmp to $admindir/$name: $!");
+            system("/usr/sbin/update-alternatives --auto $name");
+        }
+    }
 }

 exit(0);

3.  When updating conffiles, would it be possible for dpkg to present the
sysadmin with a diff of the installed conffile and the one in the
archive?  This might help one determine if they should start over from
scratch, back up current copies, or whatever.

--
Christopher J. Fearnley            |    UNIX SIG Leader at PACS
[EMAIL PROTECTED] (finger me!)        |    (Philadelphia Area Computer Society)
[EMAIL PROTECTED]             |    Design Science Revolutionary
http://www.netaxs.com/~cjf         |    Explorer in Universe
"Dare to be Naive" -- Bucky Fuller |    Linux Advocate

Reply via email to