Skip to content

Commit f0ce63e

Browse files
committed
[update] : Use exit code to check module
1 parent 4743ab7 commit f0ce63e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,8 @@ prepare_build() {
488488

489489
local module_check
490490
module_check(){
491-
if [[ ! "$(bash "${tools_dir}/module.sh" check "${1}")" = "correct" ]]; then
491+
msg_debug "Checking ${1} module ..."
492+
if ! bash "${tools_dir}/module.sh" check "${1}"; then
492493
msg_error "Module ${1} is not available." "1";
493494
fi
494495
}

tools/module.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ _help() {
3131
echo " General options:"
3232
echo " -v | --version [ver] Specifies the AlterISO version"
3333
echo " -h | --help This help message"
34+
echo
35+
echo " check exit code:"
36+
echo " 0 (correct) 1 (incorrect) 2 (other)"
3437
}
3538

3639
check(){
3740
if (( "${#}" == 0 )) || (( "${#}" >= 2 ));then
3841
_help
39-
exit 1
42+
exit 2
4043
fi
4144
local _version
4245
if [[ -f "${module_dir}/${1}/alteriso" ]]; then
@@ -46,10 +49,10 @@ check(){
4649
unset alteriso
4750
)"
4851
if (( "$(echo "${_version}" | cut -d "." -f 1)" == "$(echo "${alteriso_version}" | cut -d "." -f 1)" )); then
49-
echo "correct"
52+
exit 0
5053
fi
5154
else
52-
echo "incorrect"
55+
exit 1
5356
fi
5457
}
5558

0 commit comments

Comments
 (0)