summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Collins <bcollins@debian.org>1999-10-21 15:38:03 +0000
committerBen Collins <bcollins@debian.org>1999-10-21 15:38:03 +0000
commitb8a68bfb194b6d99fbb14804abb2853414dbd288 (patch)
treeaacec906b30ad2d6a2af0ea9aab2307febc54d7f
parent6ffb7b501e4eaf505c9502b54de8dc1aa5a62b0a (diff)
downloaddpkg-b8a68bfb194b6d99fbb14804abb2853414dbd288.tar.gz
* Fixed the check that was added to dpkg-divert.
* Removed the lib version checking. * Oops, somehow the --config feature went missing from update- alternatives
-rw-r--r--ChangeLog7
-rw-r--r--debian/changelog3
-rwxr-xr-xscripts/dpkg-divert.pl6
-rwxr-xr-xscripts/update-alternatives.pl49
4 files changed, 60 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 69c255d67..3f5b2b40a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Oct 21 10:22:43 EDT 1999 Ben Collins <bcollins.debian.org>
+
+ * Fixed the check that was added to dpkg-divert.
+ * Removed the lib version checking.
+ * Oops, somehow the --config feature went missing from update-
+ alternatives
+
Thu Oct 21 13:22:42 CEST 1999 Wichert Akkerman <wakkerma@debian.org>
* Update copyright (taken from dpkg-iwj tree, with Ben added)
diff --git a/debian/changelog b/debian/changelog
index 82527e474..51a60657d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -52,9 +52,6 @@ dpkg (1.4.1.17) unstable; urgency=low
say it's installed, and not that it is in an unconfigurable
state
* Fixed some compiler warnings
- * Add function to libdpkg that dpkg can call to make sure it's
- compiled version matches that of the library. If it fails,
- complain loudly, but allow to proceed
* Make dpkg check for uid 0 requirement, before checking the path
since not being root, is probably the reason that the PATH is
borked in the first place
diff --git a/scripts/dpkg-divert.pl b/scripts/dpkg-divert.pl
index 9728ec88b..f82523737 100755
--- a/scripts/dpkg-divert.pl
+++ b/scripts/dpkg-divert.pl
@@ -183,8 +183,12 @@ sub checkrename {
(@sdest= lstat($rdest)) || $! == &ENOENT ||
&quit("cannot stat new name \`$rdest': $!");
$exist{$rdest} = 1 unless $! != &ENOENT;
+ # Unfortunately we have to check for write access in both
+ # places, just having +w is not enough, since people do
+ # mount things RO, and we need to fail before we start
+ # mucking around with things
foreach $file ($rsrc,$rdest) {
- open (TMP, "a $file") || &quit("error checking \`$file': $!");
+ open (TMP, ">> $file") || &quit("error checking \`$file': $!");
close TMP;
if ($exist{$file} == 1) {
unlink ("$file");
diff --git a/scripts/update-alternatives.pl b/scripts/update-alternatives.pl
index 28392846d..cf9484735 100755
--- a/scripts/update-alternatives.pl
+++ b/scripts/update-alternatives.pl
@@ -16,6 +16,7 @@ Usage: update-alternatives --install <link> <name> <path> <priority>
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 @@ while (@ARGV) {
@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;
@@ -173,6 +174,15 @@ for ($i=0; $i<=$#versions; $i++) {
}
}
+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';
@@ -422,6 +432,43 @@ if ($manual eq 'auto') {
}
}
+sub config_message {
+ if ($#versions == 0) {
+ print "\nThere is only 1 program which provides $name\n";
+ print "($versions[0]). Nothing to configure.\n";
+ return;
+ }
+ printf(STDOUT "\nThere are %s programs which provide \`$name'.\n\n", $#versions+1);
+ printf(STDOUT " Selection Command\n");
+ printf(STDOUT "-----------------------------------------------\n");
+ for ($i=0; $i<=$#versions; $i++) {
+ if ($best eq $versions[$i]) {
+ printf(STDOUT "* %s %s\n", $i+1, $versions[$i]);
+ } else {
+ printf(STDOUT " %s %s\n", $i+1, $versions[$i]);
+ }
+ }
+ printf(STDOUT "\nEnter to keep the default[*], or type selection number: ");
+}
+
+sub config_alternatives {
+ do {
+ &config_message;
+ if ($#versions == 0) { return; }
+ $preferred=<STDIN>;
+ chop($preferred);
+ } until $preferred eq '' || $preferred>=1 && $preferred<=$#versions+1 &&
+ ($preferred =~ m/[0-9]*/);
+ if ($preferred ne '') {
+ $preferred--;
+ my $spath = $versions[$preferred];
+ symlink("$spath","$altdir/$name.dpkg-tmp") ||
+ &quit("unable to make $altdir/$name.dpkg-tmp a symlink to $spath: $!");
+ rename_mv("$altdir/$name.dpkg-tmp","$altdir/$name") ||
+ &quit("unable to install $altdir/$name.dpkg-tmp as $altdir/$name: $!");
+ }
+}
+
sub pr { print(STDOUT "@_\n") || &quit("error writing stdout: $!"); }
sub paf {
$_[0] =~ m/\n/ && &quit("newlines prohibited in update-alternatives files ($_[0])");