aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPA4WDH2023-05-24 13:05:31 +0200
committerPA4WDH2023-05-24 13:05:31 +0200
commitf851f21131a1aab2d9a9449e47876132c2d948c4 (patch)
tree201fc5bbb896f1c1e10ab2b0fa6992493743e58f
parentAdd CSV logging (diff)
downloadcputemp2maxfreq-f851f21131a1aab2d9a9449e47876132c2d948c4.tar.gz
cputemp2maxfreq-f851f21131a1aab2d9a9449e47876132c2d948c4.tar.bz2
cputemp2maxfreq-f851f21131a1aab2d9a9449e47876132c2d948c4.zip
Update generate_version_h.sh0.2
-rwxr-xr-xgenerate_version_h.sh23
1 files changed, 19 insertions, 4 deletions
diff --git a/generate_version_h.sh b/generate_version_h.sh
index 4ea23c0..a9b39e4 100755
--- a/generate_version_h.sh
+++ b/generate_version_h.sh
@@ -1,8 +1,23 @@
-#!/bin/sh
+#!/bin/bash
-VERSION=`git describe --abbrev=0`
-HASH=`git show --format="%h" --no-patch master`
-BRANCH=`git rev-parse --abbrev-ref HEAD`
+if [ -d ".git" ]
+then
+# If we have a git directory use that as an information source
+ VERSION=`git describe --abbrev=0`
+ HASH=`git show --format="%h" --no-patch master`
+ BRANCH=`git rev-parse --abbrev-ref HEAD`
+elif [ "$#" = "3" ]
+then
+# If we have 3 commandline arguments use them
+ VERSION="$1"
+ HASH="$2"
+ BRANCH="$3"
+else
+# We don't know our version
+ VERSION="Unknown"
+ HASH="none"
+ BRANCH="Unknown"
+fi
echo "#ifndef HAVE_VERSION_H"
echo "#define HAVE_VERSION_H"