From 70de5c3d1c82f0f23b616d6bd5711bbea4c6ae5a Mon Sep 17 00:00:00 2001 From: Thomas Jefferies Date: Mon, 9 Jul 2012 12:53:28 -0400 Subject: [PATCH 1/5] Auto-kill and respawn Automatically kill running Chromium processes prior to replacing Chromium, then re-launch when complete. --- README | 4 ++++ chromium-updater.sh | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/README b/README index 29870f5..cba5109 100644 --- a/README +++ b/README @@ -1,4 +1,5 @@ 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 +19,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..302a86a 100755 --- a/chromium-updater.sh +++ b/chromium-updater.sh @@ -9,6 +9,7 @@ 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 @@ -21,11 +22,21 @@ 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 != '0' ]; +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 \ No newline at end of file From d1d25c81cc8a5a30fe6df0a00361693fb432cadb Mon Sep 17 00:00:00 2001 From: Thomas Jefferies Date: Mon, 9 Jul 2012 12:54:11 -0400 Subject: [PATCH 2/5] Changed readme to indicate this is a fork. --- README | 1 - 1 file changed, 1 deletion(-) diff --git a/README b/README index cba5109..8da72be 100644 --- a/README +++ b/README @@ -1,4 +1,3 @@ -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: From 973b47909d589f02e4ab42e3d5a46bf4d66dddb0 Mon Sep 17 00:00:00 2001 From: Thomas Jefferies Date: Mon, 9 Jul 2012 12:55:11 -0400 Subject: [PATCH 3/5] Yeah yeah, blank line. This is my first git, what can I say. --- chromium-updater.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/chromium-updater.sh b/chromium-updater.sh index 302a86a..50ce17f 100755 --- a/chromium-updater.sh +++ b/chromium-updater.sh @@ -37,6 +37,5 @@ 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 \ No newline at end of file From 243a31310efa8565083de0e02cb1f0e3455f4872 Mon Sep 17 00:00:00 2001 From: Thomas Jefferies Date: Wed, 11 Jul 2012 13:58:55 -0400 Subject: [PATCH 4/5] Fix the App Check. I forgot that doing a ps aux and grepping the results would always show the name of the program I was grepping in the list because the grep itself would show up. Silly me. It now only attempts to kill the process if the process isn't running. --- chromium-updater.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chromium-updater.sh b/chromium-updater.sh index 50ce17f..3b1e862 100755 --- a/chromium-updater.sh +++ b/chromium-updater.sh @@ -27,7 +27,7 @@ curl -L -O $BASE_URL/$LATEST_VER/$FILE_NAME unzip -qq $FILE_NAME # Check for running Chromium processes and kill them if they exist. -if [ $APPCHK != '0' ]; +if [ $APPCHK != '1' ]; then killall -9 Chromium fi @@ -38,4 +38,4 @@ APP_NAME=$(basename ${FILE_NAME%%.zip}/*.app) mv ${FILE_NAME%%.zip}/$APP_NAME $APP_DIR/$APP_NAME # Re-open newly downloaded version of Chromium -open /$APP_DIR/$APP_NAME \ No newline at end of file +open /$APP_DIR/$APP_NAME From 7508c23d7cf46c194707475f3b66bf7ce1e3458e Mon Sep 17 00:00:00 2001 From: Thomas Jefferies Date: Fri, 12 Oct 2012 11:07:10 -0400 Subject: [PATCH 5/5] Fixed Chrome's change from SVNRevision to SCMRevision Updated script to pull SVN revision from new variable name --- README | 0 chromium-updater.sh | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 README diff --git a/README b/README old mode 100644 new mode 100755 diff --git a/chromium-updater.sh b/chromium-updater.sh index 3b1e862..c7564f0 100755 --- a/chromium-updater.sh +++ b/chromium-updater.sh @@ -12,7 +12,7 @@ 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