Skip to content

Commit

Permalink
Merge pull request #14 from mariux64/mxgrub-improve-message-output
Browse files Browse the repository at this point in the history
mxgrub: check for consistent GRUB installation
  • Loading branch information
donald authored Sep 26, 2017
2 parents 5f5e8a8 + 9a6df45 commit c37bbc6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions mxgrub/mxgrub
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -41,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

Expand Down Expand Up @@ -255,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(
Expand Down

0 comments on commit c37bbc6

Please sign in to comment.