V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 53s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-08-06 22:39:24 +02:00
parent 3301a93677
commit 93f9c8891d
10 changed files with 149 additions and 98 deletions

View File

@@ -24,20 +24,22 @@ guard_sourcing
# ERR_READ_GRUB_FILE
#######################################
update_grub_password() {
### Declare Arrays, HashMaps, and Variables.
declare var_username="superadmin" var_password="" var_password_file="${DIR_CNF}/password_grub.txt" \
var_of="${TARGET}/etc/grub.d/40_custom" var_grub_entry=""
var_of="${TARGET}/etc/grub.d/40_custom" var_grub_entry=""
# TODO: Reactivate XTRACE Password Truncation
### TODO: PASSWORD REMINDER
### No tracing for security reasons
#[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set +x
if [[ ! -f "${var_password_file}" ]] || ! IFS= read -r var_password < "${var_password_file}"; then
return "${ERR_READ_GRUB_FILE}"
fi
### Turn on tracing again
#[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set -x
var_password=$(<"${var_password_file}") || return "${ERR_READ_GRUB_FILE}"
var_grub_entry=$(generate_grub_password_pbkdf2 "${var_username}" "${var_password}")
### Turn on tracing again
#[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set -x
#### TODO: PASSWORD REMINDER
### Append if not already present
if ! grep -q "set superusers=" "${var_of}"; then
{
@@ -49,6 +51,7 @@ update_grub_password() {
fi
do_in_target "${TARGET}" update-grub
do_log "info" "file_only" "4240() GRUB Password installed successfully."
return 0
}