-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmkapp
executable file
·83 lines (71 loc) · 3.18 KB
/
mkapp
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
#!/bin/bash
NAME=MeshCommander
BASE=${0%/*}
TMP=/tmp
JS=${TMP}/appbuild.js
BUILD=${BASE}/build
APP=${BUILD}/${NAME}/osx64/${NAME}.app
export CODESIGN_ALLOCATE="$(xcrun -find codesign_allocate)"
#CHILD_ENT=${BASE}/entitlements-child.plist
#PARENT_ENT=${BASE}/entitlements-parent.plist
ID="$(security find-identity | awk '/ID Application/ {print $2}' | uniq)"
## Script to pass build parameters to nw-builder
cat<<EOF>>${JS}
var NwBuilder = import('nw-builder');
var nw = new NwBuilder({
files: './source/**',
platforms: ['osx64'],
buildType: 'default',
macIcns: './files/nw.icns',
macPlist: './files/Info.plist'
});
// .build() returns a promise but also supports a plain callback approach as well
nw.build().then(function () {
console.log('all done!');
}).catch(function (error) {
console.error(error);
});
EOF
## Build the application
node ${JS}
## Check for successful completion, or otherwise abort the script
if [[ $? == 0 ]]
then
echo ""
## The InfoPlist.strings file provides details that appear
## in the application's "About" menu item
echo "Copying \"InfoPlist.strings\" to \"lproj\" directory"
cp -r ${BASE}/files/en.lproj ${APP}/Contents/Resources/
mv ${APP}/Contents/Resources/app.icns ${APP}/Contents/Resources/nw.icns
NWVER=$(ls "${APP}/Contents/Frameworks/nwjs Framework.framework/Versions/" | awk '{gsub(/\//,""); print}')
echo ""
else
echo "ERROR: Failed to package ${APP##*/}"
exit 1
fi
## Sign and verify signature
echo "Signing Application"
echo ""
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/libnode.dylib"
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/libffmpeg.dylib"
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}/Contents/Frameworks/nwjs Framework.framework"
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/app_mode_loader"
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/chrome_crashpad_handler"
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/nwjs Helper (GPU).app"
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/nwjs Helper (Plugin).app"
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/nwjs Helper (Renderer).app"
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}/Contents/Frameworks/nwjs Framework.framework/Versions/Current/Helpers/nwjs Helper.app"
codesign --deep --force --verify --verbose --sign "${ID}" "${APP}"
#
echo ""
echo "Verifying signature"
echo ""
codesign --verify --deep --display --verbose=4 "${APP}"
echo ""
## Check if Gatekeeper will allow application execution
echo ""
echo "Veriyfing Gatekeeper acceptance..."
echo ""
spctl --ignore-cache --no-cache --assess --type execute --verbose=4 "${APP}"
echo ""
rm ${JS}