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

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-09-16 20:05:18 +02:00
parent 9f59ba46b1
commit d6f7710eaf

View File

@@ -36,7 +36,7 @@ yaml_parser() {
# shellcheck disable=SC2034 # shellcheck disable=SC2034
declare -ag ARY_ALLOW_IPV4=() ARY_ALLOW_IPV6=() 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=-1 declare -gix VAR_USER_MAX=-1
declare var_index="" var_key="" var_value="" declare var_index="" var_key="" var_value="" _=""
cat "${DIR_CNF}/preseed.yaml" "${DIR_CNF}/partitioning.yaml" >| "${DIR_TMP}/combined.yaml" cat "${DIR_CNF}/preseed.yaml" "${DIR_CNF}/partitioning.yaml" >| "${DIR_TMP}/combined.yaml"
@@ -56,16 +56,17 @@ yaml_parser() {
software_[0-9]*) ARY_PACKAGES+=("${var_value}") ;; software_[0-9]*) ARY_PACKAGES+=("${var_value}") ;;
esac esac
done < "${VAR_PRESEED}" done < "${VAR_PRESEED}"
var_key=""
### Search all set variables for user_userN_name patterns. ### Search all set variables for user_userN_name patterns.
# shellcheck disable=SC2312 # shellcheck disable=SC2312
while IFS= read -r v; do while IFS='=' read -r var_key _; do
### Accept any of these keys: name, fullname, uid, gid, shell, password, sshpubkey, authentication_* and privileges_* ### Accept any of these keys: name, fullname, uid, gid, shell, password, sshpubkey, authentication_* and privileges_*
if [[ "${v}" =~ ^user_user([0-9]+)_(name|fullname|uid|gid|shell|password|sshpubkey|authentication_[A-Za-z0-9_]+|privileges_[A-Za-z0-9_]+)$ ]]; then if [[ "${var_key}" =~ ^user_user([0-9]+)_(name|fullname|uid|gid|shell|password|sshpubkey|authentication_[A-Za-z0-9_]+|privileges_[A-Za-z0-9_]+)$ ]]; then
var_index=${BASH_REMATCH[1]} var_index=${BASH_REMATCH[1]}
(( var_index > VAR_USER_MAX )) && VAR_USER_MAX=var_index (( var_index > VAR_USER_MAX )) && VAR_USER_MAX=var_index
fi fi
done < <(compgen -A variable user_user) done < "${VAR_PRESEED}"
### If nothing matched, default to 0 (only user 0). ### If nothing matched, default to 0 (only user 0).
(( VAR_USER_MAX < 0 )) && VAR_USER_MAX=0 (( VAR_USER_MAX < 0 )) && VAR_USER_MAX=0