From 43f2dc45ac231b698dff426b8b5d891933a6882d Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 20 Mar 2010 05:37:46 +0000 Subject: [PATCH] linux-base.postinst: Display an (additional) note if the boot loader configuration is not recognised svn path=/dists/sid/linux-2.6/; revision=15424 --- debian/linux-base.postinst | 41 +++++++++++++++++++++++++++++-------- debian/linux-base.templates | 11 ++++++++++ 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/debian/linux-base.postinst b/debian/linux-base.postinst index 2e35b855f..65c963836 100644 --- a/debian/linux-base.postinst +++ b/debian/linux-base.postinst @@ -818,32 +818,38 @@ my @config_files = ({packages => 'mount', path => '/boot/grub/menu.lst', list => \&grub1_list, update => \&grub1_update, - post_update => \&grub1_post}, + post_update => \&grub1_post, + is_boot_loader => 1}, {packages => 'grub-common', path => '/etc/default/grub', list => \&grub2_list, update => \&grub2_update, - post_update => \&grub2_post}, + post_update => \&grub2_post, + is_boot_loader => 1}, {packages => 'lilo', path => '/etc/lilo.conf', list => \&lilo_list, update => \&lilo_update, - post_update => \&lilo_post}, + post_update => \&lilo_post, + is_boot_loader => 1}, {packages => 'elilo', path => '/etc/elilo.conf', list => \&lilo_list, update => \&lilo_update, - post_update => \&elilo_post}, + post_update => \&elilo_post, + is_boot_loader => 1}, {packages => 'extlinux', path => extlinux_old_path(), list => \&extlinux_old_list, update => \&extlinux_old_update, - post_update => \&extlinux_post}, + post_update => \&extlinux_post, + is_boot_loader => 1}, {packages => 'extlinux', path => '/etc/default/extlinux', list => \&extlinux_new_list, update => \&extlinux_new_update, - post_update => \&extlinux_post}, + post_update => \&extlinux_post, + is_boot_loader => 1}, {packages => 'udev', path => '/etc/udev/rules.d/70-persistent-cd.rules', needs_update => \&udev_cd_needs_update, @@ -1238,8 +1244,13 @@ sub transition { my @found_configs = scan_config_files(); my @matched_configs = grep({@{$_->{devices}} || $_->{id_map_text}} @found_configs); + my $found_boot_loader = + grep({$_->{config}->{is_boot_loader} && $_->{installed}} @found_configs); - if ($#matched_configs < 0) { + # We can skip all of this if we didn't find any configuration + # files that need conversion and we found the configuration file + # for an installed boot loader. + if (!@matched_configs && $found_boot_loader) { return; } @@ -1257,7 +1268,7 @@ sub transition { ($ret, $answer) = get($question); die "Error retrieving answer for $question: $answer" if $ret; - if ($answer eq 'true') { + if (@matched_configs && $answer eq 'true') { scan_devices(); assign_new_ids(); @@ -1326,6 +1337,20 @@ sub transition { die "Error showing debconf note $question: $seen"; } } + + # Also note whether some (unknown) boot loader configuration file + # must be manually converted. + if (!$found_boot_loader) { + $question = 'linux-base/disk-id-manual-boot-loader'; + ($ret, $seen) = input('high', $question); + if ($ret && $ret != 30) { + die "Error setting debconf note $question: $seen"; + } + ($ret, $seen) = go(); + if ($ret && $ret != 30) { + die "Error showing debconf note $question: $seen"; + } + } } package main; diff --git a/debian/linux-base.templates b/debian/linux-base.templates index 98e799f2d..02dfddd8b 100644 --- a/debian/linux-base.templates +++ b/debian/linux-base.templates @@ -46,3 +46,14 @@ Description: Please check these configuration files before rebooting change when using the new kernel: . ${unconverted} + +Template: linux-base/disk-id-manual-boot-loader +Type: note +Description: Check the boot loader configuration before rebooting + The boot loader configuration for this system was not recognised. These + settings in the configuration may need to be updated: + . + * The root device id passed as a kernel parameter + * The boot device id used to install and update the boot loader + . + We recommend that you identify these devices by UUID or label.