Skip to content

Instantly share code, notes, and snippets.

@robhanlon22
Created February 14, 2010 21:07
Show Gist options
  • Save robhanlon22/304263 to your computer and use it in GitHub Desktop.
Save robhanlon22/304263 to your computer and use it in GitHub Desktop.
#!/bin/sh
pushd /tmp
SCRIPT_TEXT="
on run argv\n
if appIsRunning(\"Chromium\") then\n
set userCanceled to false\n
tell application \"Chromium\"\n
try\n
display dialog \"Downloaded newest Chromium nightly, need to relaunch to use new version.\" with icon stop\n
on error number -128\n
set userCanceled to true\n
end try\n
if not userCanceled then\n
quit\n
delay 2\n
activate application \"Chromium\"\n
end if\n
end tell\n
end if\n
end run\n
on appIsRunning(appName)\n
tell application \"System Events\" to (name of processes) contains appName\n
end appIsRunning"
SCRIPT_NM="dialog.scpt"
echo -e $SCRIPT_TEXT > $SCRIPT_NM
APPS="/Applications"
C_APP_NM='Chromium.app'
C_DL_DIR='chrome-mac'
C_INSTALL="$APPS/$C_APP_NM"
C_DL_FL="$C_DL_DIR/$C_APP_NM"
BASE_URL='http://build.chromium.org/buildbot/snapshots/chromium-rel-mac'
LATEST_URL="$BASE_URL/LATEST"
ZIP_FILE='chrome-mac.zip'
latest=`curl "$LATEST_URL"`
if [[ $latest ]]
then
wget "$BASE_URL/$latest/$ZIP_FILE" &&
unzip "$ZIP_FILE" &&
rm -rf "$C_INSTALL" &&
mv "$C_DL_FL" "$APPS" &&
osascript $SCRIPT_NM
fi
rm -rf $C_DL_DIR $ZIP_FILE $SCRIPT_NM
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment