V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 54s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 54s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
63
func/cdi_4200_boot/4250_update_grub_bootparameter.sh
Normal file
63
func/cdi_4200_boot/4250_update_grub_bootparameter.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# SPDX-Version: 3.0
|
||||
# SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.installer.git
|
||||
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
||||
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-FileType: SOURCE
|
||||
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
|
||||
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
|
||||
# SPDX-PackageName: CISS.debian.installer
|
||||
# SPDX-Security-Contact: security@coresecret.eu
|
||||
|
||||
### Options in "GRUB_CMDLINE_LINUX" are always effective.
|
||||
### Options in "GRUB_CMDLINE_LINUX_DEFAULT" are effective ONLY during normal boot (NOT during recovery mode).
|
||||
|
||||
guard_sourcing
|
||||
|
||||
#######################################
|
||||
# Hardening Grub boot parameter.
|
||||
# Globals:
|
||||
# ARY_BOOTPARAM
|
||||
# TARGET
|
||||
# VAR_GRUB_CMDLINE_LINUX_DEFAULT
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# 0: on success
|
||||
#######################################
|
||||
update_grub_bootparameter() {
|
||||
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."
|
||||
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}'."
|
||||
continue
|
||||
fi
|
||||
|
||||
VAR_GRUB_CMDLINE_LINUX_DEFAULT+=" ${var_param}"
|
||||
|
||||
done
|
||||
|
||||
if [[ "${VAR_NUKE}" == "true" ]]; then
|
||||
var_nuke_string="nuke=${VAR_NUKE_HASH}"
|
||||
VAR_GRUB_CMDLINE_LINUX+=" ${var_nuke_string}"
|
||||
fi
|
||||
|
||||
grub_finalize_string
|
||||
|
||||
do_in_target "${TARGET}" update-grub
|
||||
|
||||
do_log "info" "file_only" "Setting GRUB kernel parameters: ${VAR_GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
|
||||
return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
Reference in New Issue
Block a user