V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 56s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 56s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -15,6 +15,8 @@ guard_sourcing
|
||||
#######################################
|
||||
# Parsing './.preseed/preseed.yaml' and './.preseed/partitioning.yaml'.
|
||||
# Globals:
|
||||
# ARY_ALLOW_IPV4
|
||||
# ARY_ALLOW_IPV6
|
||||
# ARY_BOOTPARAM
|
||||
# ARY_LOCALE
|
||||
# ARY_NTPSRVR
|
||||
@@ -32,7 +34,7 @@ guard_sourcing
|
||||
yaml_parser() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
# shellcheck disable=SC2034
|
||||
declare -ag ARY_BOOTPARAM=() ARY_LOCALE=() ARY_NTPSRVR=() ARY_PACKAGES=()
|
||||
declare -ag ARY_ALLOW_IPV4=() ARY_ALLOW_IPV6=() ARY_BOOTPARAM=() ARY_LOCALE=() ARY_NTPSRVR=() ARY_PACKAGES=()
|
||||
declare -gix VAR_USER_MAX=0
|
||||
declare var_index="" var_key="" var_value=""
|
||||
|
||||
@@ -46,10 +48,12 @@ yaml_parser() {
|
||||
var_value=${var_value%\'}
|
||||
# shellcheck disable=SC2034
|
||||
case "${var_key}" in
|
||||
grub_parameter_[0-9]*) ARY_BOOTPARAM+=("${var_value}") ;;
|
||||
locale_locale_[0-9]*) ARY_LOCALE+=("${var_value}") ;;
|
||||
ntp_server_[0-9]*) ARY_NTPSRVR+=("${var_value}") ;;
|
||||
software_[0-9]*) ARY_PACKAGES+=("${var_value}") ;;
|
||||
grub_parameter_[0-9]*) ARY_BOOTPARAM+=("${var_value}") ;;
|
||||
locale_locale_[0-9]*) ARY_LOCALE+=("${var_value}") ;;
|
||||
ntp_server_[0-9]*) ARY_NTPSRVR+=("${var_value}") ;;
|
||||
ssh_allow_ipv4_[0-9]*) ARY_ALLOW_IPV4+=("${var_value}") ;;
|
||||
ssh_allow_ipv6_[0-9]*) ARY_ALLOW_IPV6+=("${var_value}") ;;
|
||||
software_[0-9]*) ARY_PACKAGES+=("${var_value}") ;;
|
||||
esac
|
||||
done < "${VAR_PRESEED}"
|
||||
|
||||
@@ -68,6 +72,8 @@ yaml_parser() {
|
||||
/^grub_parameter_[0-9]+=/d # delete grub parameter variables
|
||||
/^locale_locale_[0-9]+=/d # delete locale variables
|
||||
/^ntp_server_[0-9]+=/d # delete NTP server variables
|
||||
/^ssh_allow_ipv4_[0-9]+=/d # delete ssh allow IPv4 variables
|
||||
/^ssh_allow_ipv6_[0-9]+=/d # delete ssh allow IPv6 variables
|
||||
/^software_[0-9]+=/d # delete software list variables
|
||||
|
||||
# --- Empty-value normalisation ---------------------------------------
|
||||
|
||||
@@ -41,7 +41,8 @@ yaml_reader() {
|
||||
# shellcheck disable=SC2034
|
||||
declare -Ag HMP_RECIPE_DEV_PARTITIONS=()
|
||||
declare -gx VAR_RECIPE_STRING="" VAR_RECIPE_HIGHEST_DEVICE="" VAR_ARCHITECTURE="" VAR_RECIPE_FIRMWARE="" VAR_NUKE="" \
|
||||
VAR_RECIPE_TABLE="" VAR_NEED_RUN_IN_TARGET="false" VAR_CODENAME="" VAR_DROPBEAR="" VAR_RECOVERY=""
|
||||
VAR_RECIPE_TABLE="" VAR_NEED_RUN_IN_TARGET="false" VAR_CODENAME="" VAR_DROPBEAR="" VAR_RECOVERY="" \
|
||||
VAR_GRUB_PASSWORD="false" VAR_SSH_PORT="22" VAR_DEB822="true" VAR_PROVIDER="" VAR_SSH_CA="" VAR_UFW_OUT="deny"
|
||||
### Declare and substitute input files.
|
||||
declare -r var_if="${VAR_PRESEED}"
|
||||
declare var_line="" var_middle_part="" var_highest_dev="" var_device="" var_fields="" var_partition="" \
|
||||
@@ -137,19 +138,34 @@ END { print max }
|
||||
|
||||
done
|
||||
|
||||
### Extract APT file format.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_DEB822="${apt_default_deb822,,}"
|
||||
|
||||
### Extract architecture.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_ARCHITECTURE="${architecture,,}"
|
||||
|
||||
### Extract distribution.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_CODENAME="${distribution,,}"
|
||||
|
||||
### Extract dropbear installation.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_DROPBEAR="${dropbear_boot,,}"
|
||||
|
||||
### Extract grub password installation.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_GRUB_PASSWORD="${grub_password,,}"
|
||||
|
||||
### Extract SSH Port.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_SSH_PORT="${ssh_port,,}"
|
||||
|
||||
### Extract SSH Root CA.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_SSH_CA="${ssh_root_ca,,}"
|
||||
|
||||
### Extract chroot secure '/run' mounting strategy.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_NEED_RUN_IN_TARGET="${needrun,,}"
|
||||
@@ -190,11 +206,19 @@ END { print max }
|
||||
|
||||
fi
|
||||
|
||||
### Extract provider.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_PROVIDER="${provider,,}"
|
||||
|
||||
### Extract the chosen Recovery mechanism.
|
||||
recipe_recovery_var="recipe_${VAR_RECIPE_STRING}_control_recovery"
|
||||
# shellcheck disable=SC2034
|
||||
VAR_RECOVERY="${!recipe_recovery_var,,}"
|
||||
|
||||
### Extract ufw outgoing policy.
|
||||
# shellcheck disable=SC2034
|
||||
VAR_UFW_OUT="${security_ufw_out,,}"
|
||||
|
||||
guard_dir && return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
|
||||
Reference in New Issue
Block a user