Fix pkg installer not opening BGMApp if relocated.
If the user moved BGMApp and then installed a new version from a .pkg, BGMApp would be installed to the same place the old version had been moved to. When pkg/postinstall tried to open BGMApp, it would fail because it assumed BGMApp would be installed to /Applications. Also, the installer now fails with an error message if it can't open BGMApp after finishing the install. Fixes #164.
This commit is contained in:
+2
-1
@@ -28,7 +28,7 @@
|
||||
# Based on https://github.com/tekezo/Karabiner-Elements/blob/master/make-package.sh
|
||||
#
|
||||
|
||||
# TODO: Code signing. See `man pkgbuild`.
|
||||
# TODO: Code signing. See `man productbuild`.
|
||||
|
||||
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"; export PATH
|
||||
|
||||
@@ -162,6 +162,7 @@ pkgbuild \
|
||||
|
||||
productbuild \
|
||||
--distribution "pkg/Distribution.xml" \
|
||||
--identifier "$pkg_identifier" \
|
||||
--resources "pkgres" \
|
||||
--package-path "$out_dir" \
|
||||
"$pkg"
|
||||
|
||||
+9
-2
@@ -19,7 +19,7 @@
|
||||
#
|
||||
# postinstall
|
||||
#
|
||||
# Copyright © 2017 Kyle Neideck
|
||||
# Copyright © 2017, 2018 Kyle Neideck
|
||||
#
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin; export PATH
|
||||
@@ -50,7 +50,14 @@ bash "post_install.sh" "$xpc_helper_path" "BGMXPCHelper.xpc/Contents/MacOS/BGMXP
|
||||
killall coreaudiod &>/dev/null) && \
|
||||
sleep 5
|
||||
|
||||
open "${dest_volume}/Applications/Background Music.app"
|
||||
# Try opening BGMApp using its bundle ID first so the installer can declare it as "relocatable".
|
||||
# That way, if the user moves BGMApp and then installs a newer version of Background Music, the
|
||||
# installer will try to find the old version of BGMApp and put the new one in the same place.
|
||||
#
|
||||
# If we can't open BGMApp, it very likely didn't install properly, so we fail the install.
|
||||
open -b com.bearisdriving.BGM.App || \
|
||||
open "${dest_volume}/Applications/Background Music.app" || \
|
||||
exit 1
|
||||
|
||||
# The installer plays a sound when it finishes, so give BGMApp a second to launch.
|
||||
sleep 1
|
||||
|
||||
Reference in New Issue
Block a user