Allow cli options to override

This commit is contained in:
2023-01-11 14:31:21 -05:00
parent b9848a177a
commit 242cdb02b8

View File

@@ -7,7 +7,7 @@
# Apache 2.0 License # Apache 2.0 License
# Set default release # Set default release
: "${RELEASE:="22.03.2"}" : "${RELEASE:="22.03.3"}"
printHelp() { printHelp() {
debug "${FUNCNAME[0]}" debug "${FUNCNAME[0]}"
@@ -51,7 +51,7 @@ readInput() {
while true; do while true; do
case "$1" in case "$1" in
--release|-r|--version|-v) --release|-r|--version|-v)
shift && RELEASE="$1" shift && declare -g USER_RELEASE="$1"
;; ;;
--profile|-p) --profile|-p)
shift && PROFILES+=("$1") shift && PROFILES+=("$1")
@@ -615,7 +615,7 @@ main() {
: "${BUILDDIR:=$SCRIPTDIR}" : "${BUILDDIR:=$SCRIPTDIR}"
: "${FILESDIR:=$BUILDDIR/files}" : "${FILESDIR:=$BUILDDIR/files}"
: "${P_ARR[release]:=$RELEASE}" # profiles overrides user input and hardcoded versions : "${USER_RELEASE:=P_ARR[release]:=$RELEASE}" # precedence: user input>profiles>env>hardcode
: "${P_ARR[source_archive]:=$BUILDDIR/sources/${P_ARR[profile]}-${P_ARR[release]}.tar.xz}" : "${P_ARR[source_archive]:=$BUILDDIR/sources/${P_ARR[profile]}-${P_ARR[release]}.tar.xz}"
: "${P_ARR[source_dir]:=${P_ARR[source_archive]%.tar.xz}}" : "${P_ARR[source_dir]:=${P_ARR[source_archive]%.tar.xz}}"
: "${P_ARR[out_bin_dir]:=$BUILDDIR/bin/${P_ARR[profile]}-${P_ARR[release]}}" : "${P_ARR[out_bin_dir]:=$BUILDDIR/bin/${P_ARR[profile]}-${P_ARR[release]}}"