Skip to content

Instantly share code, notes, and snippets.

@tempusthales
Created June 25, 2018 16:19
Show Gist options
  • Save tempusthales/f3bb9930e3abd587edaf10e8cea858de to your computer and use it in GitHub Desktop.
Save tempusthales/f3bb9930e3abd587edaf10e8cea858de to your computer and use it in GitHub Desktop.
Install Firefox for mass deployment with Yo notifications
#!/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