mirror of
https://github.com/kyleneideck/BackgroundMusic
synced 2024-11-24 05:03:04 +00:00
cb9cdb00b6
Users reporting bugs will be able to use these packages to install debug builds of Background Music without having to install from source. This is mainly useful because debug builds have more detailed logging. Hopefully we'll get around to adding an option to enable debug logging at runtime, but this should work well enough for now. Also: - Use newer macOS images in Travis CI builds. - Fix an xcrun command in build_and_install.sh that was accidentally being started in the background. - Fix build_and_install.sh building libPublicUtility.a twice for no reason.
60 lines
2.3 KiB
Bash
Executable file
60 lines
2.3 KiB
Bash
Executable file
#!/bin/sh
|
|
# vim: tw=100:
|
|
|
|
# This file is part of Background Music.
|
|
#
|
|
# Background Music is free software: you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation, either version 2 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# Background Music is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Background Music. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
# postinstall
|
|
#
|
|
# Copyright © 2017 Kyle Neideck
|
|
#
|
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin; export PATH
|
|
|
|
coreaudiod_plist="/System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist"
|
|
dest_volume="$3"
|
|
xpc_helper_path="$(bash safe_install_dir.sh -y)"
|
|
|
|
logger "Installing BGMXPCHelper to $xpc_helper_path"
|
|
cp -Rf "BGMXPCHelper.xpc" "$xpc_helper_path"
|
|
|
|
# TODO: Fail the install and show an error message if this fails.
|
|
bash "post_install.sh" "$xpc_helper_path" "BGMXPCHelper.xpc/Contents/MacOS/BGMXPCHelper" "."
|
|
|
|
# TODO: Verify the installed files, their permissions, the _BGMXPCHelper user/group, etc.
|
|
# TODO: Instead of just sleeping for 5 seconds, wait until coreaudiod is restarted and BGMDevice is
|
|
# ready to use.
|
|
|
|
# The extra or-clauses are fallback versions of the command that restarts coreaudiod. Apparently
|
|
# some of these commands don't work with older versions of launchctl, so I figure there's no
|
|
# harm in trying a bunch of different ways (which should all work).
|
|
(launchctl kill SIGTERM system/com.apple.audio.coreaudiod &>/dev/null || \
|
|
launchctl kill TERM system/com.apple.audio.coreaudiod &>/dev/null || \
|
|
launchctl kill 15 system/com.apple.audio.coreaudiod &>/dev/null || \
|
|
launchctl kill -15 system/com.apple.audio.coreaudiod &>/dev/null || \
|
|
(launchctl unload "$coreaudiod_plist" &>/dev/null && \
|
|
launchctl load "$coreaudiod_plist" &>/dev/null) || \
|
|
killall coreaudiod &>/dev/null) && \
|
|
sleep 5
|
|
|
|
open "${dest_volume}/Applications/Background Music.app"
|
|
|
|
# The installer plays a sound when it finishes, so give BGMApp a second to launch.
|
|
sleep 1
|
|
|
|
exit 0
|
|
|
|
|