From 7fdf77b163b572578c3fd9bbf73bed091bd640eb Mon Sep 17 00:00:00 2001 From: thomas Date: Mon, 25 Sep 2017 13:25:34 +0200 Subject: [PATCH 1/2] mxgrub: list --test option in usage message --- mxgrub/mxgrub | 1 + 1 file changed, 1 insertion(+) diff --git a/mxgrub/mxgrub b/mxgrub/mxgrub index 5c80f86..330298d 100755 --- a/mxgrub/mxgrub +++ b/mxgrub/mxgrub @@ -10,6 +10,7 @@ sub USAGE { return <<"EOF" } $0 --list : list available labels $0 --update : only scan /boot and rewrite grub.cfg $0 --initramfs : update /boot/grub/initramfs.igz from /project/admin/initramfs + $0 --test : perform miscellaneous tests (VX50 board) EOF sub sys { From 9a6df45d454c7c6bd739eaeb7a09e1c996082ae6 Mon Sep 17 00:00:00 2001 From: thomas Date: Mon, 25 Sep 2017 14:41:02 +0200 Subject: [PATCH 2/2] mxgrub: check for consistent GRUB installation If a new GRUB package is installed, the GRUB-'machinery' to boot the host is still from the old version. The implemented check accounts for this. --- mxgrub/mxgrub | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mxgrub/mxgrub b/mxgrub/mxgrub index 330298d..6b2beb6 100755 --- a/mxgrub/mxgrub +++ b/mxgrub/mxgrub @@ -42,6 +42,23 @@ sub check_mbr { } +sub check_grub_installation { + my $fingerprint='[ab]*.mod'; # this 'scans' just a dozen, and not 200 files. + my $sum_lib = ` cat /usr/lib/grub/i386-pc/$fingerprint | md5sum `; + my $sum_boot = ` cat /boot/grub/i386-pc/$fingerprint | md5sum `; + my @root_dev = root_dev(); + + warn << "EOF" if $sum_lib ne $sum_boot; + + Note: GRUB version installed in /usr differs from GRUB version used to boot. + + Consider updating the boot-loader with: + + grub-install --boot-directory=/boot $root_dev[1] + +EOF +} + # /usr/include/sys/sysmacros.h # MMMM.MMMM MMMM.MMMM MMMM.MMMM MMMM.MMMM mmmm.mmmm mmmm.MMMM MMMM.MMMM mmmm.mmmm @@ -256,6 +273,8 @@ sub cmd_initramfs { sys('bash','-c','cd /project/admin/initramfs;find .|cpio -H newc -o | gzip > /boot/grub/initramfs.igz'); } +check_grub_installation + our ($opt_list,$opt_update,$opt_initramfs,$opt_test); GetOptions(