Skip to content

Commit d8964ae

Browse files
committed
[change] : One liner check_bool
1 parent 6e1b240 commit d8964ae

1 file changed

Lines changed: 14 additions & 32 deletions

File tree

build.sh

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,19 @@ show_channel_list() {
298298

299299
# Check the value of a variable that can only be set to true or false.
300300
check_bool() {
301-
local _value="$(eval echo '$'${1})"
302-
msg_debug -n "Checking ${1}..."
303-
if [[ "${debug}" = true ]]; then
304-
echo -e " ${_value}"
305-
fi
306-
if [[ ! -v "${1}" ]]; then
307-
echo; msg_error "The variable name ${1} is empty." "1"
308-
elif [[ ! "${_value}" = "true" ]] && [[ ! "${_value}" = "false" ]]; then
309-
echo; msg_error "The variable name ${1} is not of bool type." "1"
310-
fi
301+
local _value _variable
302+
for _variable in ${@}; do
303+
_value="$(eval echo '$'${_variable})"
304+
msg_debug -n "Checking ${_variable}..."
305+
if [[ "${debug}" = true ]]; then
306+
echo -e " ${_value}"
307+
fi
308+
if [[ ! -v "${1}" ]]; then
309+
echo; msg_error "The variable name ${_variable} is empty." "1"
310+
elif [[ ! "${_value}" = "true" ]] && [[ ! "${_value}" = "false" ]]; then
311+
echo; msg_error "The variable name ${_variable} is not of bool type." "1"
312+
fi
313+
done
311314
}
312315

313316

@@ -561,28 +564,7 @@ prepare_build() {
561564
fi
562565

563566
# check bool
564-
check_bool boot_splash
565-
check_bool cleaning
566-
check_bool noconfirm
567-
check_bool nodepend
568-
check_bool shmkalteriso
569-
check_bool customized_username
570-
check_bool customized_password
571-
check_bool noloopmod
572-
check_bool nochname
573-
check_bool tarball
574-
check_bool noiso
575-
check_bool noaur
576-
check_bool customized_syslinux
577-
check_bool norescue_entry
578-
check_bool rebuild
579-
check_bool debug
580-
check_bool bash_debug
581-
check_bool nocolor
582-
check_bool msgdebug
583-
check_bool noefi
584-
check_bool include_extra
585-
check_bool nosigcheck
567+
check_bool boot_splash cleaning noconfirm nodepend shmkalteriso customized_username customized_password noloopmod nochname tarball noiso noaur customized_syslinux norescue_entry rebuild debug bash_debug nocolor msgdebug noefi include_extra nosigcheck
586568

587569
# Check architecture for each channel
588570
if [[ ! "$(bash "${tools_dir}/channel.sh" -a ${arch} -n -b check "${channel_name}")" = "correct" ]]; then

0 commit comments

Comments
 (0)