diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2022-10-24 21:07:25 +0100 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2022-10-24 21:07:25 +0100 |
commit | 325cbdb1eeff9310c305bfb4c29bf7f03556655f (patch) | |
tree | e6e923d3e91ee5925227efc9ad78bf41b99d8431 /perl-install/common.pm | |
parent | b6ebfb5bc19b5c6c51ade25d8f8c83fe926cbf5a (diff) | |
download | drakx-325cbdb1eeff9310c305bfb4c29bf7f03556655f.tar drakx-325cbdb1eeff9310c305bfb4c29bf7f03556655f.tar.gz drakx-325cbdb1eeff9310c305bfb4c29bf7f03556655f.tar.bz2 drakx-325cbdb1eeff9310c305bfb4c29bf7f03556655f.tar.xz drakx-325cbdb1eeff9310c305bfb4c29bf7f03556655f.zip |
Factor out code to mount the efivarfs pseudo-filesystem.
Diffstat (limited to 'perl-install/common.pm')
-rw-r--r-- | perl-install/common.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm index 72ae44d6e..5985c7181 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -10,7 +10,7 @@ use run_program; use Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw($SECTORSIZE N P N_ check_for_xserver files_exist formatTime MB formatXiB get_libdir get_parent_uid is_running is_uefi kernel_uefi_type makedev mageia_release mageia_release_info removeXiBSuffix require_root_capability setVirtual set_alternative set_l10n_sort set_permissions to_utf8 translate uefi_type unmakedev); +our @EXPORT = qw($SECTORSIZE N P N_ check_for_xserver files_exist formatTime MB formatXiB get_libdir get_parent_uid is_running is_uefi kernel_uefi_type makedev mageia_release mageia_release_info mount_efivars removeXiBSuffix require_root_capability setVirtual set_alternative set_l10n_sort set_permissions to_utf8 translate uefi_type unmakedev); # perl_checker: RE-EXPORT-ALL push @EXPORT, @MDK::Common::EXPORT; @@ -757,6 +757,20 @@ sub uefi_type() { } } +=item mount_efivars() + +Ensures the efivarfs pseudo-filesystem is mounted in the default location +and returns the mount point and whether it was already mounted. + +=cut + +sub mount_efivars { + my $mount_point = '/sys/firmware/efi/efivars'; + my $already_mounted = cat_("$::prefix/proc/mounts") =~ /$mount_point/; + run_program::run('mount', '-t', 'efivarfs', 'none', "$::prefix$mount_point") if !$already_mounted; + ("$::prefix$mount_point", $already_mounted); +} + =item cmp_kernel_versions($va, $vb) Compare two kernel versions |