diff --git a/debian/_buildscripts/local/build_module.sh b/debian/_buildscripts/local/build_module.sh index b037b7d09..f999da0eb 100755 --- a/debian/_buildscripts/local/build_module.sh +++ b/debian/_buildscripts/local/build_module.sh @@ -275,7 +275,10 @@ if [ "$bool_COPY_MOD_SRC" = "y" ]; then echo "# TDE SCM module information" > "$MOD_BUILD_PATH/.tdescminfo" echo "Name: $MOD_NAME" >> "$MOD_BUILD_PATH/.tdescminfo" cd "$MOD_GIT_PATH" - MOD_BRANCH=`git rev-parse --abbrev-ref HEAD | grep -v "no branch" | head -n1` + MOD_BRANCH=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"` + if [[ -z "$MOD_BRANCH" ]]; then + MOD_BRANCH=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + fi COMMIT_HASH=`git rev-parse HEAD` echo "Revision: $MOD_BRANCH-$COMMIT_HASH" >> "$MOD_BUILD_PATH/.tdescminfo" git log -1 --pretty=format:"DateTime: %cd%n" --date=format:"%m/%d/%Y %H:%M" >> "$MOD_BUILD_PATH/.tdescminfo" @@ -310,7 +313,10 @@ if [ "$bool_EXTRADEP_MOD" != "y" -a "$bool_COPY_PKGING_FILES" = "y" ]; then # Default package name # Calculate package version cd $MOD_GIT_PATH - branch=`git rev-parse --abbrev-ref HEAD | egrep -v "no branch|detached" | head -n1` + branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"` + if [[ -z "$branch" ]]; then + branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + fi target_tag=`git tag | grep -F "$TDE_RELEASE" | head -n1` tag=`git tag | \ sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \