Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Linux VM to fetch list of jar to open and sign -> Done to prevent silent hanging of heavy MacOS' Github runner
- Loading branch information
1 parent
956907d
commit 7734ed6
Showing
2 changed files
with
96 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Generate list of jars containings .so\|.dylib\|.jnilib to sign for MacOS release | ||
# Can automatically parse 4 releases at once | ||
# | ||
|
||
haveLib=false | ||
|
||
function getJarToCheck(){ | ||
find "$1" -name "*.jar" > currentAppJar.txt | ||
|
||
# Remove already checked lines | ||
grep -v -x -f alreadySawJar.txt currentAppJar.txt > tmp.txt | ||
cat tmp.txt > currentAppJar.txt && rm tmp.txt | ||
|
||
cat currentAppJar.txt >> alreadySawJar.txt | ||
} | ||
|
||
function haveSomethingToSign(){ | ||
if [ $(jar tf "$1" | grep '\.so\|\.dylib\|\.jnilib' | wc -l) -gt 0 ]; then | ||
# 0 = true | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
} | ||
|
||
function parseApp(){ | ||
getJarToCheck "$1" | ||
|
||
while read f | ||
do | ||
if haveSomethingToSign "$f"; then | ||
echo "Need to sign $f" | ||
echo $f >> needToSign.txt | ||
else | ||
if [ $(jar tf "$f" | grep '\.jar' | wc -l) -gt 0 ]; then | ||
jar tf "$f" | grep '\.jar' > nestedJar.txt | ||
while read j | ||
do | ||
echo "Check in $j nested in $f" | ||
jar xf "$f" "$j" | ||
if haveSomethingToSign "$j"; then | ||
echo "Need to sign $j nested in $f" | ||
echo $f >> needToSign.txt | ||
fi | ||
done < nestedJar.txt | ||
fi | ||
fi | ||
|
||
done < currentAppJar.txt | ||
} | ||
|
||
function unzipAndParse(){ | ||
echo "Unzipping $1 ..." | ||
unzip -q "$1" | ||
parseApp "./Gama.app" | ||
find . -maxdepth 1 -type d -exec rm -fr {} \; | ||
} | ||
|
||
|
||
touch alreadySawJar.txt needToSign.txt currentAppJar.txt nestedJar.txt | ||
for gama in ./Gama**zip; do | ||
unzipAndParse $gama | ||
done | ||
|
||
# Remove duplicated lines | ||
awk '!a[$0]++' needToSign.txt > tmp.txt | ||
cat tmp.txt > needToSign.txt |