From: Kevin Day Date: Sun, 28 Jul 2019 21:48:42 +0000 (-0500) Subject: Update: always return 1 on failure X-Git-Tag: 0.4.3~8 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=72aa64383c1356115a3b7a074b239ab81212e34e;p=fll Update: always return 1 on failure There were some cases where exit is not being called and other cases where exit 0 is being called. Make sure that exit 1 is called on error so that this script can then be scriptable. --- diff --git a/build/scripts/generate.sh b/build/scripts/generate.sh index 1903e88..9fbf2f6 100644 --- a/build/scripts/generate.sh +++ b/build/scripts/generate.sh @@ -125,11 +125,12 @@ generate_main(){ if [[ ! -d $path_c && ( ${variables[$(generate_id build_sources_library)]} != "" || ${variables[$(generate_id build_sources_program)]} != "" || ${variables[$(generate_id build_sources_headers)]} != "" ) ]] ; then echo -e "${c_error}ERROR: the c path of '$c_notice$path_c$c_error' is invalid.$c_reset" generate_cleanup - exit 0 + exit 1 fi if [[ $operation_failure == "fail-multiple" ]] ; then echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset" + exit 1 elif [[ $operation == "build" ]] ; then if [[ -f ${path_build}.built$project_built ]] ; then echo -e "${c_warning}WARNING: this project has already been built.$c_reset" @@ -144,8 +145,10 @@ generate_main(){ generate_operation_clean elif [[ $operation == "" ]] ; then echo -e "${c_error}ERROR: no operation was given.$c_reset" + exit 1 else echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset" + exit 1 fi } diff --git a/build/scripts/install.sh b/build/scripts/install.sh index 0a0c50b..290cc9a 100644 --- a/build/scripts/install.sh +++ b/build/scripts/install.sh @@ -125,6 +125,7 @@ install_main(){ if [[ $operation_failure == "fail-unsupported" ]] ; then echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset" + exit 1 else if [[ $prefix == "" && ! -d $path_build ]] ; then echo -e "${c_error}ERROR: the build path $c_notice$path_build$c_error is not a valid directory.$c_reset" diff --git a/build/scripts/package.sh b/build/scripts/package.sh index e81fc2c..3b49a6b 100644 --- a/build/scripts/package.sh +++ b/build/scripts/package.sh @@ -141,6 +141,7 @@ package_main(){ if [[ $operation_failure == "fail-multiple" ]] ; then echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset" + exit 1 elif [[ $operation == "build" ]] ; then if [[ $mode_individual == "" && $mode_level == "" && $mode_monolithic == "" && $mode_program == "" ]] ; then mode_individual="yes" @@ -165,8 +166,10 @@ package_main(){ package_operation_clean elif [[ $operation == "" ]] ; then echo -e "${c_error}ERROR: no operation was given.$c_reset" + exit 1 else echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset" + exit 1 fi }