lib/bootloader_setup.pm

add_custom_grub_entries

Add custom grub entries with extra kernel parameters. It adds 3rd line with default options + 4th line with advanced options. Extra kernel parameters are taken in GRUB_PARAM variable (a semicolon-separated list).

e.g. grub entries before:

* SLES 15
* Advanced options for SLES 15
* Start bootloader from a read-only snapshot

grub entries with GRUB_PARAM='ima_policy=tcb' and calling add_custom_grub_entries:

* SLES 15
* Advanced options for SLES 15
* SLES 15 (ima_policy=tcb)
* Advanced options for SLES 15 (ima_policy=tcb)
* Start bootloader from a read-only snapshot

And of course the new entries have ima_policy=tcb added to kernel parameters.

boot_grub_item

boot_grub_item([ $menu1, [ $menu2 ] ]);

Choose custom boot menu entry in grub. $menu1 defines which entry to choose in first boot menu, optional $menu2 defines which entry to choose in second boot menu (makes sense only when $menu1 selects "Advanced options", otherwise it's ignored).

Default value is $menu1 = 3, $menu2 = 1, which boots kernel with extra parameters (generated by add_custom_grub_entries()) or 3rd option whatever it is other OS (given that 1st and 2nd grub options are for the default kernel):

Examples:

Boot kernel with extra parameters (generated with add_custom_grub_entries()) or 3rd option whatever it is other OS:

boot_grub_item();
boot_grub_item(3);

Boot the default kernel:

boot_grub_item(1);

Boot the default kernel recovery mode (selected in the "Advanced options ..."):

boot_grub_item(2, 2);

get_linuxrc_boot_params

get_linuxrc_boot_params();

Returns array of strings @params with linurc boot options to enable logging to the serial console, enable core dumps and set debug level for logging.

grep_grub_settings

grep_grub_settings($pattern)

Search for $pattern in /etc/default/grub, return 1 if found.

grep_grub_cmdline_settings

grep_grub_cmdline_settings($pattern [, $search])

Search for $pattern in grub cmdline variable (usually GRUB_CMDLINE_LINUX_DEFAULT) in /etc/default/grub, return 1 if found.

change_grub_config

change_grub_config($old, $new [, $search ] [, $modifiers ], [, $update_grub ]);

Replace $old with $new in /etc/default/grub, using sed. $new, default empty string $search meant to be for changing only particular line for sed, $modifiers for sed replacement, e.g. "g". $update_grub if set, regenerate /boot/grub2/grub.cfg with grub2-mkconfig and upload configuration.

add_grub_cmdline_settings

add_grub_cmdline_settings($add [, update_grub => $update_grub] [, search => $search]);

Add $add into /etc/default/grub, using sed. $update_grub if set, regenerate /boot/grub2/grub.cfg with grub2-mkconfig and upload configuration. $search if set, bypass default grub cmdline variable.

add_grub_xen_cmdline_settings

add_grub_xen_cmdline_settings($add [, $update_grub ]);

Add $add into /etc/default/grub, using sed. $update_grub if set, regenerate /boot/grub2/grub.cfg with grub2-mkconfig and upload configuration.

add_grub_xen_replace_cmdline_settings

add_grub_xen_replace_cmdline_settings($add [, $update_grub ]);

Add $add into /etc/default/grub, using sed. $update_grub if set, regenerate /boot/grub2/grub.cfg with grub2-mkconfig and upload configuration.

replace_grub_cmdline_settings

replace_grub_cmdline_settings($old, $new [, update_grub => $update_grub] [, search => $search]);

Replace $old with $new in /etc/default/grub, using sed. $update_grub if set, regenerate /boot/grub2/grub.cfg with grub2-mkconfig and upload configuration. $search if set, bypass default grub cmdline variable.

replace_grub_xen_cmdline_settings

replace_grub_xen_cmdline_settings($old, $new [, $update_grub ]);

Replace $old with $new in /etc/default/grub, using sed. $update_grub if set, regenerate /boot/grub2/grub.cfg with grub2-mkconfig and upload configuration.

remove_grub_cmdline_settings

remove_grub_cmdline_settings($remove [, $search]);

Remove $remove from /etc/default/grub (using sed) and regenerate /boot/grub2/grub.cfg. Search line $search from /etc/default/grub (use for sed).

remove_grub_xen_cmdline_settings

remove_grub_xen_cmdline_settings($remove);

Remove $remove from /etc/default/grub (using sed) and regenerate /boot/grub2/grub.cfg.

grub_mkconfig

grub_mkconfig();
grub_mkconfig($config);

Regenerate /boot/grub2/grub.cfg with grub2-mkconfig.

get_cmdline_var

get_cmdline_var();

Get default grub cmdline variable: GRUB_CMDLINE_LINUX for JeOS, GRUB_CMDLINE_LINUX_DEFAULT for the rest.

parse_bootparams_in_serial

parse_bootparams_in_serial();

Parses serail output, searching for 'Command line' parameters. Then converts the found parameters to an array of the values.

Returns the array of the boot parameters.

compare_bootparams

compare_bootparams(\@array1, \@array2);

Compares two arrays of bootparameters passed by array reference and logs the result to openQA using record_info.

Does not fail the test module but just highlights the result of the comparison.

create_encrypted_part

create_encrypted_part(disk => $disk, luks_type => $luks_type);

Creates gpt partition table on a given disk and creates encrypted partition on it using default luks encryption or specific encryption if provided. It is useful to test encrypted partitions activation in the installer.

mimic_user_to_import

mimic_user_to_import(disk => $disk, passwd => $passwd, shadow => $shadow);

Creates /etc/passwd and /etc/shadow files to simluate existing users on the encrypted partition disk. Is expected to be used together with create_encrypted_part Can be used to test user import functionality not to chain jobs. Method accepts disk to define the device to work with, passwd and shadow store content of the /etc/passwd and /etc/shadow files accordingly.

prepare_disks

prepare_disks

Wipe existing disks and create encrypted partitions if needed for the test. Is handy for the bare metal setups and LPARs where we can have traces of previous installation.

sync_time

sync_time

Sync system time, time offset can cause problems e.g. certificate is not yet valid