Skip to content

Commit

Permalink
Support manual disk unlocking on MicroOS
Browse files Browse the repository at this point in the history
lib/microos.pm's process_reboot does for some reason not use wait_boot,
so adding a call is necessary. Also detect automatic TPM based
unlocking on MicroOS in need_unlock_after_bootloader.
  • Loading branch information
Vogtinator committed Jan 11, 2024
1 parent d4412d5 commit 029b14f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/microos.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use Exporter;
use strict;
use warnings;
use testapi;
use utils qw(need_unlock_after_bootloader unlock_if_encrypted);
use version_utils qw(is_microos is_selfinstall is_bootloader_grub2 is_bootloader_sdboot);
use power_action_utils 'power_action';
use Utils::Architectures qw(is_aarch64);
Expand Down Expand Up @@ -48,6 +49,7 @@ sub microos_reboot {
assert_screen 'grub2', 300 if is_bootloader_grub2;
assert_screen 'systemd-boot', 300 if is_bootloader_sdboot;
send_key('ret') unless get_var('KEEP_GRUB_TIMEOUT');
unlock_if_encrypted if need_unlock_after_bootloader;
microos_login;
}

Expand Down
4 changes: 3 additions & 1 deletion lib/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use warnings;
use testapi qw(is_serial_terminal :DEFAULT);
use lockapi 'mutex_wait';
use mm_network;
use version_utils qw(is_alp is_sle_micro is_microos is_leap is_leap_micro is_public_cloud is_sle is_sle12_hdd_in_upgrade is_storage_ng is_jeos package_version_cmp is_transactional);
use version_utils qw(is_alp is_sle_micro is_microos is_leap is_leap_micro is_public_cloud is_sle is_sle12_hdd_in_upgrade is_storage_ng is_jeos package_version_cmp is_transactional is_bootloader_sdboot);
use Utils::Architectures;
use Utils::Systemd qw(systemctl disable_and_stop_service);
use Utils::Backends;
Expand Down Expand Up @@ -1065,6 +1065,8 @@ without LVM configuration (cr_swap,cr_home etc).
sub need_unlock_after_bootloader {
my $need_unlock_after_bootloader = is_leap('<15.6') || is_sle('<15-sp6') || is_leap_micro || is_sle_micro || is_alp || (!get_var('LVM', '0') && !get_var('FULL_LVM_ENCRYPT', '0'));
return 0 if is_boot_encrypted && !$need_unlock_after_bootloader;
# MicroOS with sdboot supports automatic TPM based unlocking.
return 0 if is_microos && is_bootloader_sdboot && get_var('QEMUTPM');
return 1;
}

Expand Down

0 comments on commit 029b14f

Please sign in to comment.