summaryrefslogtreecommitdiffstats
path: root/debian/_buildscripts/local/build_module.sh
diff options
context:
space:
mode:
Diffstat (limited to 'debian/_buildscripts/local/build_module.sh')
-rwxr-xr-xdebian/_buildscripts/local/build_module.sh71
1 files changed, 42 insertions, 29 deletions
diff --git a/debian/_buildscripts/local/build_module.sh b/debian/_buildscripts/local/build_module.sh
index 280d5fb22..a102c59de 100755
--- a/debian/_buildscripts/local/build_module.sh
+++ b/debian/_buildscripts/local/build_module.sh
@@ -28,12 +28,12 @@ function do_exit()
{
cd "$SCRIPT_DIR"
if [ $1 -eq 0 ]; then
- echo -e "${CGreen}#### Processing module ${CLightGreen}\"$MOD_GIVEN\"${CGreen} succeeded ####${CNone}"
+ echo -e "${CGreen}#### Processing module ${CLightGreen}\"$MOD_NAME\"${CGreen} succeeded ####${CNone}"
if [ "$bool_LOG_RESULT" = "y" ]; then
echo "[ OK ] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME"
fi
else
- echo -e "${CRed}#### Processing module ${CLightRed}\"$MOD_GIVEN\"${CRed} failed ($1) ####${CNone}"
+ echo -e "${CRed}#### Processing module ${CLightRed}\"$MOD_NAME\"${CRed} failed ($1) ####${CNone}"
if [ "$bool_LOG_RESULT" = "y" ]; then
echo "[FAILED] [$_BUILDMOD_TIME] \"$MOD_NAME\"" >>"$LOG_BUILD_RESULT_FILENAME"
fi
@@ -120,7 +120,7 @@ function search_module()
#----------------------------
# Check command line arguments and set options
#----------------------------
-MOD_GIVEN="" # the name of the specified module
+MOD_NAME="" # the name of the specified module
bool_BUILD_FROM_GIT="n"
bool_EXTRADEP_MOD="n"
bool_SHOW_BUILD_LOGS="n"
@@ -129,31 +129,47 @@ bool_LOG_RESULT="n"
bool_SHELL_HOOK="n"
bool_PREPARE_ONLY="n"
bool_DEBUG_MODE="n"
-bool_INTERNAL_PBUILDER="n"
-for arg in $@; do
- if [ "$arg" = "-g" ]; then # select code to build from Git repo (-g) or from local build copy
- bool_BUILD_FROM_GIT="y"
- elif [ "$arg" = "-l" ]; then # build module Locally instead of in a clean chroot environment
- bool_BUILD_LOCALLY="y"
- elif [ "$arg" = "-sl" ]; then # output the building logs to terminal (ShowLog)
- bool_SHOW_BUILD_LOGS="y"
- elif [ "$arg" = "-lr" ]; then # Log build Result to file
- bool_LOG_RESULT="y"
- elif [ "$arg" = "-sh" ]; then # install Shell Hook for failing builds (only valid if NOT building locally)
- bool_SHELL_HOOK="y"
- elif [ "$arg" = "-po" ]; then # Prepare build folder Only but do not build
- bool_PREPARE_ONLY="y"
- elif [ "$arg" = "-d" ]; then # build with Debug symbols (used in hook scripts)
- bool_DEBUG_MODE="y"
- elif [ "$arg" = "-ip" ]; then # build using Internal Pbuilder (experimental)
- bool_INTERNAL_PBUILDER="y"
- elif [ "$MOD_GIVEN" = "" ]; then # module to be built
- MOD_GIVEN="$arg"
- fi
+bool_INVALID_PARAMETERS="n"
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -d) # build with Debug symbols (used in hook scripts)
+ bool_DEBUG_MODE="y"
+ ;;
+ -g) # select code to build from Git repo (-g) or from local build copy
+ bool_BUILD_FROM_GIT="y"
+ ;;
+ -l) # build module Locally instead of in a clean chroot environment
+ bool_BUILD_LOCALLY="y"
+ ;;
+ -lr) # Log build Result to file
+ bool_LOG_RESULT="y"
+ ;;
+ -po) # Prepare build folder Only but do not build
+ bool_PREPARE_ONLY="y"
+ ;;
+ -sh) # install Shell Hook for failing builds (only valid if NOT building locally)
+ bool_SHELL_HOOK="y"
+ ;;
+ -sl) # output the building logs to terminal (ShowLog)
+ bool_SHOW_BUILD_LOGS="y"
+ ;;
+ *) # module to be built
+ if [ -z "$MOD_NAME" ]; then
+ MOD_NAME="$1"
+ else
+ bool_INVALID_PARAMETERS="y"
+ fi
+ esac
+
+ shift
done
-MOD_NAME=$MOD_GIVEN # the actal module to be built
+if [ "$bool_INVALID_PARAMETERS" != "n" ]; then
+ echo "Invalid arguments."
+ MOD_NAME="N/A"
+ do_exit 1
+fi
-echo -e "${CLightCyan}#### Processing module \"$MOD_GIVEN\" ####${CNone}"
+echo -e "${CLightCyan}#### Processing module \"$MOD_NAME\" ####${CNone}"
if [ "$MOD_NAME" = "" ]; then
echo "Please specify the module to build"
@@ -161,13 +177,10 @@ if [ "$MOD_NAME" = "" ]; then
fi
# Shell hook is only valid if not building locally
-# Internal pbuilder option has no meaning if we are building locally
if [ "bool_BUILD_LOCALLY" = "y" ]; then
bool_SHELL_HOOK="n"
- bool_INTERNAL_PBUILDER="n"
fi
export bool_SHELL_HOOK
-export bool_INTERNAL_PBUILDER
# Local option variables
# - sign packages