@@ -16,36 +16,40 @@ if [ -x ./_detect-amend.sh ]; then
16
16
. ./_detect-amend.sh
17
17
fi
18
18
19
- VER =` git log --oneline | wc -l `
19
+ BUILD =` git rev-list HEAD --count `
20
20
# adjust so that we match the github commit count
21
- TAGVER= ` expr $VER + 1 `
21
+ (( BUILD ++ ))
22
22
# there may be a better way to prevent improper nano on amend. For now the detection
23
23
# of a .amend file in the current directory will do
24
24
if [ -f ./.amend ]; then
25
- TAGVER= ` expr $TAGVER - 1 `
25
+ (( BUILD -- ))
26
26
rm ./.amend;
27
27
fi
28
- echo " setting nano to $TAGVER "
28
+ echo " setting nano to $BUILD "
29
29
30
- cat > cmd.sed << \_EOF
31
- s/^[ \t]*FILEVERSION[ \t]*\(.*\),\(.*\),.*,0/ FILEVERSION \1,\2,@@TAGVER@@,0/
32
- s/^[ \t]*PRODUCTVERSION[ \t]*\(.*\),\(.*\),.*,0/ PRODUCTVERSION \1,\2,@@TAGVER@@,0/
33
- s/^\([ \t]*\)VALUE[ \t]*"FileVersion",[ \t]*"\(.*\)\..*"/\1VALUE "FileVersion", "\2.@@TAGVER@@"/
34
- s/^\([ \t]*\)VALUE[ \t]*"ProductVersion",[ \t]*"\(.*\)\..*"/\1VALUE "ProductVersion", "\2.@@TAGVER@@"/
35
- s/^\(.*\)"Zadig \(.*\)\..*"\(.*\)/\1"Zadig \2.@@TAGVER@@"\3/
30
+ cat > _library.sed << \_EOF
31
+ s/^[ \t]*FILEVERSION[ \t]*\(.*\),\(.*\),\(.*\),.*/ FILEVERSION \1,\2,\3,@@BUILD@@/
32
+ s/^[ \t]*PRODUCTVERSION[ \t]*\(.*\),\(.*\),\(.*\),.*/ PRODUCTVERSION \1,\2,\3,@@BUILD@@/
33
+ s/^\([ \t]*\)VALUE[ \t]*"FileVersion",[ \t]*"\(.*\)\..*"/\1VALUE "FileVersion", "\2.@@BUILD@@"/
34
+ s/^\([ \t]*\)VALUE[ \t]*"ProductVersion",[ \t]*"\(.*\)\..*"/\1VALUE "ProductVersion", "\2.@@BUILD@@"/
35
+ _EOF
36
+
37
+ cat > _zadig.sed << \_EOF
38
+ s/^[ \t]*FILEVERSION[ \t]*\(.*\),\(.*\),.*,0/ FILEVERSION \1,\2,@@BUILD@@,0/
39
+ s/^[ \t]*PRODUCTVERSION[ \t]*\(.*\),\(.*\),.*,0/ PRODUCTVERSION \1,\2,@@BUILD@@,0/
40
+ s/^\([ \t]*\)VALUE[ \t]*"FileVersion",[ \t]*"\(.*\)\..*"/\1VALUE "FileVersion", "\2.@@BUILD@@"/
41
+ s/^\([ \t]*\)VALUE[ \t]*"ProductVersion",[ \t]*"\(.*\)\..*"/\1VALUE "ProductVersion", "\2.@@BUILD@@"/
42
+ s/^\(.*\)"Zadig \(.*\)\..*"\(.*\)/\1"Zadig \2.@@BUILD@@"\3/
36
43
_EOF
37
44
38
45
# First run sed to substitute our variable in the sed command file
39
- sed -i -e " s/@@TAGVER@@/$TAGVER /g" cmd.sed
46
+ sed -i -e " s/@@BUILD@@/$BUILD /g" _library.sed
47
+ sed -i -e " s/@@BUILD@@/$BUILD /g" _zadig.sed
40
48
41
49
# Run sed to update the nano version, and add the modified files
42
- sed -i -f cmd.sed libwdi/libwdi.rc
43
- sed -i ' s/$/\r/' libwdi/libwdi.rc
44
- sed -i -f cmd.sed examples/zadig.rc
45
- sed -i ' s/$/\r/' examples/zadig.rc
46
- sed -i -f cmd.sed examples/zadig.h
47
- sed -i ' s/$/\r/' examples/zadig.h
48
- sed -i -f cmd.sed examples/wdi-simple.rc
49
- sed -i ' s/$/\r/' examples/wdi-simple.rc
50
+ sed -b -i -f _library.sed libwdi/libwdi.rc
51
+ sed -b -i -f _library.sed examples/wdi-simple.rc
52
+ sed -b -i -f _zadig.sed examples/zadig.rc
53
+ sed -b -i -f _zadig.sed examples/zadig.h
54
+ rm _library.sed _zadig.sed
50
55
git add libwdi/libwdi.rc examples/zadig.rc examples/zadig.h examples/wdi-simple.rc
51
- rm cmd.sed
0 commit comments