-
Notifications
You must be signed in to change notification settings - Fork 28
/
make-package.sh
executable file
·58 lines (41 loc) · 1.64 KB
/
make-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
#!/bin/bash
set -u # forbid undefined variables
set -e # forbid command failure
# Package build into a signed .dmg file
version=$(python3 scripts/get_version.py package_version)
make build
# --------------------------------------------------
echo "Copy Files"
rm -rf pkgroot
mkdir -p pkgroot
basedir="pkgroot/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/scripts"
mkdir -p "$basedir"
cp -R files/scripts/uninstall "$basedir"
basedir="pkgroot/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications"
mkdir -p "$basedir"
cp -R "src/Daemon/build/Release/Karabiner-VirtualHIDDevice-Daemon.app" "$basedir"
basedir="pkgroot/Applications"
mkdir -p "$basedir"
# Note: Rename app (add leading dot) in order to hide from Finder and Launchpad.
cp -R "src/Manager/build/Release/Karabiner-VirtualHIDDevice-Manager.app" "$basedir/.Karabiner-VirtualHIDDevice-Manager.app"
bash "scripts/setpermissions.sh" pkginfo
bash "scripts/setpermissions.sh" pkgroot
chmod 755 pkginfo/Scripts/postinstall
chmod 755 pkginfo/Scripts/preinstall
# --------------------------------------------------
echo "Create pkg"
pkgName="Karabiner-DriverKit-VirtualHIDDevice-$version.pkg"
pkgIdentifier="org.pqrs.Karabiner-DriverKit-VirtualHIDDevice"
rm -f dist/$pkgName
pkgbuild \
--root pkgroot \
--component-plist pkginfo/pkgbuild.plist \
--scripts pkginfo/Scripts \
--identifier $pkgIdentifier \
--version $version \
--install-location "/" \
dist/$pkgName
# --------------------------------------------------
echo "Sign with Developer ID"
set +e # allow command failure
bash scripts/codesign-pkg.sh dist/$pkgName