diff --git a/README b/README old mode 100644 new mode 100755 index 29870f5..8da72be --- a/README +++ b/README @@ -1,4 +1,4 @@ -Chrome Tools +Chrome Tools (n1ckn4m3 Fork) Chrome Tools is a collection of scripts that support users of Google's Chrome Browser and the Chromium Project. These include: chromium-updater.sh - Updates or installs the latest Chromium Browser. @@ -18,3 +18,6 @@ http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/ More Detail: http://build.chromium.org/buildbot/waterfall/console + +Changelog: +n1ckn4m3 - 07/09/12: Automated killing the existing Chromium process and then restarting the browser after the upgrade. \ No newline at end of file diff --git a/chromium-updater.sh b/chromium-updater.sh index 992bf53..c7564f0 100755 --- a/chromium-updater.sh +++ b/chromium-updater.sh @@ -9,9 +9,10 @@ LATEST_VER=$(curl -sS $BASE_URL/LAST_CHANGE) # Either of these could change at any moment. FILE_NAME=chrome-mac.zip APP_NAME=Chromium.app +APPCHK=$(ps aux | grep -c Chromium) # check current revision number -CURRENT_VER=$(/usr/libexec/PlistBuddy -c "print SVNRevision" $APP_DIR/$APP_NAME/Contents/Info.plist) || CURRENT_VER=0 +CURRENT_VER=$(/usr/libexec/PlistBuddy -c "print SCMRevision" $APP_DIR/$APP_NAME/Contents/Info.plist) || CURRENT_VER=0 CHANGELOG="http://build.chromium.org/buildbot/perf/dashboard/ui/changelog.html?url=/trunk/src&range=$LATEST_VER:$CURRENT_VER&mode=html" echo $CHANGELOG | pbcopy # bail if there is not a newer version @@ -21,11 +22,20 @@ echo "Changelog (in clipboard): $CHANGELOG" mkdir -p $TMP_DIR && cd $TMP_DIR curl -L -O $BASE_URL/$LATEST_VER/$FILE_NAME + # I really wish they would create tar/gz files instead of zip files so that I could pipe curl to tar and not write the archive to disk. unzip -qq $FILE_NAME + +# Check for running Chromium processes and kill them if they exist. +if [ $APPCHK != '1' ]; +then +killall -9 Chromium +fi + # Because this script rename the existing app with its version and moves it to the temp dir, it is safe to run while the app open.` APP_NAME=$(basename ${FILE_NAME%%.zip}/*.app) [[ -d $APP_DIR/$APP_NAME ]] && mv $APP_DIR/$APP_NAME ./${APP_NAME%%.app}.$CURRENT_VER.app mv ${FILE_NAME%%.zip}/$APP_NAME $APP_DIR/$APP_NAME - +# Re-open newly downloaded version of Chromium +open /$APP_DIR/$APP_NAME