@@ -16,36 +16,40 @@ if [ -x ./_detect-amend.sh ]; then
1616 . ./_detect-amend.sh
1717fi
1818
19- VER =` git log --oneline | wc -l `
19+ BUILD =` git rev-list HEAD --count `
2020# adjust so that we match the github commit count
21- TAGVER= ` expr $VER + 1 `
21+ (( BUILD ++ ))
2222# there may be a better way to prevent improper nano on amend. For now the detection
2323# of a .amend file in the current directory will do
2424if [ -f ./.amend ]; then
25- TAGVER= ` expr $TAGVER - 1 `
25+ (( BUILD -- ))
2626 rm ./.amend;
2727fi
28- echo " setting nano to $TAGVER "
28+ echo " setting nano to $BUILD "
2929
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/
3643_EOF
3744
3845# 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
4048
4149# 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
5055git add libwdi/libwdi.rc examples/zadig.rc examples/zadig.h examples/wdi-simple.rc
51- rm cmd.sed
0 commit comments