Created
June 25, 2018 16:19
-
-
Save tempusthales/f3bb9930e3abd587edaf10e8cea858de to your computer and use it in GitHub Desktop.
Install Firefox for mass deployment with Yo notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Notify user if older version is running | |
USERNAME=`ps -ajxww | grep -v grep | grep loginwindow | awk '{print $1}'` | |
USERID="$(id -u $USERNAME)" | |
FFPKG="Firefox-60.0.2.pkg" | |
# Check for running firefox | |
if [[ ! "$(pgrep -l firefox | awk '{print$2}')" = "" ]]; then | |
launchctl asuser ${USERID} /Applications/Utilities/yo.app/Contents/MacOS/yo -t "Firefox Update" -s "Restarting Firefox" -n "Firefox updated to version 60.0.2" | |
launchctl asuser ${USERID} sudo -u ${USERNAME} osascript -e 'quit app "Firefox"' | |
/usr/sbin/installer -pkg "/usr/local/etc/packages/ff/$FFPKG" -target / | |
launchctl asuser ${USERID} sudo -u ${USERNAME} open -a "/Applications/Firefox.app" | |
else | |
/usr/sbin/installer -pkg "/usr/local/etc/packages/ff/$FFPKG" -target / | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment