Use mountpoint to check for ESP

Instead of parsing the output of mount, use mountpoint to check if the
ESP is mounted. This should be slightly less fragile than parsing text
formatted for human consumption.
This commit is contained in:
Zach Dykstra 2020-07-06 22:14:27 -05:00
parent 315e326b4d
commit 7122be957b
1 changed files with 2 additions and 10 deletions

View File

@ -97,18 +97,10 @@ $runConf{umount_on_exit} = 0;
if ( nonempty $config{Global}{BootMountPoint} ) {
my $mounted = 0;
my $cmd = "mount";
my $cmd = "mountpoint $config{Global}{BootMountPoint}";
my @output = execute($cmd);
my $status = pop(@output);
foreach my $line (@output) {
chomp($line);
if ( $line =~ m/$config{Global}{BootMountPoint}/ ) {
$mounted = 1;
last;
}
}
unless ($mounted) {
unless ( $status eq 0 ) {
print "Mounting $config{Global}{BootMountPoint}\n";
$cmd = "mount $config{Global}{BootMountPoint}";
my @output = execute($cmd);