Commit e71accd 1 parent 6f2d31d commit e71accd Copy full SHA for e71accd
File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
- # Needs root
2
+
3
3
if [ $# -gt 0 ]; then
4
4
FILE=" $1 "
5
5
shift
6
6
if [ -f " $FILE " ]; then
7
7
INFO=" $( head -n 1 " $FILE " ) "
8
+ else
9
+ INFO=" "
8
10
fi
9
11
else
10
12
echo " Usage: $0 <filename>"
13
15
14
16
if [ -e " $( which git) " ]; then
15
17
# clean 'dirty' status of touched files that haven't been modified
16
- git diff > /dev/null 2> /dev/null
18
+ git diff > /dev/null 2> /dev/null
17
19
18
20
# get a string like "v0.6.0-66-g59887e8-dirty"
19
21
DESC=" $( git describe --dirty 2> /dev/null) "
20
22
21
23
# get a string like "2012-04-10 16:27:19 +0200"
22
24
TIME=" $( git log -n 1 --format=" %ci" ) "
25
+ else
26
+ DESC=" "
27
+ TIME=" "
23
28
fi
24
29
25
30
if [ -n " $DESC " ]; then
31
36
# only update build.h if necessary
32
37
if [ " $INFO " != " $NEWINFO " ]; then
33
38
echo " $NEWINFO " > " $FILE "
34
- echo " #define BUILD_DATE \" $TIME \" " >> " $FILE "
39
+ if [ -n " $TIME " ]; then
40
+ echo " #define BUILD_DATE \" $TIME \" " >> " $FILE "
41
+ fi
35
42
fi
You can’t perform that action at this time.
0 commit comments