mirror of
https://github.com/bitgapp/eqMac.git
synced 2024-11-27 02:02:15 +03:00
updated postinstall script
This commit is contained in:
parent
efa87d630a
commit
9cf4695528
@ -4,28 +4,12 @@
|
|||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
CURRENT_DRIVER_VERSION=$(defaults read /Library/Audio/Plug-Ins/HAL/eqMac.driver/Contents/Info CFBundleVersion)
|
CURRENT_DRIVER_VERSION=$(defaults read /Library/Audio/Plug-Ins/HAL/eqMac.driver/Contents/Info CFBundleVersion)
|
||||||
NEEDED_DRIVER_VERSION=$(defaults read $DIR/eqMac.driver/Contents/Info CFBundleVersion)
|
LATEST_DRIVER_VERSION=$(defaults read $DIR/eqMac.driver/Contents/Info CFBundleVersion)
|
||||||
|
|
||||||
echo $CURRENT_DRIVER_VERSION
|
echo $CURRENT_DRIVER_VERSION
|
||||||
echo $NEEDED_DRIVER_VERSION
|
echo $LATEST_DRIVER_VERSION
|
||||||
|
|
||||||
if [ "$CURRENT_DRIVER_VERSION" != "$NEEDED_DRIVER_VERSION" ]; then
|
|
||||||
# Copy driver into Plug-Ins folder
|
|
||||||
cp -f -r "$DIR/eqMac.driver" /Library/Audio/Plug-Ins/HAL/ &>/dev/null
|
|
||||||
|
|
||||||
if osascript <<EOT
|
|
||||||
tell application id "com.apple.systemuiserver"
|
|
||||||
display dialog \
|
|
||||||
"It is recommended you restart your Mac for the eqMac to function properly. Alternatively, we can try restarting the macOS Audio service to kickstart the Driver." \
|
|
||||||
buttons {"Restart Audio", "Restart Mac"} \
|
|
||||||
default button "Restart Mac" \
|
|
||||||
cancel button "Restart Audio" \
|
|
||||||
with icon POSIX file "/Applications/eqMac.app/Contents/Resources/AppIcon.icns"
|
|
||||||
end tell
|
|
||||||
EOT
|
|
||||||
then
|
|
||||||
echo "RESTART"
|
|
||||||
|
|
||||||
|
restart_mac () {
|
||||||
osascript <<EOT
|
osascript <<EOT
|
||||||
ignoring application responses
|
ignoring application responses
|
||||||
tell application "System Events" to restart
|
tell application "System Events" to restart
|
||||||
@ -33,7 +17,30 @@ EOT
|
|||||||
EOT
|
EOT
|
||||||
pkill -9 "Installer"
|
pkill -9 "Installer"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
}
|
||||||
|
|
||||||
|
if [ "$CURRENT_DRIVER_VERSION" != "$LATEST_DRIVER_VERSION" ]; then
|
||||||
|
# Copy driver into Plug-Ins folder
|
||||||
|
cp -f -r "$DIR/eqMac.driver" /Library/Audio/Plug-Ins/HAL/ &>/dev/null
|
||||||
|
|
||||||
|
DECISION=$(
|
||||||
|
osascript <<EOT
|
||||||
|
tell application id "com.apple.systemuiserver"
|
||||||
|
display dialog \
|
||||||
|
"It is recommended you restart your Mac for the eqMac to function properly. \n\nAlternatively, we can try restarting the macOS Audio service to kickstart the Driver (Make sure to Quit any app that uses Audio in any way). \n\nAs last resort, if you're in the middle of critical work, you can skip the recommended steps for now but eqMac might not work until you perform a Restart." \
|
||||||
|
buttons {"Skip for now", "Restart Audio", "Restart Mac"} \
|
||||||
|
default button "Restart Mac" \
|
||||||
|
with icon POSIX file "/Applications/eqMac.app/Contents/Resources/AppIcon.icns"
|
||||||
|
end tell
|
||||||
|
EOT
|
||||||
|
)
|
||||||
|
|
||||||
|
case $DECISION in
|
||||||
|
"button returned:Skip for now")
|
||||||
|
echo "Skip"
|
||||||
|
;;
|
||||||
|
|
||||||
|
"button returned:Restart Audio")
|
||||||
echo "SKIP RESTART"
|
echo "SKIP RESTART"
|
||||||
|
|
||||||
# Restart CoreAudio
|
# Restart CoreAudio
|
||||||
@ -70,13 +77,7 @@ EOT
|
|||||||
end tell
|
end tell
|
||||||
EOT
|
EOT
|
||||||
then
|
then
|
||||||
osascript <<EOT
|
restart_mac()
|
||||||
ignoring application responses
|
|
||||||
tell application "System Events" to restart
|
|
||||||
end ignoring
|
|
||||||
EOT
|
|
||||||
pkill -9 "Installer"
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -86,7 +87,13 @@ EOT
|
|||||||
echo "Device became active"
|
echo "Device became active"
|
||||||
killall SystemUIServer # Restart the menu bar
|
killall SystemUIServer # Restart the menu bar
|
||||||
killall ControlStrip || true # Restart the MBP TouchBar, if you have one
|
killall ControlStrip || true # Restart the MBP TouchBar, if you have one
|
||||||
fi
|
;;
|
||||||
|
|
||||||
|
"button returned:Restart Mac")
|
||||||
|
echo "RESTART"
|
||||||
|
restart_mac()
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
open /Applications/eqMac.app
|
open /Applications/eqMac.app
|
||||||
|
Loading…
Reference in New Issue
Block a user