Quantcast
Channel: Planet Ubuntu
Viewing all articles
Browse latest Browse all 17727

Aron Xu: My Chromium trunk update script

$
0
0

Chromium trunk build doesn’t automatically update the latest version like Minefiled (Firefox trunk), some Ubuntu users have chosen chromium-daily PPA for doing so, but I think updating a bleeding edge daily package will make lots of noise, so I wrote this script.

I am a big fan of Firefox, but I use Chromium in some cases that Firefox cannot handle very well. The script will maintain a directory in good shape so that you can run your program properly, even when you are running chromium and the script won’t crash you by the update. But never tell me you don’t close it for a long long long time that this script has ran for times and your browser crashed, just restart will make it okay.

Put it in your ~/usr/chromium/ and setup cron to run it every day or any time you would like to, it will update your chromium from http://build.chromium.org to your user’s directory. Be aware this program is run in a common user’s account, and by default it gets the AMD64 version.

If you wish to change to I386, find and replace “chromium-rel-linux-64″ with “chromium-rel-linux”.

Note: replace any “&lt” or “&gt” (and following ; mark)you find in your script with “ " and ">“, I am not able to to make them show up correctly in this page. :-(

#!/bin/sh
# Copyright (C) 2010 Aron Xu <happyaron.xu@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .
 
LATEST=`wget -q -O - 'http://build.chromium.org/buildbot/snapshots/chromium-rel-linux-64/LATEST' | awk 'NF > 0'`
 
cd $HOME/usr/chromium/
 
if [ -f ./CURRENT ]; then
	CURRENT=`cat CURRENT`
	if [ $LATEST -le $CURRENT ]; then
		exit;
	fi
fi
 
if [ -f ./OLD ]; then
	OLD=`cat OLD`;
fi
 
if [ -d ./update ]; then
	rm -rf ./update/* && cd ./update/;
else
	rm -rf ./update && mkdir ./update && cd ./update/;
fi
 
wget -q http://build.chromium.org/buildbot/snapshots/chromium-rel-linux-64/$LATEST/chrome-linux.zip
unzip chrome-linux.zip
rm -f chrome-linux.zip
 
mkdir ../$LATEST
mv ./chrome-linux/* ../$LATEST/
rm -rf ./*
cd ../
 
rm -f chromium-browser
ln -s $LATEST chromium-browser
 
rm -rf $OLD
mv CURRENT OLD
echo $LATEST > CURRENT

It is very easy to change this shell script to grab a specific build of chromium if you want to have “bug free” version (I mean build bot doesn’t complain).

#!/bin/sh
# Copyright (C) 2010 Aron Xu <happyaron.xu@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .
 
LATEST=$1
 
cd $HOME/usr/chromium/
 
if [ -f ./CURRENT ]; then
	CURRENT=`cat CURRENT`
	if [ $LATEST -le $CURRENT ]; then
		exit;
	fi
fi
 
if [ -f ./OLD ]; then
	OLD=`cat OLD`;
fi
 
if [ -d ./update ]; then
	rm -rf ./update/* && cd ./update/;
else
	rm -rf ./update && mkdir ./update && cd ./update/;
fi
 
wget -q http://build.chromium.org/buildbot/snapshots/chromium-rel-linux-64/$LATEST/chrome-linux.zip
unzip chrome-linux.zip
rm -f chrome-linux.zip
 
mkdir ../$LATEST
mv ./chrome-linux/* ../$LATEST/
rm -rf ./*
cd ../
 
rm -f chromium-browser
ln -s $LATEST chromium-browser
 
rm -rf $OLD
mv CURRENT OLD
echo $LATEST > CURRENT
echo $LATEST > GRAB

Again, put it in ~/usr/chromium/ and run:
sh grab-chromium.sh 59353
(59353 is a build of chromium that no build bot bugs show up, you can change it to any version you’d like to grab).

If you like to run chromium with a long list of parameters, just create another script. Mine is here:

#!/bin/sh
$HOME/usr/chromium/chromium-browser/chrome %U --disk-cache-dir="/dev/shm/browser.`whoami`.cache/chromium" --disk-cache-size=52428800

You can add it to your desktop’s menu.


Viewing all articles
Browse latest Browse all 17727

Trending Articles