-
Notifications
You must be signed in to change notification settings - Fork 4
/
mac-sign.sh
47 lines (33 loc) · 1017 Bytes
/
mac-sign.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
function signInJar(){
local f
echo "$1"
# TODO : Prevent gathering META-INF folder
jar tf "$1" | grep '\.so\|\.dylib\|\.jnilib\|\.jar' > filelist.txt
sed -i -e '/META-INF/d' filelist.txt
tac filelist.txt > reverse-filelist.txt
while read f
do
jar xf "$1" "$f"
if [[ "$f" =~ .*".jar" ]]; then
mkdir "_sub" && cd "_sub"
signInJar "../$f"
cd ".." && rm -fr "_sub"
else
codesign --timestamp --force -s "$MACOS_DEV_ID" -v "$f"
echo "---"
fi
jar uf "$1" "$f"
done < reverse-filelist.txt
}
find ./ -name "*jar" > jarlist.txt
tac jarlist.txt > reverse-jarlist.txt
# Sign .jar files
while read j
do
signInJar "$j"
find . -not -wholename "*Gama.app*" -delete
echo "xxx"
done < reverse-jarlist.txt
# Sign single lib files
find ./ \( -name "*dylib" -o -name "*.so" -o -name "*.jnilib" \) -exec codesign --timestamp --force -s "$MACOS_DEV_ID" -v {} \;