From: Kevin Day Date: Fri, 12 Jun 2020 02:09:00 +0000 (-0500) Subject: Update: add support for ++quiet and ++verbose in the scripts X-Git-Tag: 0.5.0~167 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=92d3142c93e2656add6bb90ee01a611ca5992deb;p=fll Update: add support for ++quiet and ++verbose in the scripts --- diff --git a/build/scripts/bootstrap.sh b/build/scripts/bootstrap.sh index e0291e6..c7aaf68 100644 --- a/build/scripts/bootstrap.sh +++ b/build/scripts/bootstrap.sh @@ -48,6 +48,7 @@ bootstrap_main() { local project_built= local defines_override= local process= + local verbosity="normal" local enable_shared= local enable_static= @@ -66,9 +67,15 @@ bootstrap_main() { do_color=none elif [[ $p == "+l" || $p == "++light" ]] ; then do_color=light + elif [[ $p == "+q" || $p == "++quiet" ]] ; then + verbosity="quiet" + verbose= elif [[ $p == "+v" || $p == "++version" ]] ; then echo $version return + elif [[ $p == "+V" || $p == "++verbose" ]] ; then + verbosity="verbose" + verbose="-v" elif [[ $p == "-d" || $p == "--defines" ]] ; then grab_next=defines_override elif [[ $p == "-m" || $p == "--mode" ]] ; then @@ -140,7 +147,10 @@ bootstrap_main() { # FSS and Featurless Make supports more flexible mode names, but for the purpose of this bootstrap script and avoiding potential problems, keep it simple. if [[ $mode != "" && $(echo "$mode" | grep -s -o "[^_[:alnum:]+-]") != "" ]] ; then - echo -e "${c_error}ERROR: the mode $c_notice$mode$c_error includes invalid characters, only alphanumeric, underscore, minus, and plus are allowed.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the mode $c_notice$mode$c_error includes invalid characters, only alphanumeric, underscore, minus, and plus are allowed.$c_reset" + fi + bootstrap_cleanup return 1 fi @@ -151,7 +161,10 @@ bootstrap_main() { mode=${variables[$(bootstrap_id modes_default)]} if [[ $mode != "" && $(echo "$mode" | grep -s -o "[^_[:alnum:]+-]") != "" ]] ; then - echo -e "${c_error}ERROR: the mode $c_notice$mode$c_error includes invalid characters, only alphanumeric, underscore, minus, and plus are allowed.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the mode $c_notice$mode$c_error includes invalid characters, only alphanumeric, underscore, minus, and plus are allowed.$c_reset" + fi + bootstrap_cleanup return 1 fi @@ -166,7 +179,10 @@ bootstrap_main() { if [[ ${variables[$(bootstrap_id modes)]} == "" ]] ; then if [[ $mode != "" ]] ; then - echo -e "${c_error}ERROR: the mode $c_notice$mode$c_error is not a valid mode, there are no available modes.$c_error$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the mode $c_notice$mode$c_error is not a valid mode, there are no available modes.$c_error$c_reset" + fi + bootstrap_cleanup return 1 fi @@ -180,67 +196,99 @@ bootstrap_main() { done if [[ $i -eq 0 ]] ; then - echo -e "${c_error}ERROR: the mode $c_notice$mode$c_error is not a valid mode, it must be one of: $c_notice${variables[$(bootstrap_id modes)]}$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the mode $c_notice$mode$c_error is not a valid mode, it must be one of: $c_notice${variables[$(bootstrap_id modes)]}$c_error.$c_reset" + fi + bootstrap_cleanup return 1 fi fi if [[ ${variables[$(bootstrap_id project_name)]} == "" ]] ; then - echo -e "${c_error}ERROR: the required setting '${c_notice}project_name$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the required setting '${c_notice}project_name$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + fi + bootstrap_cleanup return 1 fi if [[ ${variables[$(bootstrap_id version_major)]} == "" ]] ; then - echo -e "${c_error}ERROR: the required setting '${c_notice}version_major$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the required setting '${c_notice}version_major$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + fi + bootstrap_cleanup return 1 fi if [[ ${variables[$(bootstrap_id version_minor)]} == "" ]] ; then - echo -e "${c_error}ERROR: the required setting '${c_notice}version_minor$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the required setting '${c_notice}version_minor$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + fi + bootstrap_cleanup return 1 fi if [[ ${variables[$(bootstrap_id version_micro)]} == "" ]] ; then - echo -e "${c_error}ERROR: the required setting '${c_notice}version_micro$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the required setting '${c_notice}version_micro$c_error' is not specified in the build settings file '$c_notice$settings_file$c_error'.$c_reset" + fi + bootstrap_cleanup return 1 fi if [[ $path_data == "" || ! -d $path_data ]] ; then - echo -e "${c_error}ERROR: the data directory $c_notice$path_data$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the data directory $c_notice$path_data$c_error is not a valid directory.$c_reset" + fi + bootstrap_cleanup return 1 fi if [[ $path_sources == "" || ! -d $path_sources ]] ; then - echo -e "${c_error}ERROR: the sources directory $c_notice$path_sources$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the sources directory $c_notice$path_sources$c_error is not a valid directory.$c_reset" + fi + bootstrap_cleanup return 1 fi if [[ $path_work != "" && ! -d $path_work ]] ; then - echo -e "${c_error}ERROR: the work directory $c_notice$path_work$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the work directory $c_notice$path_work$c_error is not a valid directory.$c_reset" + fi + bootstrap_cleanup return 1 fi if [[ $defines_override != "" && $(echo "$defines_override" | grep -s -o "[^_[:alnum:][:space:]]") != "" ]] ; then - echo -e "${c_error}ERROR: the defines override $c_notice$defines_override$c_error includes invalid characters, only alphanumeric, whitespace, and underscore are allowed.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the defines override $c_notice$defines_override$c_error includes invalid characters, only alphanumeric, whitespace, and underscore are allowed.$c_reset" + fi + bootstrap_cleanup return 1 fi if [[ $operation_failure == "fail-multiple" ]] ; then - echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset" + fi + bootstrap_cleanup return 1 elif [[ $operation == "build" ]] ; then if [[ -f ${project_built}.built ]] ; then - echo -e "${c_warning}WARNING: this project has already been built.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_warning}WARNING: this project has already been built.$c_reset" + fi else if [[ ! -f ${project_built}.prepared ]] ; then bootstrap_prepare_build @@ -251,11 +299,17 @@ bootstrap_main() { elif [[ $operation == "clean" ]] ; then bootstrap_operation_clean elif [[ $operation == "" ]] ; then - echo -e "${c_error}ERROR: no operation was given.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: no operation was given.$c_reset" + fi + bootstrap_cleanup return 1 else - echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset" + fi + bootstrap_cleanup return 1 fi @@ -298,6 +352,8 @@ bootstrap_help() { echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." + echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity beyond normal output." + echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." echo echo -e "${c_highlight}Bootstrap Options:$c_reset" @@ -389,10 +445,16 @@ bootstrap_load_settings() { local key= if [[ ! -d ${path_data}build/ ]] ; then - echo -e "${c_error}ERROR: no build settings directory '$c_notice${path_data}build/$c_error' could not be found or is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: no build settings directory '$c_notice${path_data}build/$c_error' could not be found or is not a valid directory.$c_reset" + fi + failure=1 elif [[ ! -f $settings_file ]] ; then - echo -e "${c_error}ERROR: no settings file $c_notice$settings_file$c_error could not be found or is not a valid file.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: no settings file $c_notice$settings_file$c_error could not be found or is not a valid file.$c_reset" + fi + failure=1 fi @@ -419,11 +481,11 @@ bootstrap_prepare_build() { local alt=$1 local i= - mkdir -vp ${path_build}{documents,includes,libraries/{script,shared,static},objects,programs/{script,shared,static},settings,stage} || failure=1 + mkdir $verbose -p ${path_build}{documents,includes,libraries/{script,shared,static},objects,programs/{script,shared,static},settings,stage} || failure=1 if [[ $failure == "" ]] ; then for i in ${variables[$(bootstrap_id path_headers)]} ; do - mkdir -vp ${path_build}includes/$i || failure=1 + mkdir $verbose -p ${path_build}includes/$i || failure=1 done fi @@ -615,20 +677,29 @@ bootstrap_operation_build() { fi if [[ $shared != "yes" && $static != "yes" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, either build_shared or build_static must be set to 'yes'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Cannot Build, either build_shared or build_static must be set to 'yes'.$c_reset" + fi + bootstrap_cleanup exit -1 fi if [[ $search_shared != "yes" && $search_static != "yes" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, either search_shared or search_static must be set to 'yes'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Cannot Build, either search_shared or search_static must be set to 'yes'.$c_reset" + fi + bootstrap_cleanup exit -1 fi for i in $sources_library ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid source_library path provided: '$i'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Cannot Build, invalid source_library path provided: '$i'.$c_reset" + fi + bootstrap_cleanup exit -1 fi @@ -636,7 +707,10 @@ bootstrap_operation_build() { for i in $sources_program ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_program path provided: '$i'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Cannot Build, invalid sources_program path provided: '$i'.$c_reset" + fi + bootstrap_cleanup exit -1 fi @@ -644,7 +718,10 @@ bootstrap_operation_build() { for i in $sources_headers ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_headers path provided: '$i'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Cannot Build, invalid sources_headers path provided: '$i'.$c_reset" + fi + bootstrap_cleanup exit -1 fi @@ -652,7 +729,10 @@ bootstrap_operation_build() { for i in $sources_bash ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_bash path provided: '$i'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Cannot Build, invalid sources_bash path provided: '$i'.$c_reset" + fi + bootstrap_cleanup exit -1 fi @@ -660,7 +740,10 @@ bootstrap_operation_build() { for i in $sources_setting ; do if [[ $i != "$(echo $i | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then - echo -e "${c_error}ERROR: Cannot Build, invalid sources_setting path provided: '$i'.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: Cannot Build, invalid sources_setting path provided: '$i'.$c_reset" + fi + bootstrap_cleanup exit -1 fi @@ -684,12 +767,12 @@ bootstrap_operation_build() { directory=$(dirname $i) if [[ $directory == "." ]] ; then - cp -vR $path_settings$i ${path_build}settings/ || failure=1 + cp $verbose -R $path_settings$i ${path_build}settings/ || failure=1 else - mkdir -vp ${path_build}settings/$directory || failure=1 + mkdir $verbose -p ${path_build}settings/$directory || failure=1 if [[ $failure == "" ]] ; then - cp -vR $path_settings$i ${path_build}settings/${directory}/ || failure=1 + cp $verbose -R $path_settings$i ${path_build}settings/${directory}/ || failure=1 fi fi done @@ -701,18 +784,18 @@ bootstrap_operation_build() { directory=$(dirname $i) if [[ $directory == "." ]] ; then - cp -vf $path_c$i ${path_build}includes/ || failure=1 + cp $verbose -f $path_c$i ${path_build}includes/ || failure=1 else - mkdir -vp ${path_build}includes/$directory || failure=1 + mkdir $verbose -p ${path_build}includes/$directory || failure=1 if [[ $failure == "" ]] ; then - cp -vf $path_c$i ${path_build}includes/$i || failure=1 + cp $verbose -f $path_c$i ${path_build}includes/$i || failure=1 fi fi done else for i in $sources_headers ; do - cp -vf $path_c$i ${path_build}includes/$path_headers/ || failure=1 + cp $verbose -f $path_c$i ${path_build}includes/$path_headers/ || failure=1 done fi fi @@ -724,12 +807,15 @@ bootstrap_operation_build() { sources="$sources$path_c$i " done - echo $compiler $sources -shared -Wl,-soname,lib$name.so.$version -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments_shared $arguments_include $libraries $flags_all $flags_shared $flags_library + if [[ $verbosity == "verbose" ]] ; then + echo $compiler $sources -shared -Wl,-soname,lib$name.so.$version -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments_shared $arguments_include $libraries $flags_all $flags_shared $flags_library + fi + $compiler $sources -shared -Wl,-soname,lib$name.so.$version -o ${path_build}libraries/shared/lib$name.so.$major.$minor.$micro $arguments_shared $arguments_include $libraries $flags_all $flags_shared $flags_library || failure=1 if [[ $failure == "" ]] ; then - ln -vsf lib$name.so.$major.$minor.$micro ${path_build}libraries/shared/lib$name.so.$major || failure=1 - ln -vsf lib$name.so.$major ${path_build}libraries/shared/lib$name.so || failure=1 + ln $verbose -sf lib$name.so.$major.$minor.$micro ${path_build}libraries/shared/lib$name.so.$major || failure=1 + ln $verbose -sf lib$name.so.$major ${path_build}libraries/shared/lib$name.so || failure=1 fi fi @@ -745,7 +831,10 @@ bootstrap_operation_build() { sources="$sources$path_c$i " done - echo $compiler $sources -o ${path_build}programs/shared/$name $arguments_shared $arguments_include $links $libraries $flags_all $flags_shared $flags_program + if [[ $verbosity == "verbose" ]] ; then + echo $compiler $sources -o ${path_build}programs/shared/$name $arguments_shared $arguments_include $links $libraries $flags_all $flags_shared $flags_program + fi + $compiler $sources -o ${path_build}programs/shared/$name $arguments_shared $arguments_include $links $libraries $flags_all $flags_shared $flags_program || failure=1 fi fi @@ -758,7 +847,7 @@ bootstrap_operation_build() { n=$(basename $i | sed -e 's|\.c$||') if [[ $directory != "." && ! -d ${path_build}objects/$directory ]] ; then - mkdir -vp ${path_build}objects/$directory + mkdir $verbose -p ${path_build}objects/$directory if [[ $? -ne 0 ]] ; then failure=1 @@ -768,7 +857,10 @@ bootstrap_operation_build() { sources="$sources${path_build}objects/$directory/$n.o " - echo $compiler $path_c$i -c -static -o ${path_build}objects/$directory/$n.o $arguments_static $arguments_include $libraries $flags_all $flags_static $flags_library + if [[ $verbosity == "verbose" ]] ; then + echo $compiler $path_c$i -c -static -o ${path_build}objects/$directory/$n.o $arguments_static $arguments_include $libraries $flags_all $flags_static $flags_library + fi + $compiler $path_c$i -c -static -o ${path_build}objects/$directory/$n.o $arguments_static $arguments_include $libraries $flags_all $flags_static $flags_library || failure=1 if [[ $failure == "1" ]] ; then @@ -777,7 +869,10 @@ bootstrap_operation_build() { done if [[ $failure == "" ]] ; then - echo $linker rcs ${path_build}libraries/static/lib$name.a $sources + if [[ $verbosity == "verbose" ]] ; then + echo $linker rcs ${path_build}libraries/static/lib$name.a $sources + fi + $linker rcs ${path_build}libraries/static/lib$name.a $sources || failure=1 fi fi @@ -794,13 +889,19 @@ bootstrap_operation_build() { sources="$sources$path_c$i " done - echo $compiler $sources -static -o ${path_build}programs/static/$name $arguments_static $arguments_include $links $libraries $flags_all $flags_static $flags_program + if [[ $verbosity == "verbose" ]] ; then + echo $compiler $sources -static -o ${path_build}programs/static/$name $arguments_static $arguments_include $links $libraries $flags_all $flags_static $flags_program + fi + $compiler $sources -static -o ${path_build}programs/static/$name $arguments_static $arguments_include $links $libraries $flags_all $flags_static $flags_program || failure=1 fi fi if [[ $failure != "" ]] ; then - echo -e "${c_error}ERROR: failed to build.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to build.$c_reset" + fi + bootstrap_cleanup exit $failure fi @@ -813,16 +914,16 @@ bootstrap_operation_clean() { for i in ${path_build}{documents,includes,libraries,objects,programs,settings,stage} ; do if [[ -e $i ]] ; then - rm -vRf $i + rm $verbose -Rf $i fi done if [[ -f ${project_built}.prepared ]] ; then - rm -vf ${project_built}.prepared + rm $verbose -f ${project_built}.prepared fi if [[ -f ${project_built}.built ]] ; then - rm -vf ${project_built}.built + rm $verbose -f ${project_built}.built fi } diff --git a/build/scripts/install.sh b/build/scripts/install.sh index 2346ffa..43a564b 100644 --- a/build/scripts/install.sh +++ b/build/scripts/install.sh @@ -35,6 +35,8 @@ install_main() { local settings_file=data/build/settings local operation= local operation_failure= + local verbosity="normal" + local verbose= local path_build=build/ local path_programs=programs/ @@ -72,9 +74,15 @@ install_main() { do_color=none elif [[ $p == "+l" || $p == "++light" ]] ; then do_color=light + elif [[ $p == "+q" || $p == "++quiet" ]] ; then + verbosity="quiet" + verbose= elif [[ $p == "+v" || $p == "++version" ]] ; then echo $version return + elif [[ $p == "+V" || $p == "++verbose" ]] ; then + verbosity="verbose" + verbose="-v" elif [[ $p == "-b" || $p == "--build" ]] ; then grab_next=path_build elif [[ $p == "-s" || $p == "--settings" ]] ; then @@ -150,19 +158,28 @@ install_main() { fi if [[ $operation_failure == "fail-unsupported" ]] ; then - echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset" + fi + install_cleanup return 1 fi 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" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the build path $c_notice$path_build$c_error is not a valid directory.$c_reset" + fi + install_cleanup return 1 fi if [[ $destination_prefix != "" && ! -d $destination_prefix ]] ; then - echo -e "${c_error}ERROR: the destination prefix $c_notice$destination_prefix$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the destination prefix $c_notice$destination_prefix$c_error is not a valid directory.$c_reset" + fi + install_cleanup return 1 fi @@ -214,43 +231,64 @@ install_main() { fi if [[ $work != "" && ! -d $work ]] ; then - echo -e "${c_error}ERROR: the work directory $c_notice$work$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the work directory $c_notice$work$c_error is not a valid directory.$c_reset" + fi + install_cleanup return 1 fi if [[ ! -d $destination_programs ]] ; then - echo -e "${c_error}ERROR: the destination bindir $c_notice$destination_programs$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the destination bindir $c_notice$destination_programs$c_error is not a valid directory.$c_reset" + fi + install_cleanup return 1 fi if [[ ! -d $destination_programs_static ]] ; then - echo -e "${c_error}ERROR: the destination (static) bindir $c_notice$destination_programs_static$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the destination (static) bindir $c_notice$destination_programs_static$c_error is not a valid directory.$c_reset" + fi + install_cleanup return 1 fi if [[ ! -d $destination_programs_shared ]] ; then - echo -e "${c_error}ERROR: the destination (shared) bindir $c_notice$destination_programs_shared$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the destination (shared) bindir $c_notice$destination_programs_shared$c_error is not a valid directory.$c_reset" + fi + install_cleanup return 1 fi if [[ ! -d $destination_includes ]] ; then - echo -e "${c_error}ERROR: the destination incluedir $c_notice$destination_includes$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the destination incluedir $c_notice$destination_includes$c_error is not a valid directory.$c_reset" + fi + install_cleanup return 1 fi if [[ ! -d $destination_libraries_static ]] ; then - echo -e "${c_error}ERROR: the destination (static) libdir $c_notice$destination_libraries_static$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the destination (static) libdir $c_notice$destination_libraries_static$c_error is not a valid directory.$c_reset" + fi + install_cleanup return 1 fi if [[ ! -d $destination_libraries_shared ]] ; then - echo -e "${c_error}ERROR: the destination (shared) libdir $c_notice$destination_libraries_shared$c_error is not a valid directory.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the destination (shared) libdir $c_notice$destination_libraries_shared$c_error is not a valid directory.$c_reset" + fi + install_cleanup return 1 fi @@ -295,6 +333,8 @@ install_help() { echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." + echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity beyond normal output." + echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." echo echo -e "${c_highlight}Install Options:$c_reset" @@ -336,10 +376,16 @@ install_load_settings() { local i= if [[ $settings_file == "" ]] ; then - echo -e "${c_error}ERROR: no settings file has been defined.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: no settings file has been defined.$c_reset" + fi + failure=1 elif [[ ! -f $settings_file ]] ; then - echo -e "${c_error}ERROR: no settings file $c_notice$settings_file$c_error could not be found or is not a valid file.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: no settings file $c_notice$settings_file$c_error could not be found or is not a valid file.$c_reset" + fi + failure=1 fi @@ -376,64 +422,85 @@ install_perform_install() { if [[ $work != "" ]] ; then if [[ ! -d ${work}programs ]] ; then - mkdir -v ${work}programs + mkdir $verbose ${work}programs if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}programs$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}programs$c_error.$c_reset" + fi + failure=1 fi fi if [[ ! -d ${work}programs/shared ]] ; then - mkdir -v ${work}programs/shared + mkdir $verbose ${work}programs/shared if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}programs/shared$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}programs/shared$c_error.$c_reset" + fi + failure=1 fi fi if [[ ! -d ${work}programs/static ]] ; then - mkdir -v ${work}programs/static + mkdir $verbose ${work}programs/static if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}programs/static$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}programs/static$c_error.$c_reset" + fi + failure=1 fi fi if [[ ! -d ${work}libraries ]] ; then - mkdir -v ${work}libraries + mkdir $verbose ${work}libraries if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}libraries$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}libraries$c_error.$c_reset" + fi + failure=1 fi fi if [[ ! -d ${work}libraries/shared ]] ; then - mkdir -v ${work}libraries/shared + mkdir $verbose ${work}libraries/shared if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}libraries/shared$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}libraries/shared$c_error.$c_reset" + fi + failure=1 fi fi if [[ ! -d ${work}libraries/static ]] ; then - mkdir -v ${work}libraries/static + mkdir $verbose ${work}libraries/static if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}libraries/static$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}libraries/static$c_error.$c_reset" + fi + failure=1 fi fi if [[ ! -d ${work}includes ]] ; then - mkdir -v ${work}includes + mkdir $verbose ${work}includes if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}includes$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create work directories $c_notice${work}includes$c_error.$c_reset" + fi + failure=1 fi fi @@ -451,35 +518,53 @@ install_perform_install() { fi if [[ $failure == "" && $build_sources_headers != "" ]] ; then - echo - echo -e "${c_highlight}Installing Includes to: $c_reset$c_notice$destination_includes$c_reset${c_highlight}.$c_reset" - cp -vR $path_build${path_includes}* $destination_includes + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Installing Includes to: $c_reset$c_notice$destination_includes$c_reset${c_highlight}.$c_reset" + fi + + cp $verbose -R $path_build${path_includes}* $destination_includes if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy include files from $c_notice$path_build$path_includes$c_error to $c_notice$destination_includes$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy include files from $c_notice$path_build$path_includes$c_error to $c_notice$destination_includes$c_error.$c_reset" + fi + failure=1 fi fi if [[ $failure == "" && ( $build_sources_library != "" || $build_sources_program != "" ) ]] ; then if [[ $build_static == "yes" ]] ; then - echo - echo -e "${c_highlight}Installing (static) Libraries to: $c_reset$c_notice$destination_libraries_static$c_reset${c_highlight}.$c_reset" - cp -vR $path_build$path_libraries${path_static}* $destination_libraries_static + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Installing (static) Libraries to: $c_reset$c_notice$destination_libraries_static$c_reset${c_highlight}.$c_reset" + fi + + cp $verbose -R $path_build$path_libraries${path_static}* $destination_libraries_static if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy (static) library files from $c_notice$path_build$path_libraries$path_static$c_error to $c_notice$destination_libraries_static$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy (static) library files from $c_notice$path_build$path_libraries$path_static$c_error to $c_notice$destination_libraries_static$c_error.$c_reset" + fi + failure=1 fi fi if [[ $failure == "" && $build_shared == "yes" ]] ; then - echo - echo -e "${c_highlight}Installing (shared) Libraries to: $c_reset$c_notice$destination_libraries_shared$c_reset${c_highlight}.$c_reset" - cp -vR $path_build$path_libraries${path_shared}* $destination_libraries_shared + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Installing (shared) Libraries to: $c_reset$c_notice$destination_libraries_shared$c_reset${c_highlight}.$c_reset" + fi + + cp $verbose -R $path_build$path_libraries${path_shared}* $destination_libraries_shared if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy (shared) library files from $c_notice$path_build$path_libraries$build_shared$c_error to $c_notice$destination_libraries_shared$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy (shared) library files from $c_notice$path_build$path_libraries$build_shared$c_error to $c_notice$destination_libraries_shared$c_error.$c_reset" + fi + failure=1 fi fi @@ -487,29 +572,41 @@ install_perform_install() { if [[ $failure == "" && $build_sources_program != "" ]] ; then if [[ $build_static == "yes" ]] ; then - echo - echo -e "${c_highlight}Installing (static) Programs to: $c_reset$c_notice$destination_programs_static$c_reset${c_highlight}.$c_reset" - cp -vR $path_build$path_programs${path_static}* $destination_programs_static + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Installing (static) Programs to: $c_reset$c_notice$destination_programs_static$c_reset${c_highlight}.$c_reset" + fi + + cp $verbose -R $path_build$path_programs${path_static}* $destination_programs_static if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy (static) library files from $c_notice$path_build$path_programs$path_static$c_error to $c_notice$destination_programs_static$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy (static) library files from $c_notice$path_build$path_programs$path_static$c_error to $c_notice$destination_programs_static$c_error.$c_reset" + fi + failure=1 fi fi if [[ $failure == "" && $build_shared == "yes" ]] ; then - echo - echo -e "${c_highlight}Installing (shared) Programs to: $c_reset$c_notice$destination_programs_shared$c_reset${c_highlight}.$c_reset" - cp -vR $path_build$path_programs${path_shared}* $destination_programs_shared + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Installing (shared) Programs to: $c_reset$c_notice$destination_programs_shared$c_reset${c_highlight}.$c_reset" + fi + + cp $verbose -R $path_build$path_programs${path_shared}* $destination_programs_shared if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy (shared) library files from $c_notice$path_build$path_programs$build_shared$c_error to $c_notice$destination_programs_shared$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy (shared) library files from $c_notice$path_build$path_programs$build_shared$c_error to $c_notice$destination_programs_shared$c_error.$c_reset" + fi + failure=1 fi fi fi - if [[ $failure == "" && $build_sources_settings != "" ]] ; then + if [[ $failure == "" && $build_sources_settings != "" && $verbosity != "quiet" ]] ; then echo echo -e "${c_warning}Settings Files Detected, see: $c_reset$c_notice$path_build$path_settings$c_reset${c_warning}.$c_reset" fi diff --git a/build/scripts/package.sh b/build/scripts/package.sh index df6b788..873649d 100644 --- a/build/scripts/package.sh +++ b/build/scripts/package.sh @@ -39,6 +39,7 @@ package_main() { local path_build=build/ local path_destination=package/ local path_sources=./ + local verbosity="normal" if [[ $# -gt 0 ]] ; then t=$# @@ -54,9 +55,15 @@ package_main() { do_color=none elif [[ $p == "+l" || $p == "++light" ]] ; then do_color=light + elif [[ $p == "+q" || $p == "++quiet" ]] ; then + verbosity="quiet" + verbose= elif [[ $p == "+v" || $p == "++version" ]] ; then echo $version return + elif [[ $p == "+V" || $p == "++verbose" ]] ; then + verbosity="verbose" + verbose="-v" elif [[ $p == "-b" || $p == "--build" ]] ; then grab_next=path_build elif [[ $p == "-d" || $p == "--destination" ]] ; then @@ -102,51 +109,75 @@ package_main() { fi if [[ $operation_failure == "fail-multiple" ]] ; then - echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: only one operation may be specified at a time.$c_reset" + fi + package_cleanup return 1 elif [[ $operation == "build" ]] ; then if [[ ! -d $path_build ]] ; then - echo -e "${c_error}ERROR: build directory '$path_build' is invalid or missing.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: build directory '$path_build' is invalid or missing.$c_reset" + fi + package_cleanup return 1 fi if [[ ! -d $path_destination ]] ; then - mkdir -vp $path_destination + mkdir $verbose -p $path_destination if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: package directory '$path_destination' is invalid or could not be created.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: package directory '$path_destination' is invalid or could not be created.$c_reset" + fi + package_cleanup return 1 fi fi if [[ ! -d $path_sources ]] ; then - echo -e "${c_error}ERROR: sources directory '$path_sources' is invalid or missing.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: sources directory '$path_sources' is invalid or missing.$c_reset" + fi + package_cleanup return 1 fi if [[ ! -d ${path_sources}level_0/ ]] ; then - echo -e "${c_error}ERROR: build sources directory '${path_sources}level_0/' is invalid or missing.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: build sources directory '${path_sources}level_0/' is invalid or missing.$c_reset" + fi + package_cleanup return 1 fi if [[ ! -d ${path_sources}level_1/ ]] ; then - echo -e "${c_error}ERROR: build sources directory '${path_sources}level_1/' is invalid or missing.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: build sources directory '${path_sources}level_1/' is invalid or missing.$c_reset" + fi + package_cleanup return 1 fi if [[ ! -d ${path_sources}level_2/ ]] ; then - echo -e "${c_error}ERROR: build sources directory '${path_sources}level_2/' is invalid or missing.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: build sources directory '${path_sources}level_2/' is invalid or missing.$c_reset" + fi + package_cleanup return 1 fi if [[ ! -d ${path_sources}level_3/ ]] ; then - echo -e "${c_error}ERROR: build sources directory '${path_sources}level_3/' is invalid or missing.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: build sources directory '${path_sources}level_3/' is invalid or missing.$c_reset" + fi + package_cleanup return 1 fi @@ -172,7 +203,10 @@ package_main() { fi elif [[ $operation == "dependencies" ]] ; then if [[ ! -d $path_sources ]] ; then - echo -e "${c_error}ERROR: sources directory '$path_sources' is invalid or missing.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: sources directory '$path_sources' is invalid or missing.$c_reset" + fi + package_cleanup return 1 fi @@ -180,18 +214,27 @@ package_main() { package_operation_dependencies elif [[ $operation == "clean" ]] ; then if [[ ! -d $path_destination ]] ; then - echo -e "${c_warning}WARNING: package directory '$path_destination' does not exist, there is nothing to clean.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_warning}WARNING: package directory '$path_destination' does not exist, there is nothing to clean.$c_reset" + fi + package_cleanup return 0 fi package_operation_clean elif [[ $operation == "" ]] ; then - echo -e "${c_error}ERROR: no operation was given.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: no operation was given.$c_reset" + fi + package_cleanup return 1 else - echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the operation $c_notice$operation$c_error was not recognized.$c_reset" + fi + package_cleanup return 1 fi @@ -235,6 +278,8 @@ package_help() { echo -e " -${c_important}h$c_reset, --${c_important}help$c_reset Print this help screen." echo -e " +${c_important}l$c_reset, ++${c_important}light$c_reset Use color modes that show up better on light backgrounds." echo -e " +${c_important}n$c_reset, ++${c_important}no_color$c_reset Do not use color." + echo -e " +${c_important}q$c_reset, ++${c_important}quiet$c_reset Decrease verbosity beyond normal output." + echo -e " +${c_important}V$c_reset, ++${c_important}verbose$c_reset Increase verbosity beyond normal output." echo -e " +${c_important}v$c_reset, ++${c_important}version$c_reset Print the version number of this program." echo echo -e "${c_highlight}Package Options:$c_reset" @@ -251,54 +296,75 @@ package_help() { package_create_base_files() { if [[ ! -d $package ]] ; then - mkdir -vp $package + mkdir $verbose -p $package if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice$package$c_error.$c_reset" + fi + failure=1 fi fi if [[ $failure == "" && ! -d ${path_build}documents ]] ; then - echo -e "${c_error}ERROR: the build directory $c_notice${path_build}documents$c_error cannot be found or is invalid.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: the build directory $c_notice${path_build}documents$c_error cannot be found or is invalid.$c_reset" + fi + failure=1 fi if [[ $failure == "" ]] ; then - cp -vR ${path_build}documents $package + cp $verbose -R ${path_build}documents $package if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy directory $c_notice${path_build}documents$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy directory $c_notice${path_build}documents$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 fi fi if [[ $failure == "" ]] ; then if [[ -d ${path_build}licenses ]] ; then - cp -vR ${path_build}licenses $package + cp $verbose -R ${path_build}licenses $package if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy directory $c_notice${path_build}licenses$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy directory $c_notice${path_build}licenses$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 fi elif [[ -d ${path_build}../licenses ]] ; then - cp -vR ${path_build}../licenses $package + cp $verbose -R ${path_build}../licenses $package if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy directory $c_notice${path_build}../licenses$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy directory $c_notice${path_build}../licenses$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 fi else - echo -e "${c_error}ERROR: neither directory $c_notice${path_build}licenses$c_error nor $c_notice${path_build}../licenses$c_error can be found or are invalid.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: neither directory $c_notice${path_build}licenses$c_error nor $c_notice${path_build}../licenses$c_error can be found or are invalid.$c_reset" + fi + failure=1 fi fi if [[ $failure == "" ]] ; then - cp -vR ${path_build}scripts/bootstrap.sh $package + cp $verbose -R ${path_build}scripts/bootstrap.sh $package if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy script $c_notice${path_build}bootstrap.sh$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy script $c_notice${path_build}bootstrap.sh$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 fi @@ -306,16 +372,22 @@ package_create_base_files() { chmod ugo+x ${package}bootstrap.sh if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to set executable permissions on script $c_notice${package}bootstrap.sh$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to set executable permissions on script $c_notice${package}bootstrap.sh$c_error.$c_reset" + fi + failure=1 fi fi if [[ $failure == "" ]] ; then - cp -vR ${path_build}scripts/install.sh $package + cp $verbose -R ${path_build}scripts/install.sh $package if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy script $c_notice${path_build}install.sh$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy script $c_notice${path_build}install.sh$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 fi fi @@ -324,44 +396,59 @@ package_create_base_files() { chmod ugo+x ${package}install.sh if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to set executable permissions on script $c_notice${package}install.sh$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to set executable permissions on script $c_notice${package}install.sh$c_error.$c_reset" + fi + failure=1 fi fi fi if [[ $failure != "" && ! -d ${package}build ]] ; then - mkdir -vp ${package}build + mkdir $verbose -p ${package}build if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${package}build$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${package}build$c_error.$c_reset" + fi + failure=1 fi fi if [[ $failure != "" && ! -d ${package}sources ]] ; then - mkdir -vp ${package}sources + mkdir $verbose -p ${package}sources if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset" + fi + failure=1 fi fi if [[ $failure != "" && ! -d ${package}documents ]] ; then - mkdir -vp ${package}documents + mkdir $verbose -p ${package}documents if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${package}documents$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${package}documents$c_error.$c_reset" + fi + failure=1 fi fi if [[ $failure != "" && ! -d ${package}licenses ]] ; then - mkdir -vp ${package}licenses + mkdir $verbose -p ${package}licenses if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${package}licenses$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${package}licenses$c_error.$c_reset" + fi + failure=1 fi fi @@ -393,16 +480,24 @@ package_dependencies_individual() { level_current="$(echo $directory | grep -o '\.*\$|build_libraries-individual$individual_dependencies|" $settings if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to update settings file $c_notice${settings}$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to update settings file $c_notice${settings}$c_error.$c_reset" + fi + failure=1 return fi @@ -514,7 +630,10 @@ package_dependencies_individual() { sed -i -e "s|^\s*build_libraries-level\>.*\$|build_libraries-level -lfll_2 -lfll_1 -lfll_0|" $settings if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to update settings file $c_notice${settings}$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to update settings file $c_notice${settings}$c_error.$c_reset" + fi + failure=1 return fi @@ -522,7 +641,10 @@ package_dependencies_individual() { sed -i -e "s|^\s*build_libraries-monolithic\>.*\$|build_libraries-monolithic -lfll|" $settings if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to update settings file $c_notice${settings}$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to update settings file $c_notice${settings}$c_error.$c_reset" + fi + failure=1 return fi @@ -538,7 +660,10 @@ package_dependencies_individual_append() { settings=${path_sources}${level}/${dependency}/data/build/settings if [[ ! -f $settings ]] ; then - echo -e "${c_error}ERROR: failed to find dependency settings file $c_notice$settings$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to find dependency settings file $c_notice$settings$c_error.$c_reset" + fi + failure=1 return fi @@ -583,15 +708,20 @@ package_dependencies_level_update() { local monolithic_libraries= local monolithic_headers= - echo - echo -e "${c_highlight}Building Dependencies: $c_notice$level${c_highlight}.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Building Dependencies: $c_notice$level${c_highlight}.$c_reset" + fi for directory in $path_sources${level}/* ; do name="$(echo $directory | sed -e "s|$path_sources${level}/||")" settings=${directory}/data/build/settings if [[ ! -f $settings ]] ; then - echo -e "${c_error}ERROR: failed to find settings file $c_notice$settings$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to find settings file $c_notice$settings$c_error.$c_reset" + fi + failure=1 return fi @@ -612,7 +742,10 @@ package_dependencies_level_update() { settings=${path_sources}/build/${level}/settings if [[ ! -f $settings ]] ; then - echo -e "${c_error}ERROR: failed to find settings file $c_notice$settings$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to find settings file $c_notice$settings$c_error.$c_reset" + fi + failure=1 return fi @@ -620,7 +753,10 @@ package_dependencies_level_update() { sed -i -e "s|^\s*build_libraries-level\>.*\$|build_libraries-level$level_libraries|" $settings if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset" + fi + failure=1 return fi @@ -634,7 +770,10 @@ package_dependencies_level_update() { sed -i -e "s|^\s*build_sources_library\>.*\$|build_sources_library$level_sources_library|" $settings if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset" + fi + failure=1 return fi @@ -648,7 +787,10 @@ package_dependencies_level_update() { sed -i -e "s|^\s*build_sources_headers\>.*\$|build_sources_headers$level_sources_headers|" $settings if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to update headers for settings file $c_notice$settings$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to update headers for settings file $c_notice$settings$c_error.$c_reset" + fi + failure=1 return fi @@ -669,8 +811,10 @@ package_dependencies_monolithic() { local monolithic_libraries="" local monolithic_headers="" - echo - echo -e "${c_highlight}Building Dependencies: ${c_notice}monolithic${c_highlight}.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Building Dependencies: ${c_notice}monolithic${c_highlight}.$c_reset" + fi if [[ $level_0_libraries != "" ]] ; then monolithic_libraries="$level_0_libraries" @@ -715,28 +859,40 @@ package_dependencies_monolithic() { settings=${path_sources}/build/monolithic/settings if [[ $monolithic_libraries != "" ]] ; then - echo " $monolithic_libraries" + if [[ $verbosity != "quiet" ]] ; then + echo " $monolithic_libraries" + fi + monolithic_libraries=" $monolithic_libraries" fi sed -i -e "s|^\s*build_sources_library\>.*\$|build_sources_library$monolithic_libraries|" $settings if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to update libraries for settings file $c_notice$settings$c_error.$c_reset" + fi + failure=1 return fi if [[ $monolithic_headers != "" ]] ; then - echo " $monolithic_headers" + if [[ $verbosity != "quiet" ]] ; then + echo " $monolithic_headers" + fi + monolithic_headers=" $monolithic_headers" fi sed -i -e "s|^\s*build_sources_headers\>.*\$|build_sources_headers$monolithic_headers|" $settings if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to update headers for settings file $c_notice$settings$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to update headers for settings file $c_notice$settings$c_error.$c_reset" + fi + failure=1 return fi @@ -747,79 +903,103 @@ package_operation_clean() { for i in ${path_destination}{individual,level,monolithic,program} ; do if [[ -d $i ]] ; then - rm -vRf $i + rm $verbose -Rf $i fi done } package_operation_copy_package() { if [[ -d ${package}sources/data/ ]] ; then - cp -vR ${package}sources/data ${package} + cp $verbose -R ${package}sources/data ${package} if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy the data directory $c_notice${package}sources/data$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy the data directory $c_notice${package}sources/data$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 break fi - rm -vRf ${package}sources/data + rm $verbose -Rf ${package}sources/data if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data$c_error.$c_reset" + fi + failure=1 break fi fi if [[ -d ${package}sources/documents/ ]] ; then - cp -vR ${package}sources/documents/ ${package} + cp $verbose -R ${package}sources/documents/ ${package} if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to move sources documents directory $c_notice${path_sources}sources/documents$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to move sources documents directory $c_notice${path_sources}sources/documents$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 break fi - rm -vRf ${package}sources/documents/ + rm $verbose -Rf ${package}sources/documents/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to remove sources documents directory $c_notice${path_sources}sources/documents$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to remove sources documents directory $c_notice${path_sources}sources/documents$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 break fi fi if [[ -d ${package}sources/licenses/ ]] ; then - cp -vR ${package}sources/licenses/ ${package} + cp $verbose -R ${package}sources/licenses/ ${package} if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to move sources licenses directory $c_notice${path_sources}sources/licenses$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to move sources licenses directory $c_notice${path_sources}sources/licenses$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 break fi - rm -vRf ${package}sources/licenses/ + rm $verbose -Rf ${package}sources/licenses/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to remove sources licenses directory $c_notice${path_sources}sources/licenses$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to remove sources licenses directory $c_notice${path_sources}sources/licenses$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 break fi fi if [[ -d ${package}sources/specifications/ ]] ; then - cp -vR ${package}sources/specifications/ ${package} + cp $verbose -R ${package}sources/specifications/ ${package} if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to move sources specifications directory $c_notice${path_sources}sources/specifications$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to move sources specifications directory $c_notice${path_sources}sources/specifications$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 break fi - rm -vRf ${package}sources/specifications/ + rm $verbose -Rf ${package}sources/specifications/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to remove sources specifications directory $c_notice${path_sources}sources/specifications$c_error to $c_notice$package$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to remove sources specifications directory $c_notice${path_sources}sources/specifications$c_error to $c_notice$package$c_error.$c_reset" + fi + failure=1 break fi @@ -857,10 +1037,13 @@ package_operation_individual() { local package= if [[ ! -d ${path_destination}individual ]] ; then - mkdir -vp ${path_destination}individual + mkdir $verbose -p ${path_destination}individual if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${path_destination}individual$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${path_destination}individual$c_error.$c_reset" + fi + package_cleanup exit $failure fi @@ -870,15 +1053,20 @@ package_operation_individual() { name="$(echo $directory | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||")" package="${path_destination}individual/${name}-${version}/" - echo - echo -e "${c_highlight}Processing Package$c_reset (individual) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Processing Package$c_reset (individual) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset" + fi package_create_base_files - cp -vR $directory ${package}sources/ + cp $verbose -R $directory ${package}sources/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + fi + failure=1 break fi @@ -903,11 +1091,16 @@ package_operation_level() { name="fll-$level" package="${path_destination}level/${name}-${version}/" - echo - echo -e "${c_highlight}Processing Package$c_reset (level) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Processing Package$c_reset (level) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset" + fi if [[ ! -d $path_build$level ]] ; then - echo -e "${c_error}ERROR: build settings directory $c_notice$path_build$level$c_error is invalid or missing.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: build settings directory $c_notice$path_build$level$c_error is invalid or missing.$c_reset" + fi + failure=1 break fi @@ -915,50 +1108,65 @@ package_operation_level() { package_create_base_files if [[ ! -d ${package}data/ ]] ; then - mkdir -v ${package}data/ + mkdir $verbose ${package}data/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${package}data$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${package}data$c_error.$c_reset" + fi + failure=1 break fi fi if [[ -d $path_build${level}/build ]] ; then - cp -vR $path_build${level}/build ${package}data/ + cp $verbose -R $path_build${level}/build ${package}data/ else - cp -vR $path_build$level ${package}data/build + cp $verbose -R $path_build$level ${package}data/build fi if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset" + fi + failure=1 break fi if [[ ! -d ${package}sources/ ]] ; then - mkdir -v ${package}sources/ + mkdir $verbose ${package}sources/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset" + fi + failure=1 break fi fi for directory in $path_sources${level}/* ; do - cp -vR $directory/* ${package}sources/ + cp $verbose -R $directory/* ${package}sources/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy files from sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy files from sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + fi + failure=1 break fi - rm -vRf ${package}sources/data/build/ + rm $verbose -Rf ${package}sources/data/build/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset" + fi + failure=1 break fi @@ -989,11 +1197,16 @@ package_operation_monolithic() { name="fll" package="${path_destination}monolithic/${name}-${version}/" - echo - echo -e "${c_highlight}Processing Package$c_reset (monolithic) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Processing Package$c_reset (monolithic) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset" + fi if [[ ! -d ${path_build}monolithic ]] ; then - echo -e "${c_error}ERROR: build settings directory $c_notice${path_build}monolithic$c_error is invalid or missing.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: build settings directory $c_notice${path_build}monolithic$c_error is invalid or missing.$c_reset" + fi + package_cleanup return 1 fi @@ -1001,32 +1214,41 @@ package_operation_monolithic() { package_create_base_files if [[ ! -d ${package}data/ ]] ; then - mkdir -v ${package}data/ + mkdir $verbose ${package}data/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${package}data$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${package}data$c_error.$c_reset" + fi + package_cleanup return 1 fi fi if [[ -d ${path_build}monolithic/build ]] ; then - cp -vR ${path_build}monolithic/build ${package}data + cp $verbose -R ${path_build}monolithic/build ${package}data else - cp -vR ${path_build}monolithic ${package}data/build + cp $verbose -R ${path_build}monolithic ${package}data/build fi if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to move the directory $c_notice$path_build$level$c_error as $c_notice$path_build${level}build$c_error.$c_reset" + fi + package_cleanup return 1 fi if [[ ! -d ${package}sources/ ]] ; then - mkdir -v ${package}sources/ + mkdir $verbose ${package}sources/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${package}sources$c_error.$c_reset" + fi + package_cleanup return 1 fi @@ -1039,87 +1261,117 @@ package_operation_monolithic() { if [[ $pathname == "data" ]] ; then if [[ ! -d ${package}data/$level ]] ; then - mkdir -vp ${package}data/$level + mkdir $verbose -p ${package}data/$level if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create package data directory $c_notice${package}data/$level$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create package data directory $c_notice${package}data/$level$c_error.$c_reset" + fi + failure=1 break fi fi - cp -vR $subdirectory ${package}sources/data + cp $verbose -R $subdirectory ${package}sources/data if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/data$level$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/data$level$c_error.$c_reset" + fi + failure=1 break fi - rm -vRf ${package}sources/data/build/ + rm $verbose -Rf ${package}sources/data/build/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data/build$c_error.$c_reset" + fi + failure=1 break fi if [[ "$(ls ${package}sources/data)" != "" ]] ; then - cp -vR ${package}sources/data/* ${package}data/$level + cp $verbose -R ${package}sources/data/* ${package}data/$level if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy the data directory $c_notice${package}sources/data/$level/data$c_error to $c_notice${package}data/$level$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy the data directory $c_notice${package}sources/data/$level/data$c_error to $c_notice${package}data/$level$c_error.$c_reset" + fi + failure=1 break fi fi - rm -vRf ${package}sources/data + rm $verbose -Rf ${package}sources/data if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to remove directory $c_notice${package}sources/data$c_error.$c_reset" + fi + failure=1 break fi elif [[ $pathname == "documents" ]] ; then - cp -vR $subdirectory ${package}sources/ + cp $verbose -R $subdirectory ${package}sources/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/documents$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/documents$c_error.$c_reset" + fi + failure=1 break fi elif [[ $pathname == "licenses" ]] ; then - cp -vR $subdirectory ${package}sources/ + cp $verbose -R $subdirectory ${package}sources/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/licenses$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/licenses$c_error.$c_reset" + fi + failure=1 break fi elif [[ $pathname == "specifications" ]] ; then - cp -vR $subdirectory ${package}sources/ + cp $verbose -R $subdirectory ${package}sources/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/specifications$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy files from data directory $c_notice$subdirectory$c_error to $c_notice${package}sources/specifications$c_error.$c_reset" + fi + failure=1 break fi else if [[ ! -d ${package}sources/$pathname/$level ]] ; then - mkdir -vp ${package}sources/$pathname/$level + mkdir $verbose -p ${package}sources/$pathname/$level if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create package sources directory $c_notice${package}sources/$pathname/$level$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create package sources directory $c_notice${package}sources/$pathname/$level$c_error.$c_reset" + fi + failure=1 break fi fi - cp -vR $subdirectory/* ${package}sources/$pathname/$level + cp $verbose -R $subdirectory/* ${package}sources/$pathname/$level if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy files from sources directory $c_notice$subdirectory$c_error to $c_notice${package}sources/$pathname/$level$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy files from sources directory $c_notice$subdirectory$c_error to $c_notice${package}sources/$pathname/$level$c_error.$c_reset" + fi + failure=1 break fi @@ -1149,10 +1401,13 @@ package_operation_program() { local package= if [[ ! -d ${path_destination}program ]] ; then - mkdir -vp ${path_destination}program + mkdir $verbose -p ${path_destination}program if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to create directory $c_notice${path_destination}program$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to create directory $c_notice${path_destination}program$c_error.$c_reset" + fi + package_cleanup exit $failure fi @@ -1162,15 +1417,20 @@ package_operation_program() { name="$(echo $directory | sed -e "s|${path_sources}level_3/||")" package="${path_destination}program/${name}-${version}/" - echo - echo -e "${c_highlight}Processing Package$c_reset (program) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo + echo -e "${c_highlight}Processing Package$c_reset (program) $c_notice${name}-${version}$c_reset${c_highlight}.$c_reset" + fi package_create_base_files - cp -vR $directory ${package}sources/ + cp $verbose -R $directory ${package}sources/ if [[ $? -ne 0 ]] ; then - echo -e "${c_error}ERROR: failed to copy sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + if [[ $verbosity != "quiet" ]] ; then + echo -e "${c_error}ERROR: failed to copy sources directory $c_notice$directory$c_error to $c_notice${package}sources$c_error.$c_reset" + fi + failure=1 break fi