mkarchiso: fix unbound variable errors in _validate_options

$pkg_list_from_file and $bootstrap_pkg_list_from_file are arrays, they must be referenced as such. Fixes https://bugs.archlinux.org/task/71852.

Remove quotes from arithmetic expressions.
This commit is contained in:
nl6720 2021-08-24 18:57:27 +03:00
parent 019f5aaeb6
commit 8d18d8f745
No known key found for this signature in database
GPG Key ID: 5CE88535E188D369

View File

@ -978,7 +978,7 @@ _validate_options() {
if [[ -e "${packages}" ]]; then if [[ -e "${packages}" ]]; then
mapfile -t pkg_list_from_file < <(sed '/^[[:blank:]]*#.*/d;s/#.*//;/^[[:blank:]]*$/d' "${packages}") mapfile -t pkg_list_from_file < <(sed '/^[[:blank:]]*#.*/d;s/#.*//;/^[[:blank:]]*$/d' "${packages}")
pkg_list+=("${pkg_list_from_file[@]}") pkg_list+=("${pkg_list_from_file[@]}")
if (( ${#pkg_list_from_file} < 1 )); then if (( ${#pkg_list_from_file[@]} < 1 )); then
(( validation_error=validation_error+1 )) (( validation_error=validation_error+1 ))
_msg_error "No package specified in '${packages}'." 0 _msg_error "No package specified in '${packages}'." 0
fi fi
@ -993,7 +993,7 @@ _validate_options() {
mapfile -t bootstrap_pkg_list_from_file < \ mapfile -t bootstrap_pkg_list_from_file < \
<(sed '/^[[:blank:]]*#.*/d;s/#.*//;/^[[:blank:]]*$/d' "${bootstrap_packages}") <(sed '/^[[:blank:]]*#.*/d;s/#.*//;/^[[:blank:]]*$/d' "${bootstrap_packages}")
bootstrap_pkg_list+=("${bootstrap_pkg_list_from_file[@]}") bootstrap_pkg_list+=("${bootstrap_pkg_list_from_file[@]}")
if (( ${#bootstrap_pkg_list_from_file} < 1 )); then if (( ${#bootstrap_pkg_list_from_file[@]} < 1 )); then
(( validation_error=validation_error+1 )) (( validation_error=validation_error+1 ))
_msg_error "No package specified in '${bootstrap_packages}'." 0 _msg_error "No package specified in '${bootstrap_packages}'." 0
fi fi
@ -1014,7 +1014,7 @@ _validate_options() {
done done
cert_list=("${_override_cert_list[@]}") cert_list=("${_override_cert_list[@]}")
# Check if there are at least two certificate files # Check if there are at least two certificate files
if (( "${#cert_list[@]}" < 2 )); then if (( ${#cert_list[@]} < 2 )); then
(( validation_error=validation_error+1 )) (( validation_error=validation_error+1 ))
_msg_error "Two certificates are required for codesigning, but '${cert_list[*]}' is provided." 0 _msg_error "Two certificates are required for codesigning, but '${cert_list[*]}' is provided." 0
fi fi
@ -1074,7 +1074,7 @@ _validate_options() {
_set_overrides() { _set_overrides() {
# Set variables that have command line overrides # Set variables that have command line overrides
[[ ! -v override_buildmodes ]] || buildmodes=("${override_buildmodes[@]}") [[ ! -v override_buildmodes ]] || buildmodes=("${override_buildmodes[@]}")
if (( "${#buildmodes[@]}" < 1 )); then if (( ${#buildmodes[@]} < 1 )); then
buildmodes+=('iso') buildmodes+=('iso')
fi fi
if [[ -v override_work_dir ]]; then if [[ -v override_work_dir ]]; then