From 6f5dcb9df697a62258de92b96cbeed72e88838b6 Mon Sep 17 00:00:00 2001 From: quebim Date: Tue, 29 Oct 2024 15:53:23 -0300 Subject: [PATCH] Fix typo and error on getopts --- build-scripts/baptizer.sh | 153 ++++++++++++++++++-------------------- 1 file changed, 74 insertions(+), 79 deletions(-) diff --git a/build-scripts/baptizer.sh b/build-scripts/baptizer.sh index 5a9effc11dae2..e589f6ba97a49 100644 --- a/build-scripts/baptizer.sh +++ b/build-scripts/baptizer.sh @@ -1,5 +1,4 @@ #!/bin/bash - set -e function usage() { @@ -21,49 +20,47 @@ function usage() { # Parse arguments # ==== function parse_args() { - - while getopts ":h:p:a:d:r:m:x:ph:rh" arg; do + while getopts ":h:p:a:d:r:m:x:ph:rh:" arg; do case $arg in - h) - usage - exit 1 - ;; - p) - PLATFORM=$OPTARG - ;; - a) - ARCHITECTURE=$OPTARG - ;; - d) - DISTRIBUTION=$OPTARG - ;; - r) - REVISION=$OPTARG - ;; - m) - IS_MIN=true - ;; - x) - IS_RELEASE=true - ;; - ph) - PLUGINS_HASH=$OPTARF - ;; - rh) - REPORTING_HASH=$OPTARF - ;; - :) - echo "Error: -${OPTARG} requires an argument" - usage - exit 1 - ;; - ?) - echo "Invalid option: -${arg}" - exit 1 - ;; + h) + usage + exit 1 + ;; + p) + PLATFORM=$OPTARG + ;; + a) + ARCHITECTURE=$OPTARG + ;; + d) + DISTRIBUTION=$OPTARG + ;; + r) + REVISION=$OPTARG + ;; + m) + IS_MIN=true + ;; + x) + IS_RELEASE=true + ;; + ph) + PLUGINS_HASH=$OPTARG + ;; + rh) + REPORTING_HASH=$OPTARG + ;; + :) + echo "Error: -${OPTARG} requires an argument" + usage + exit 1 + ;; + ?) + echo "Invalid option: -${arg}" + exit 1 + ;; esac done - [ -z "$PLATFORM" ] && PLATFORM=$(uname -s | awk '{print tolower($0)}') [ -z "$ARCHITECTURE" ] && ARCHITECTURE=$(uname -m) [ -z "$DISTRIBUTION" ] && DISTRIBUTION="tar" @@ -72,44 +69,43 @@ function parse_args() { [ -z "$IS_RELEASE" ] && IS_RELEASE=false case $PLATFORM-$DISTRIBUTION-$ARCHITECTURE in - linux-tar-x64 | darwin-tar-x64) - EXT="tar.gz" - SUFFIX="$PLATFORM-x64" - ;; - linux-tar-arm64 | darwin-tar-arm64) - EXT="tar.gz" - SUFFIX="$PLATFORM-arm64" - ;; - linux-deb-x64) - EXT="deb" - SUFFIX="amd64" - ;; - linux-deb-arm64) - EXT="deb" - SUFFIX="arm64" - ;; - linux-rpm-x64) - EXT="rpm" - SUFFIX="x86_64" - ;; - linux-rpm-arm64) - EXT="rpm" - SUFFIX="aarch64" - ;; - windows-zip-x64) - EXT="zip" - SUFFIX="$PLATFORM-x64" - ;; - windows-zip-arm64) - EXT="zip" - SUFFIX="$PLATFORM-arm64" - ;; - *) - echo "Unsupported platform-distribution-architecture combination: $PLATFORM-$DISTRIBUTION-$ARCHITECTURE" - exit 1 - ;; + linux-tar-x64 | darwin-tar-x64) + EXT="tar.gz" + SUFFIX="$PLATFORM-x64" + ;; + linux-tar-arm64 | darwin-tar-arm64) + EXT="tar.gz" + SUFFIX="$PLATFORM-arm64" + ;; + linux-deb-x64) + EXT="deb" + SUFFIX="amd64" + ;; + linux-deb-arm64) + EXT="deb" + SUFFIX="arm64" + ;; + linux-rpm-x64) + EXT="rpm" + SUFFIX="x86_64" + ;; + linux-rpm-arm64) + EXT="rpm" + SUFFIX="aarch64" + ;; + windows-zip-x64) + EXT="zip" + SUFFIX="$PLATFORM-x64" + ;; + windows-zip-arm64) + EXT="zip" + SUFFIX="$PLATFORM-arm64" + ;; + *) + echo "Unsupported platform-distribution-architecture combination: $PLATFORM-$DISTRIBUTION-$ARCHITECTURE" + exit 1 + ;; esac - } # ==== @@ -159,7 +155,6 @@ function get_package_name() { # ==== function main() { parse_args "${@}" - get_package_name echo "$PACKAGE_NAME" }