[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

kernel-headers: a patch



Hello all,

I promised to stay out of this argument, but in response to the claim that
it is "not easy" to make kernel-headers behave politely, I have produced the
following patch to the kernel-headers/kernel-source postinst/postrm scripts
which causes them to issue a warning, rather than abort, when /usr/src/linux
is not a symlink.

There are many good technical arguments for putting the user-installed
kernel source in /usr/src/linux, and equally many good arguments for
symlinking the debian headers into /usr/src/linux (whether always, or just
if it does not already exist).  We have heard many arguments on both sides. 
I believe that my patch achieves the best compromise in this situation.

Note that in the patch below, the /usr/src/linux symlink is still created if
possible.  If not possible, an extended message is printed suggesting to the
user that he should move the kernel source out of the way, as his
installation probably conflicts with official Debian policy.  But the
package installs successfully, which means that libc6-dev can install
successfully.

Incidentally, I was very impressed to find that postinst/postrm do such
extensive error checking.  In such a critical package (or rather, a package
which many critical packages depend on) such error checking is essential.

As I have mentioned several times, my only complaint about these scripts was
the unnecessary abort if /usr/src/linux is not a symlink.  Other than that,
these scripts are very well written and contain some of the most readable
and robust perl I have seen.  My compliments to Manoj, and my apologies for
making his work uglier.

Have fun,

Avery



--- include.postinst.old	Mon Jan 19 22:29:10 1998
+++ include.postinst	Mon Jan 19 22:44:22 1998
@@ -33,18 +33,17 @@
 # Test if we need to do anything at all. This test and exit make us
 # idempotent. 
 
+my $linuxlink_ok="yes";
 if (-e 'linux' && ! -l 'linux') {
+  $linuxlink_ok="no";
   my $answer;
   print STDERR <<"EOF";
- Error configuring $package: /usr/src/linux does not seem to be a 
+ Warning configuring $package: /usr/src/linux does not seem to be a 
        symbolic link, possibly from an old package or a left-over from a 
-       user installed kernel. Please remove /usr/src/linux and try to
-       reconfigure $package.  
-
- Please Hit return to continue.
+       user installed kernel. Please remove /usr/src/linux, as its existence
+       (except as a symbolic link) contradicts Debian policy.  Please
+       read /usr/doc/$package/LinkPolicy.gz for more information.
 EOF
-  $answer = <STDIN>;
-  exit 1;
 }
 
 if (-e "linux-$version" && ! -l "linux-$version" ) {
@@ -64,7 +63,8 @@
 # fine.  We now have a link.
 my $old_target='';
 $old_target = readlink('linux') if -e 'linux';
-die "could not read link /usr/src/linux:$!" unless defined $old_target;
+die "could not read link /usr/src/linux:$!" unless "$linuxlink_ok" eq "no"
+	or defined $old_target;
 
 # before we change the link, let us make sure that if the file
 # .linux-versions exists, we can read and write to it.
@@ -116,7 +116,7 @@
 }
 if ("$old_target" ne "$package") {
   if (-e 'linux') {
-    if (! unlink 'linux') {
+    if ("$linuxlink_ok" eq "yes" and ! unlink 'linux') {
       print STDERR <<"ERR";
   Could not remove /usr/src/linux to relink:$!
   Please change permissions and reconfigure $package.
@@ -133,7 +133,7 @@
       exit 1;
     }
   }
-  if (! symlink $package, 'linux') {
+  if ("$linuxlink_ok" eq "yes" and ! symlink $package, 'linux') {
     print STDERR <<"ERR";
   Could not link /usr/src/$package to /usr/src/linux.  
   Please add the link by hand.
--- include.postrm.old	Mon Jan 19 22:36:42 1998
+++ include.postrm	Mon Jan 19 22:42:15 1998
@@ -109,10 +109,10 @@
 # Test if we need to do anything at all. This test and exit make us
 # idempotent. 
 
+my $linuxlink_ok="yes";
 if (! -l 'linux') {
-  print STDERR 
-    "Error: /usr/src/linux not a symbolic link, not removing.\n";
-  exit 1;
+  $linuxlink_ok="no";
+  warn "/usr/src/linux not a symbolic link, not removing.\n";
 }
 if (! -l "linux-$version") {
   print STDERR 
@@ -121,9 +121,10 @@
 }
 # fine.  We now have a link.
 my $old_target = readlink('linux');
-die "could not read link /usr/src/linux:$!" unless defined $old_target;
+die "could not read link /usr/src/linux:$!" unless "$linuxlink_ok" eq "no"
+		or defined $old_target;
 
-if ("$old_target" eq "$package") {
+if ("$linuxlink_ok" eq "yes" and "$old_target" eq "$package") {
   unlink 'linux' or do {
     print STDERR <<"ERR";
   Could not remove /usr/src/linux ($!)
@@ -143,7 +144,7 @@
   
   if ($LastVersion) {
     if (-d "$LastVersion") {
-      symlink $LastVersion, "linux" or 
+      "$linuxlink_ok" eq "no" or symlink $LastVersion, "linux" or 
 	die "Error linking /usr/src/$LastVersion to /usr/src/linux: $!";
     }
     else {


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: