forked from jayenashar/unattach
-
Notifications
You must be signed in to change notification settings - Fork 3
/
package.sh
executable file
·85 lines (81 loc) · 3.67 KB
/
package.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
set -e -u -x -o pipefail
mvn clean package
VERSION=3.4.0
DESCRIPTION="Easily download and optionally remove Gmail attachments from many emails at once."
VENDOR="Rok Strniša"
YEAR=`date +"%Y"`
COPYRIGHT="Copyright $YEAR, All rights reserved"
MAIN_CLASS="app.unattach.Main"
JAVA_OPTION="-Xmx2000m"
JAR_PATH=$(ls target/*-with-dependencies.jar)
JAR_FILE=$(basename "$JAR_PATH")
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
rm -rf ./*.deb
jpackage --name Unattach --app-version $VERSION --description "$DESCRIPTION" --vendor "$VENDOR" --copyright "$COPYRIGHT" \
--license-file LICENSE \
--icon src/main/resources/logo-256.png \
--linux-shortcut \
--input target \
--java-options "$JAVA_OPTION" \
--main-jar "$JAR_FILE" \
--main-class $MAIN_CLASS
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Re-pack JAR with signed libraries.
rm -rf tmp
mkdir tmp
mv "$JAR_PATH" tmp/
pushd tmp
jar xf "$JAR_FILE"
rm "$JAR_FILE"
ls ./*.dylib #| xargs codesign -s "Developer ID Application: Rok Strnisa (73XQUXV944)" -f -v
jar cmf META-INF/MANIFEST.MF "../$JAR_PATH" ./*
popd
# Create APP.
rm -rf Unattach.app
jpackage --name Unattach --app-version $VERSION --description "$DESCRIPTION" --vendor "$VENDOR" --copyright "$COPYRIGHT" \
--icon src/main/resources/logo-256.icns \
--input target \
--main-jar "$JAR_FILE" \
--main-class $MAIN_CLASS \
--java-options "$JAVA_OPTION" \
--type app-image
# Sign APP's runtime and itself.
#codesign -s "Developer ID Application: Rok Strnisa (73XQUXV944)" --options runtime --entitlements macos.entitlements -f -v Unattach.app/Contents/runtime/Contents/MacOS/libjli.dylib
#codesign -s "Developer ID Application: Rok Strnisa (73XQUXV944)" --options runtime --entitlements macos.entitlements -f -v Unattach.app/Contents/MacOS/Unattach
#codesign -s "Developer ID Application: Rok Strnisa (73XQUXV944)" --options runtime --entitlements macos.entitlements -f -v Unattach.app
# Create DMG.
rm -rf ./*.dmg
jpackage --name Unattach --app-version $VERSION --description "$DESCRIPTION" --vendor "$VENDOR" --copyright "$COPYRIGHT" \
--license-file LICENSE \
--type dmg --app-image Unattach.app
# Sign DMG.
#codesign -s "Developer ID Application: Rok Strnisa (73XQUXV944)" --options runtime --entitlements macos.entitlements -vvvv --deep Unattach-$VERSION.dmg
# Upload DMG for verification.
#REQUEST_UUID=$(xcrun altool --notarize-app --primary-bundle-id "app.unattach-$VERSION" -u "[email protected]" -p "@keychain:UNATTACH_APP_PASSWORD" --file Unattach-$VERSION.dmg | grep RequestUUID | awk '{print $3}')
# Wait for verification to complete.
#while xcrun altool --notarization-info "$REQUEST_UUID" -u [email protected] -p "@keychain:UNATTACH_APP_PASSWORD" | grep "Status: in progress" > /dev/null; do
#echo "Verification in progress..."
#sleep 30
#done
# Attach stamp to the DMG.
#xcrun stapler staple Unattach-$VERSION.dmg
# Check APP and DMG.
#spctl -vvv --assess --type exec Unattach.app
#codesign -vvv --deep --strict Unattach-$VERSION.dmg
#codesign -dvv Unattach-$VERSION.dmg
elif [[ "$OSTYPE" == "msys" ]]; then
rm -rf ./*.msi
jpackage --type msi --name Unattach --app-version $VERSION --description "$DESCRIPTION" --vendor "$VENDOR" --copyright "$COPYRIGHT" \
--license-file LICENSE \
--icon src/main/resources/logo-256.ico \
--win-shortcut --win-dir-chooser --win-menu --win-menu-group "Unattach" \
--win-upgrade-uuid c1fce3eb-862f-4321-98ed-67178316160c \
--input target \
--java-options "$JAVA_OPTION" \
--main-jar "$JAR_FILE" \
--main-class app.unattach.Main
Powershell -File windows-sign.ps1
else
echo "Unsupported system: $OSTYPE"
fi