|
@@ -1,18 +1,18 @@
|
1
|
1
|
#!/usr/bin/env bash
|
2
|
2
|
# generate_version_header_for_marlin
|
3
|
3
|
|
4
|
|
-DIR=$1 export DIR
|
5
|
|
-OUTFILE=$2 export OUTFILE
|
6
|
|
-echo "/* This file is automatically generated by an Arduino hook" >$OUTFILE
|
7
|
|
-echo " * Do not manually edit it" >>$OUTFILE
|
8
|
|
-echo " * It does not get committed to the repository" >>$OUTFILE
|
9
|
|
-echo " */" >>$OUTFILE
|
10
|
|
-echo "" >>$OUTFILE
|
|
4
|
+DIR="$1" export DIR
|
|
5
|
+OUTFILE="$2" export OUTFILE
|
|
6
|
+echo "/* This file is automatically generated by an Arduino hook" >"$OUTFILE"
|
|
7
|
+echo " * Do not manually edit it" >>"$OUTFILE"
|
|
8
|
+echo " * It does not get committed to the repository" >>"$OUTFILE"
|
|
9
|
+echo " */" >>"$OUTFILE"
|
|
10
|
+echo "" >>"$OUTFILE"
|
11
|
11
|
|
12
|
|
-echo "#define BUILD_UNIX_DATETIME" `date +%s` >>$OUTFILE
|
13
|
|
-echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>$OUTFILE
|
|
12
|
+echo "#define BUILD_UNIX_DATETIME" `date +%s` >>"$OUTFILE"
|
|
13
|
+echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>"$OUTFILE"
|
14
|
14
|
( set +e
|
15
|
|
- cd $DIR
|
|
15
|
+ cd "$DIR"
|
16
|
16
|
BRANCH=`git symbolic-ref --short HEAD`
|
17
|
17
|
if [ "x$BRANCH" == "xHEAD" ] ; then
|
18
|
18
|
BRANCH=""
|
|
@@ -23,13 +23,13 @@ echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>$OUTFILE
|
23
|
23
|
fi
|
24
|
24
|
VERSION=`git describe --tags --first-parent 2>/dev/null`
|
25
|
25
|
if [ "x$VERSION" != "x" ] ; then
|
26
|
|
- echo "#define BUILD_VERSION \"$VERSION\"" | sed "s/-/$BRANCH-/" >>$OUTFILE
|
|
26
|
+ echo "#define BUILD_VERSION \"$VERSION\"" | sed "s/-/$BRANCH-/" >>"$OUTFILE"
|
27
|
27
|
fi
|
28
|
28
|
URL=`git config --local --get remote.origin.url | sed "sx.*github.com:xhttps://github.com/x" | sed "sx\.gitx/x"`
|
29
|
29
|
if [ "x$URL" != "x" ] ; then
|
30
|
|
- echo "#define SOURCE_CODE_URL \""$URL"\"" >>$OUTFILE
|
31
|
|
- echo "// Deprecated URL definition" >>$OUTFILE
|
32
|
|
- echo "#define FIRMWARE_URL \""$URL"\"" >>$OUTFILE
|
|
30
|
+ echo "#define SOURCE_CODE_URL \""$URL"\"" >>"$OUTFILE"
|
|
31
|
+ echo "// Deprecated URL definition" >>"$OUTFILE"
|
|
32
|
+ echo "#define FIRMWARE_URL \""$URL"\"" >>"$OUTFILE"
|
33
|
33
|
fi
|
34
|
34
|
|
35
|
35
|
)
|