Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -20,26 +20,30 @@ guard_sourcing
|
||||
# Globals:
|
||||
# ARY_BOOTPARAM
|
||||
# TARGET
|
||||
# VAR_GRUB_CMDLINE_LINUX
|
||||
# VAR_GRUB_CMDLINE_LINUX_DEFAULT
|
||||
# VAR_NUKE
|
||||
# VAR_NUKE_HASH
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# 0: on success
|
||||
#######################################
|
||||
update_grub_bootparameter() {
|
||||
declare var_nuke_string="" var_param=""
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
declare var_nuke_string="" var_param=""
|
||||
|
||||
grub_extract_current_string
|
||||
|
||||
for var_param in "${ARY_BOOTPARAM[@]}"; do
|
||||
|
||||
if [[ -z "${var_param}" ]]; then
|
||||
do_log "warn" "file_only" "Empty GRUB parameter detected and skipped."
|
||||
do_log "warn" "file_only" "4250() Empty GRUB parameter detected and skipped."
|
||||
continue
|
||||
fi
|
||||
|
||||
if grep -q --word-regexp "${var_param%%=*}" <<< "${VAR_GRUB_CMDLINE_LINUX_DEFAULT}"; then
|
||||
do_log "info" "file_only" "Skipping duplicate kernel parameter: '${var_param}'."
|
||||
do_log "info" "file_only" "4250() Skipping duplicate kernel parameter: '${var_param}'."
|
||||
continue
|
||||
fi
|
||||
|
||||
@@ -49,6 +53,7 @@ update_grub_bootparameter() {
|
||||
|
||||
if [[ "${VAR_NUKE}" == "true" ]]; then
|
||||
var_nuke_string="nuke=${VAR_NUKE_HASH}"
|
||||
# shellcheck disable=SC2034
|
||||
VAR_GRUB_CMDLINE_LINUX+=" ${var_nuke_string}"
|
||||
fi
|
||||
|
||||
@@ -56,7 +61,7 @@ update_grub_bootparameter() {
|
||||
|
||||
do_in_target "${TARGET}" update-grub
|
||||
|
||||
do_log "info" "file_only" "Setting GRUB kernel parameters: ${VAR_GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
do_log "info" "file_only" "4250() Setting GRUB kernel parameters: ${VAR_GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user