-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·56 lines (47 loc) · 1.73 KB
/
build.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
#!/bin/bash
identifier="com.github.ryangball.simple-launchdaemon-creator"
version="1.0"
if [[ -n "$1" ]]; then
version="$1"
echo "Version set to $version"
else
echo "No version passed, using version $version"
fi
# Create temp build directories
mkdir -p /private/tmp/simple-launchdaemon-creator/files/Applications
mkdir -p /private/tmp/simple-launchdaemon-creator/scripts
mkdir -p "$PWD/build"
# Build the .app
echo "Building the .app with Platypus..."
/usr/local/bin/platypus \
--app-icon "$PWD/images/AppIcon.icns" \
--name 'Simple LaunchDaemon Creator' \
--interface-type 'Progress Bar' \
--interpreter '/bin/bash' \
--author 'Ryan Ball' \
--app-version "$version" \
--bundle-identifier "$identifier" \
--optimize-nib \
--overwrite \
--text-font 'Helvetica 13' \
'simple_launchdaemon_creator.sh' \
"/private/tmp/simple-launchdaemon-creator/files/Applications/Simple LaunchDaemon Creator.app"
# Remove any unwanted .DS_Store files from the temp build directory
find "/private/tmp/simple-launchdaemon-creator/" -name '*.DS_Store' -type f -delete
# Remove any extended attributes (ACEs) from the temp build directory
/usr/bin/xattr -rc "/private/tmp/simple-launchdaemon-creator"
echo "Building the PKG..."
/usr/bin/pkgbuild --quiet --root "/private/tmp/simple-launchdaemon-creator/files/" \
--install-location "/" \
--identifier "$identifier" \
--version "$version" \
--ownership recommended \
"$PWD/build/Simple_LaunchDaemon_Creator_${version}.pkg"
# shellcheck disable=SC2181
if [[ "$?" == "0" ]]; then
echo "Revealing Simple_LaunchDaemon_Creator_${version}.pkg in Finder"
open -R "$PWD/build/Simple_LaunchDaemon_Creator_${version}.pkg"
else
echo "Build failed."
fi
exit 0