-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstallChrome.sh
More file actions
executable file
·34 lines (32 loc) · 1.34 KB
/
Copy pathinstallChrome.sh
File metadata and controls
executable file
·34 lines (32 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Download & Install Latest Version of Google Chrome - 7/7/2015
# Will Only Install if Google Chrome is not Already in the Applications Folder
# Set Variables
chromeURL="https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
googleChrome="/tmp/chrome.dmg"
currentUser=$(stat -f "%Su" /dev/console)
# Check Connection to www.google.com
/usr/bin/curl -D- -o /dev/null -s http://www.google.com
if [[ $? != 0 ]]; then
echo "Google.com not Reachable, Check Internet Connection"
exit $?
# Check if Chrome is Already Installed, If not Installation will Continue
elif [ -e /Applications/Google\ Chrome.app ]; then
echo "Google Chrome Already Present, Skiping Installation"
exit 1
else
echo "Google Chrome not found, Downloading & Installing"
/usr/bin/curl -o "$googleChrome" "$chromeURL"
mount=`/usr/bin/mktemp -d /tmp/Chrome`
/usr/bin/hdiutil attach "$googleChrome" -mountpoint "$mount" -nobrowse -noverify -noautoopen
cp -R /private/tmp/Chrome/Google\ Chrome.app /Applications/
/bin/sleep 1
# Cleanup Temp Files & Mounts, Add Permissions for Current User
/usr/bin/hdiutil detach "$mount"
/bin/rm -R /private/tmp/Chrome
/bin/rm -rf "$googleChrome"
/bin/sleep 1
/bin/chmod -R +a "$currentUser allow read,write,delete" /Applications/Google\ Chrome.app
echo "Google Chrome Installed Successfully"
exit 0
fi