From 1f844d0e3551b4f36455d6f20879b3f5e4911908 Mon Sep 17 00:00:00 2001 From: leafee98 Date: Sat, 21 Jan 2023 11:17:08 -0500 Subject: [PATCH] Add: feature to build a specific tag --- dendrite/deb.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/dendrite/deb.sh b/dendrite/deb.sh index f588ddd..e702d14 100644 --- a/dendrite/deb.sh +++ b/dendrite/deb.sh @@ -10,6 +10,7 @@ PACK_DIR="${SCRIPT_PATH}/package" BUILD_DIR="$REPO_DIR/bin" ROOTFS="${SCRIPT_PATH}/rootfs" +TARGET_TAG="" ACTION="initialze" @@ -24,17 +25,22 @@ function usage() { echo "$0 usage:" echo " -b the build release number" + echo " -t specify the tag to build, instead of the latest one" } BUILD_REL="" -while getopts ":b" arg +while getopts ":b:t:" arg do case "$arg" in b) BUILD_REL="$OPTARG" ;; + t) + TARGET_TAG="$OPTARG" + ;; *) usage + exit 1 ;; esac done @@ -51,9 +57,18 @@ function download() git -C "$REPO_DIR" fetch --all fi - LATEST_TAG=$(git -C "$REPO_DIR" tag --sort=-version:refname --list 'v*' | head -n 1) - echo "switching to tag: $LATEST_TAG" - git -C "$REPO_DIR" switch --detach "$LATEST_TAG" +} + +function switch_tag() +{ + ACTION="switch tag" + if [ -z "$TARGET_TAG" ] + then + TARGET_TAG=$(git -C "$REPO_DIR" tag --sort=-version:refname --list 'v*' | head -n 1) + fi + + echo "switching to tag: $TARGET_TAG" + git -C "$REPO_DIR" switch --detach "$TARGET_TAG" } function build() @@ -100,6 +115,7 @@ EOF download +switch_tag build package