Skip to content

Commit 3252b48

Browse files
committed
Add initial script to sign Windows EXEs
Not yet functional, due to Git Bash weirdness.
1 parent c4ca76f commit 3252b48

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ dist: compile-all
1818
pack: dist
1919
@bin/pack.sh
2020

21-
app: pack
21+
sign: dist
22+
@bin/sign.sh
23+
24+
app: dist
2225
@bin/app.sh
2326

2427
test: app

bin/sign.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
cd "$(dirname "$0")/.."
4+
echo
5+
echo -e "\033[1;33m[sign]\033[0m"
6+
7+
appDir=app
8+
9+
if [ ! "$THUMBPRINT" ]; then
10+
echo "[ERROR] THUMBPRINT environment variable unset; cannot sign EXEs."
11+
exit 1
12+
fi
13+
14+
# Find the correct signtool.exe.
15+
arch=$(uname -m)
16+
case "$arch" in
17+
x86_64) arch=x64 ;;
18+
esac
19+
signtool=$(
20+
find '/c/Program Files'*'/Windows Kits' -name signtool.exe |
21+
grep "/$arch/" | head -n1
22+
)
23+
24+
if [ -f "$signtool" ]
25+
then
26+
echo "Found signtool.exe at: $signtool"
27+
else
28+
echo "[ERROR] signtool.exe not found at: $signtool"
29+
exit 1
30+
fi
31+
32+
if [ ! "$TIMESTAMP_SERVER" ]; then
33+
TIMESTAMP_SERVER="http://time.certum.pl/"
34+
fi
35+
36+
"$signtool" sign /sha1 "$THUMBPRINT" \
37+
/tr "$TIMESTAMP_SERVER" \
38+
/td SHA256 /fd SHA256 /v \
39+
"$appDir\\"*.exe \
40+
"$appDir\\jaunch\\jaunch-windows-"*.exe &&
41+
42+
"$signtool" verify /pa /all \
43+
"$appDir\\"*.exe \
44+
"$appDir\\jaunch\\jaunch-windows-"*.exe
45+
46+
echo "Signing complete!"

0 commit comments

Comments
 (0)