Skip to content

Commit d322c3a

Browse files
committed
Never show warning dialog box in command-line pkg installs.
Also, - add Background Music Device.driver to the array of bundles in pkgbuild.plist, and - don't warn about the permissions of the install dir for BGMXPCHelper in build_and_install.sh if it's only building.
1 parent 45519a4 commit d322c3a

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

build_and_install.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ APP_PATH="/Applications"
123123
APP_DIR="Background Music.app"
124124
DRIVER_PATH="/Library/Audio/Plug-Ins/HAL"
125125
DRIVER_DIR="Background Music Device.driver"
126-
XPC_HELPER_PATH="$(BGMApp/BGMXPCHelper/safe_install_dir.sh)"
127126
XPC_HELPER_DIR="BGMXPCHelper.xpc"
128127

129128
GENERAL_ERROR_MSG="Internal script error. Probably a bug in this script."
@@ -252,7 +251,6 @@ parse_options() {
252251
# The dirs xcodebuild will build in.
253252
APP_PATH="./BGMApp/build"
254253
DRIVER_PATH="./BGMDriver/build"
255-
XPC_HELPER_PATH="${APP_PATH}"
256254
;;
257255
w)
258256
# TODO: What if they also pass their own OTHER_CFLAGS with -x?
@@ -540,6 +538,8 @@ fi
540538
541539
# Print initial message.
542540
if [[ "${XCODEBUILD_ACTION}" == "install" ]]; then
541+
XPC_HELPER_PATH="$(BGMApp/BGMXPCHelper/safe_install_dir.sh)"
542+
543543
echo "$(bold_face About to install Background Music). Please pause all audio, if you can."
544544
[[ "${CONFIGURATION}" == "Debug" ]] && echo "Debug build."
545545
echo
@@ -550,6 +550,8 @@ if [[ "${XCODEBUILD_ACTION}" == "install" ]]; then
550550
echo " - /Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist"
551551
echo
552552
elif [[ "${XCODEBUILD_ACTION}" == "build" ]]; then
553+
XPC_HELPER_PATH="${APP_PATH}"
554+
553555
echo "$(bold_face Building Background Music...)"
554556
echo
555557
fi

pkg/pkgbuild.plist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
<dict>
66
<key>RootRelativeBundlePath</key> <string>Applications/Background Music.app</string>
77
<key>BundleHasStrictIdentifier</key> <false/>
8+
<key>BundleIsRelocatable</key> <true/>
9+
<key>BundleIsVersionChecked</key> <false/>
10+
<key>BundleOverwriteAction</key> <string>upgrade</string>
11+
</dict>
12+
<dict>
13+
<key>RootRelativeBundlePath</key> <string>Library/Audio/Plug-Ins/HAL/Background Music Device.driver</string>
14+
<key>BundleHasStrictIdentifier</key> <false/>
815
<key>BundleIsRelocatable</key> <false/>
916
<key>BundleIsVersionChecked</key> <false/>
1017
<key>BundleOverwriteAction</key> <string>upgrade</string>

pkg/preinstall

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,24 @@ if [ "$(bash safe_install_dir.sh "$xpc_helper_path")" != "1" ]; then
3535
msg+="group 'wheel', and have permissions 755 (rwxr-xr-x).\n\n"
3636
msg+="Background Music will still work if you decide to continue."
3737

38-
if ! osascript <<EOT
39-
tell application id "com.apple.systemuiserver"
40-
display alert "Warning" \
41-
message "$msg" \
42-
buttons {"Cancel", "Install Anyway"} \
43-
default button "Cancel" \
44-
cancel button "Cancel" \
45-
as warning
46-
end tell
47-
EOT
48-
then
38+
if [ "$COMMAND_LINE_INSTALL" == "1" ]; then
39+
# As far as I can tell, we can't print anything the user is likely to see.
40+
logger "WARNING: $msg"
4941
exit 1
42+
else
43+
if ! osascript <<EOT
44+
tell application id "com.apple.systemuiserver"
45+
display alert "Warning" \
46+
message "$msg" \
47+
buttons {"Cancel", "Install Anyway"} \
48+
default button "Cancel" \
49+
cancel button "Cancel" \
50+
as warning
51+
end tell
52+
EOT
53+
then
54+
exit 1
55+
fi
5056
fi
5157
fi
5258

0 commit comments

Comments
 (0)