-
#!/bin/bash
-
#Check if Chromium process is running
-
if [[ $(ps ax | grep -v grep | grep [/]Chromium.app) ]];
-
then
-
echo "Chromium is currently running, quit application first"
-
exit
-
fi
-
-
#Check current version
-
if [ -f "/Applications/Chromium.app/Contents/Info.plist" ];
-
then
-
currentversion=$(/usr/libexec/PlistBuddy -c 'Print :SVNRevision' /Applications/Chromium.app/Contents/Info.plist)
-
echo "## Current version : $currentversion"
-
else
-
currentversion="0"
-
echo "## Chromium is not installed"
-
fi
-
-
#Check latest version
-
latestversion=$(curl -s http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/LATEST)
-
echo "## Last version : $latestversion"
-
-
#Check for updates
-
if [ $latestversion -le $currentversion ];
-
then
-
echo "## Chromium $currentversion is currently the newest version available"
-
exit
-
fi
-
-
#Creating temp directory
-
if [ -d "/tmp/chrome_install" ];
-
then
-
echo "## Deleting existing tmp directory"
-
rm -rf /tmp/chrome_install
-
fi
-
echo "## Creating tmp directory"
-
mkdir /tmp/chrome_install
-
cd /tmp/chrome_install
-
-
#Downloading file
-
downloadfile='http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/'${latestversion}|>'/chrome-mac.zip'
-
echo "## Downloading $downloadfile"
-
curl $downloadfile -o /tmp/chrome_install/chrome.zip
-
-
#Check if file exist
-
if [ ! -f "/tmp/chrome_install/chrome.zip" ];
-
then
-
echo "## chrome.zip not found, download failed"
-
rm -rf /tmp/chrome_install
-
exit
-
fi
-
-
#Unzip
-
echo "## Extracting.chrome.zip"
-
unzip -qq /tmp/chrome_install/chrome.zip
-
-
#Copy to Applications Directory
-
if [ -d "/Applications/Chromium.app/" ];
-
#
-
then
-
echo "## Deleting old Chromium files"
-
dat=$(date '+%H%M')
-
mv /Applications/Chromium.app/ ~/.Trash/Chromium$dat.app
-
fi
-
-
echo "## Copying to Applications directory"
-
cp -R /tmp/chrome_install/chrome-mac/Chromium.app /Applications/
-
-
#Clean up
-
echo "## Deleting temp directory"
-
rm -rf /tmp/chrome_install
-
-
#Check installed version
-
if [ -f "/Applications/Chromium.app/Contents/Info.plist" ];
-
then
-
version=$(/usr/libexec/PlistBuddy -c 'Print :SVNRevision' /Applications/Chromium.app/Contents/Info.plist)
-
echo "## Chromium version $version is installed !"
-
exit
-
else
-
echo "Chromium is not installed, please restart this script"
-
-
fi