on the topic of removing useless code in Maintainer scripts, the official linux-2.6 images want to always update /linux/module/${version} dir so we can also drop related code of not doing so and related templates:
diff --git a/linux-2.6/debian/templates/temp.image.plain/postinst b/linux-2.6/debian/templates/temp.image.plain/postinst index 4508376..ceb0b48 100755 --- a/linux-2.6/debian/templates/temp.image.plain/postinst +++ b/linux-2.6/debian/templates/temp.image.plain/postinst @@ -36,7 +36,6 @@ my $move_image = ''; # target machine defined my $kimage = "=K"; # Should be empty, mostly my $loader = "=L"; # lilo, silo, quik, palo, vmelilo, nettrom, arcboot or delo my $image_dir = "=D"; # where the image is located -my $clobber_modules = ''; # target machine defined my $relative_links = ""; # target machine defined my $mkimage = "=M"; # command to generate the initrd image my $use_hard_links = ''; # hardlinks do not work across fs boundaries @@ -77,7 +76,6 @@ my $temp_file_name = "/var/log/$loader" . "_log.$$"; my $image_dest = "/"; my $realimageloc = "/$image_dir/"; my $have_conffile = ""; -my $silent_modules = ''; my $silent_loader = ''; my $modules_base = '/lib/modules'; @@ -112,12 +110,10 @@ if (-r "$CONF_LOC" && -f "$CONF_LOC" ) { $reverse_symlink = "" if /reverse_symlink\s*=\s*(no|false|0)\s*$/ig; $link_in_boot = "" if /link_in_boot\s*=\s*(no|false|0)\s*$/ig; $move_image = "" if /move_image\s*=\s*(no|false|0)\s*$/ig; - $clobber_modules = '' if /clobber_modules\s*=\s*(no|false|0)\s*$/ig; $do_boot_enable = '' if /do_boot_enable\s*=\s*(no|false|0)\s*$/ig; $relative_links = '' if /relative_links \s*=\s*(no|false|0)\s*$/ig; $do_bootloader = '' if /do_bootloader\s*=\s*(no|false|0)\s*$/ig; $use_hard_links = '' if /use_hard_links\s*=\s*(no|false|0)\s*$/ig; - $silent_modules = '' if /silent_modules\s*=\s*(no|false|0)\s*$/ig; $silent_loader = '' if /silent_loader\s*=\s*(no|false|0)\s*$/ig; $minimal_swap = '' if /minimal_swap\s*=\s*(no|false|0)\s*$/ig; $ignore_depmod_err = '' if /ignore_depmod_err\s*=\s*(no|false|0)\s*$/ig; @@ -130,13 +126,11 @@ if (-r "$CONF_LOC" && -f "$CONF_LOC" ) { $reverse_symlink = "Yes" if /reverse_symlinks\s*=\s*(yes|true|1)\s*$/ig; $link_in_boot = "Yes" if /link_in_boot\s*=\s*(yes|true|1)\s*$/ig; $move_image = "Yes" if /move_image\s*=\s*(yes|true|1)\s*$/ig; - $clobber_modules = "Yes" if /clobber_modules\s*=\s*(yes|true|1)\s*$/ig; $do_boot_enable = "Yes" if /do_boot_enable\s*=\s*(yes|true|1)\s*$/ig; $do_bootloader = "Yes" if /do_bootloader\s*=\s*(yes|true|1)\s*$/ig; $explicit_do_loader = "YES" if /do_bootloader\s*=\s*(yes|true|1)\s*$/ig; $relative_links = "Yes" if /relative_links\s*=\s*(yes|true|1)\s*$/ig; $use_hard_links = "Yes" if /use_hard_links\s*=\s*(yes|true|1)\s*$/ig; - $silent_modules = 'Yes' if /silent_modules\s*=\s*(yes|true|1)\s*$/ig; $silent_loader = 'Yes' if /silent_loader\s*=\s*(yes|true|1)\s*$/ig; $minimal_swap = 'Yes' if /minimal_swap\s*=\s*(yes|true|1)\s*$/ig; $ignore_depmod_err = 'Yes' if /ignore_depmod_err\s*=\s*(yes|true|1)\s*$/ig; diff --git a/linux-2.6/debian/templates/temp.image.plain/postrm b/linux-2.6/debian/templates/temp.image.plain/postrm index d31f2ee..c44b17c 100755 --- a/linux-2.6/debian/templates/temp.image.plain/postrm +++ b/linux-2.6/debian/templates/temp.image.plain/postrm @@ -46,7 +46,6 @@ my $move_image = ''; # target machine defined my $kimage = "=K"; # Should be empty, mostly my $loader = "=L"; # lilo, silo, quik, palo, vmelilo, or nettrom my $image_dir = "=D"; # where the image is located -my $clobber_modules = ''; # target machine defined my $use_hard_links = ''; # hardlinks do not work across fs boundaries my $postinst_hook = ''; #Normally we do not my $postrm_hook = ''; #Normally we do not @@ -92,7 +91,6 @@ my $realimageloc = "/$image_dir/"; my $have_conffile = ""; my $CONF_LOC = '/etc/kernel-img.conf'; my $relative_links = ''; -my $silent_modules = ''; my $silent_loader = ''; chdir('/') or die "could not chdir to /:$!\n"; @@ -113,12 +111,10 @@ if (-r "$CONF_LOC" && -f "$CONF_LOC" ) { $reverse_symlink = "" if /reverse_symlinks\s*=\s*(no|false|0)\s*$/ig; $link_in_boot = "" if /link_in_boot\s*=\s*(no|false|0)\s*$/ig; $move_image = "" if /move_image\s*=\s*(no|false|0)\s*$/ig; - $clobber_modules = '' if /clobber_modules\s*=\s*(no|false|0)\s*$/ig; $do_boot_enable = '' if /do_boot_enable\s*=\s*(no|false|0)\s*$/ig; $relative_links = '' if /relative_links \s*=\s*(no|false|0)\s*$/ig; $do_bootloader = '' if /do_bootloader\s*=\s*(no|false|0)\s*$/ig; $use_hard_links = '' if /use_hard_links\s*=\s*(no|false|0)\s*$/ig; - $silent_modules = '' if /silent_modules\s*=\s*(no|false|0)\s*$/ig; $silent_loader = '' if /silent_loader\s*=\s*(no|false|0)\s*$/ig; $minimal_swap = '' if /minimal_swap\s*=\s*(no|false|0)\s*$/ig; $ignore_depmod_err = '' if /ignore_depmod_err\s*=\s*(no|false|0)\s*$/ig; @@ -130,12 +126,10 @@ if (-r "$CONF_LOC" && -f "$CONF_LOC" ) { $reverse_symlink = "Yes" if /reverse_symlinks\s*=\s*(yes|true|1)\s*$/ig; $link_in_boot = "Yes" if /link_in_boot\s*=\s*(yes|true|1)\s*$/ig; $move_image = "Yes" if /move_image\s*=\s*(yes|true|1)\s*$/ig; - $clobber_modules = "Yes" if /clobber_modules\s*=\s*(yes|true|1)\s*$/ig; $do_boot_enable = "Yes" if /do_boot_enable\s*=\s*(yes|true|1)\s*$/ig; $do_bootloader = "Yes" if /do_bootloader\s*=\s*(yes|true|1)\s*$/ig; $relative_links = "Yes" if /relative_links\s*=\s*(yes|true|1)\s*$/ig; $use_hard_links = "Yes" if /use_hard_links\s*=\s*(yes|true|1)\s*$/ig; - $silent_modules = 'Yes' if /silent_modules\s*=\s*(yes|true|1)\s*$/ig; $silent_loader = 'Yes' if /silent_loader\s*=\s*(yes|true|1)\s*$/ig; $minimal_swap = 'Yes' if /minimal_swap\s*=\s*(yes|true|1)\s*$/ig; $ignore_depmod_err = 'Yes' if /ignore_depmod_err\s*=\s*(yes|true|1)\s*$/ig; diff --git a/linux-2.6/debian/templates/temp.image.plain/preinst b/linux-2.6/debian/templates/temp.image.plain/preinst index 9ca4822..0d642f5 100755 --- a/linux-2.6/debian/templates/temp.image.plain/preinst +++ b/linux-2.6/debian/templates/temp.image.plain/preinst @@ -32,7 +32,6 @@ my $do_symlink = "Yes"; # target machine defined my $move_image = ''; # target machine defined my $kimage = "=K"; # Should be empty, mostly my $image_dir = "=D"; # where the image is located -my $clobber_modules = ''; # target machine defined my $use_hard_links = ''; # hardlinks do not wirk across fs boundaries my $postinst_hook = ''; #Normally we do not my $postrm_hook = ''; #Normally we do not @@ -65,7 +64,6 @@ my $realimageloc = "/$image_dir/"; my $have_conffile = ""; my $CONF_LOC = '/etc/kernel-img.conf'; my $relative_links = ''; -my $silent_modules = ''; my $modules_base = '/lib/modules'; @@ -74,11 +72,6 @@ die "Pre inst Internal error. Aborting." unless $version; exit 0 if $ARGV[0] =~ /abort-upgrade/; exit 1 unless $ARGV[0] =~ /(install|upgrade)/; -# Official images may silently upgrade -if ($official_image =~ /^\s*YES\s*$/o && ($ARGV[0] =~ /upgrade/)) { - $silent_modules = 'Yes'; - } - # remove multiple leading slashes; make sure there is at least one. $realimageloc =~ s|^/*|/|o; $realimageloc =~ s|/+|/|o; @@ -95,10 +88,8 @@ if (-r "$CONF_LOC" && -f "$CONF_LOC" ) { $reverse_symlink = "" if /reverse_symlinks\s*=\s*(no|false|0)\s*$/ig; $link_in_boot = "" if /link_in_boot\s*=\s*(no|false|0)\s*$/ig; $move_image = "" if /move_image\s*=\s*(no|false|0)\s*$/ig; - $clobber_modules = '' if /clobber_modules\s*=\s*(no|false|0)\s*$/ig; $relative_links = '' if /relative_links \s*=\s*(no|false|0)\s*$/ig; $use_hard_links = '' if /use_hard_links\s*=\s*(no|false|0)\s*$/ig; - $silent_modules = '' if /silent_modules\s*=\s*(no|false|0)\s*$/ig; $minimal_swap = '' if /minimal_swap\s*=\s*(no|false|0)\s*$/ig; $ignore_depmod_err = '' if /ignore_depmod_err\s*=\s*(no|false|0)\s*$/ig; $relink_src_link = '' if /relink_src_link\s*=\s*(no|false|0)\s*$/ig; @@ -110,10 +101,8 @@ if (-r "$CONF_LOC" && -f "$CONF_LOC" ) { $reverse_symlink = "Yes" if /reverse_symlinks\s*=\s*(yes|true|1)\s*$/ig; $link_in_boot = "Yes" if /link_in_boot\s*=\s*(yes|true|1)\s*$/ig; $move_image = "Yes" if /move_image\s*=\s*(yes|true|1)\s*$/ig; - $clobber_modules = "Yes" if /clobber_modules\s*=\s*(yes|true|1)\s*$/ig; $relative_links = "Yes" if /relative_links\s*=\s*(yes|true|1)\s*$/ig; $use_hard_links = "Yes" if /use_hard_links\s*=\s*(yes|true|1)\s*$/ig; - $silent_modules = 'Yes' if /silent_modules\s*=\s*(yes|true|1)\s*$/ig; $minimal_swap = 'Yes' if /minimal_swap\s*=\s*(yes|true|1)\s*$/ig; $ignore_depmod_err = 'Yes' if /ignore_depmod_err\s*=\s*(yes|true|1)\s*$/ig; $relink_src_link = 'Yes' if /relink_src_link\s*=\s*(yes|true|1)\s*$/ig; @@ -234,8 +223,6 @@ if (-d "$modules_base/$version") { warn "Info:\n$errors\n" if $errors; } -# If this is an official image, and only a build symlink exists, allow -# it to be clobbered. if ($official_image =~ /^\s*YES\s*$/o ) { if (-d "$modules_base/$version" && -l "$modules_base/$version/build" ) { rename("$modules_base/$version/build", "$modules_base/$version/build.save") || @@ -243,100 +230,6 @@ if ($official_image =~ /^\s*YES\s*$/o ) { } } -if (-d "$modules_base/$version/kernel") { - if ($clobber_modules) { - my $ret = - system("mv $modules_base/$version/kernel $modules_base/${version}_kernel_$$"); - my $seen; - if ($ret) { - my $note = "${package_name}/preinst/failed-to-move-modules-$version"; - - ($ret,$seen) = fset ("$note", 'seen', 'false'); - die "Error setting debconf flags in $note: $seen" if $ret; - - ($ret,$seen) = fset ("$note", 'seen', 'false'); - die "Error setting debconf flags in $note: $seen" if $ret; - - $ret = subst("$note", 'modules_base', "$modules_base"); - die "Error setting debconf substitutions in $note: $seen" if $ret; - - $ret = subst("$note", 'dest', "${version}/kernel_$$"); - die "Error setting debconf substitutions in $note: $seen" if $ret; - - ($ret,$seen) = input('critical', "$note"); - if ($ret && $ret != 30 ) { - die "Error setting debconf note $note: $seen"; - } - - ($ret,$seen) = go (); - if ($ret && $ret != 30 ) { - die "Error asking debconf question $note: $seen"; - } - exit 1; - } - } - elsif ($silent_modules !~ m/YES/i) { - my $ret; - my $seen; - my $answer; - my $question = "${package_name}/preinst/overwriting-modules-$version"; - - ($ret,$seen) = fset ("$question", 'seen', 'false'); - die "Error setting debconf flags in $question: $seen" if $ret; - - $ret = subst("$question", 'modules_base', "$modules_base"); - die "Error setting debconf substitutions in $question: $seen" if $ret; - - $ret = subst("$question", 'package', "$package_name"); - die "Error setting debconf substitutions in $question: $seen" if $ret; - - ($ret,$seen) = input('critical', "$question"); - if ($ret && $ret != 30 ) { - die "Error setting debconf question $question: $seen"; - } - $invisible = $ret if $ret == 30; - - ($ret,$seen) = go (); - if ($ret && $ret != 30 ) { - die "Error asking debconf question $question: $seen"; - } - - ($ret,$answer) = get("$question"); - die "Error retreiving answer for $question: $answer" if $ret; - - $answer =~ s/^\s+//; - $answer =~ s/\s+$//; - print STDERR "Ok, aborting, since modules for this image already exist.\n" - unless $answer =~ /^(f|n)/i; - if ($answer !~ /^(f|n)/i && $invisible) { - my $note = "${package_name}/preinst/abort-overwrite-$version"; - - ($ret,$seen) = fset ("$note", 'seen', 'false'); - die "Error setting debconf flags in $note: $seen" if $ret; - - ($ret,$seen) = fset ("$note", 'seen', 'false'); - die "Error setting debconf flags in $note: $seen" if $ret; - - ($ret,$seen) = input('critical', "$note"); - if ($ret && $ret != 30 ) { - die "Error setting debconf note $note: $seen"; - } - - ($ret,$seen) = go (); - if ($ret && $ret != 30 ) { - die "Error asking debconf question $note: $seen"; - } - } - exit 1 unless $answer =~ /^(f|n)/i; - } - else { - print STDERR <<EOF; -Updating directory $modules_base/$version. -EOF - ; - } -} - # set the env var stem $ENV{'STEM'} = "=ST"; diff --git a/linux-2.6/debian/templates/temp.image.plain/prerm b/linux-2.6/debian/templates/temp.image.plain/prerm index c6453ee..751f415 100755 --- a/linux-2.6/debian/templates/temp.image.plain/prerm +++ b/linux-2.6/debian/templates/temp.image.plain/prerm @@ -34,7 +34,6 @@ my $move_image = ''; # target machine defined my $kimage = "=K"; # Should be empty, mostly my $loader = "=L"; # lilo, silo, quik, palo, vmelilo, or nettrom my $image_dir = "=D"; # where the image is located -my $clobber_modules = ''; # target machine defined my $use_hard_links = ''; # hardlinks do not wirk across fs boundaries my $postinst_hook = ''; #Normally we do not my $postrm_hook = ''; #Normally we do not @@ -70,7 +69,6 @@ my $realimageloc = "/$image_dir/"; my $have_conffile = ""; my $CONF_LOC = '/etc/kernel-img.conf'; my $relative_links = ''; -my $silent_modules = ''; my $silent_loader = ''; # remove multiple leading slashes; make sure there is at least one. @@ -113,12 +111,10 @@ if (-r "$CONF_LOC" && -f "$CONF_LOC" ) { $reverse_symlink = "" if /reverse_symlinks\s*=\s*(no|false|0)\s*$/ig; $link_in_boot = "" if /link_in_boot\s*=\s*(no|false|0)\s*$/ig; $move_image = "" if /move_image\s*=\s*(no|false|0)\s*$/ig; - $clobber_modules = '' if /clobber_modules\s*=\s*(no|false|0)\s*$/ig; $do_boot_enable = '' if /do_boot_enable\s*=\s*(no|false|0)\s*$/ig; $relative_links = '' if /relative_links \s*=\s*(no|false|0)\s*$/ig; $do_bootloader = '' if /do_bootloader\s*=\s*(no|false|0)\s*$/ig; $use_hard_links = '' if /use_hard_links\s*=\s*(no|false|0)\s*$/ig; - $silent_modules = '' if /silent_modules\s*=\s*(no|false|0)\s*$/ig; $silent_loader = '' if /silent_loader\s*=\s*(no|false|0)\s*$/ig; $warn_reboot = '' if /warn_reboot\s*=\s*(no|false|0)\s*$/ig; $minimal_swap = '' if /minimal_swap\s*=\s*(no|false|0)\s*$/ig; @@ -132,12 +128,10 @@ if (-r "$CONF_LOC" && -f "$CONF_LOC" ) { $reverse_symlink = "Yes" if /reverse_symlinks\s*=\s*(yes|true|1)\s*$/ig; $link_in_boot = "Yes" if /link_in_boot\s*=\s*(yes|true|1)\s*$/ig; $move_image = "Yes" if /move_image\s*=\s*(yes|true|1)\s*$/ig; - $clobber_modules = "Yes" if /clobber_modules\s*=\s*(yes|true|1)\s*$/ig; $do_boot_enable = "Yes" if /do_boot_enable\s*=\s*(yes|true|1)\s*$/ig; $do_bootloader = "Yes" if /do_bootloader\s*=\s*(yes|true|1)\s*$/ig; $relative_links = "Yes" if /relative_links\s*=\s*(yes|true|1)\s*$/ig; $use_hard_links = "Yes" if /use_hard_links\s*=\s*(yes|true|1)\s*$/ig; - $silent_modules = 'Yes' if /silent_modules\s*=\s*(yes|true|1)\s*$/ig; $silent_loader = 'Yes' if /silent_loader\s*=\s*(yes|true|1)\s*$/ig; $warn_reboot = 'Yes' if /warn_reboot\s*=\s*(yes|true|1)\s*$/ig; $minimal_swap = 'Yes' if /minimal_swap\s*=\s*(yes|true|1)\s*$/ig; diff --git a/linux-2.6/debian/templates/temp.image.plain/templates b/linux-2.6/debian/templates/temp.image.plain/templates index 8c75f45..99149f2 100644 --- a/linux-2.6/debian/templates/temp.image.plain/templates +++ b/linux-2.6/debian/templates/temp.image.plain/templates @@ -12,65 +12,6 @@ Description: Initial RAMdisk image generation impossible . ${initrddep} -Template: =ST-image-=V/preinst/failed-to-move-modules-=V -Type: note -Description: Modules removal failure - You are attempting to install a kernel image (version =V). - However, the directory ${modules_base}/=V/kernel still exists. - . - An attempt was made to move the directory. However, that - action failed and ${modules_base}/=V could not be moved to - ${modules_base}/${dest}. - . - You should move $modules_base/$version manually - and try re-installing this image. - -Template: =ST-image-=V/preinst/overwriting-modules-=V -Type: boolean -Default: true -Description: Abort installation since the kernel-image is already installed? - You are attempting to install a kernel image (version =V). - However, the directory ${modules_base}/=V/kernel still exists. - . - If this directory belongs to a previous ${package} package, and if - you have deselected some modules, or installed standalone modules - packages, this could have unexpected consequences. - . - If ${modules_base}/=V/kernel belongs to an old install of - ${package}, you can now abort the - installation of this kernel image (nothing has been changed yet). - . - It is recommended to abort the installation unless you are - sure of what you are doing. - . - If you abort the installation, you should then move - ${modules_base}/=V/kernel (for instance as - ${modules_base}/=V.kernel.old) and then try - re-installing this image. - -Template: =ST-image-=V/preinst/abort-overwrite-=V -Type: note -Description: Aborting installation since modules exist - You are attempting to install an initrd kernel image (version - =V). - . - However, the corresponding kernel modules directory exists, - and there was no permission given to silently delete the modules - directory. - . - As the question that's relevant for this situation - was not shown, =ST-image-=V installation has been aborted. - -Template: =ST-image-=V/postinst/create-kimage-link-=V -Type: boolean -Default: true -Description: Create a symbolic link to the current kernel image? - There is no ${kimage} symbolic link. - . - Such a link can be created now and will be updated by subsequently - installed image packages. This will be useful with some boot loaders - such as LILO. - Template: =ST-image-=V/postinst/depmod-error-initrd-=V Type: boolean Default: false -- To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org