Created
March 8, 2017 21:32
-
-
Save LewisLebentz/980acccde324da79c6cfd24472c3ee4d to your computer and use it in GitHub Desktop.
Downloads the latest Google Chrome DMG file and installs it on a Mac
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/sh | |
dmgfile="googlechrome.dmg" | |
volname="Google Chrome" | |
logfile="/Library/Logs/GoogleChromeInstallScript.log" | |
url='https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg' | |
/bin/echo "--" >> ${logfile} | |
/bin/echo "`date`: Downloading latest version." >> ${logfile} | |
/usr/bin/curl -s -o /tmp/${dmgfile} ${url} | |
/bin/echo "`date`: Mounting installer disk image." >> ${logfile} | |
/usr/bin/hdiutil attach /tmp/${dmgfile} -nobrowse -quiet | |
/bin/echo "`date`: Installing..." >> ${logfile} | |
ditto -rsrc "/Volumes/${volname}/Google Chrome.app" "/Applications/Google Chrome.app" | |
/bin/sleep 10 | |
/bin/echo "`date`: Unmounting installer disk image." >> ${logfile} | |
/usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep "${volname}" | awk '{print $1}') -quiet | |
/bin/sleep 10 | |
/bin/echo "`date`: Deleting disk image." >> ${logfile} | |
/bin/rm /tmp/"${dmgfile}" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
trying to install