File update_chromium of Package chromium.openSUSE_13.1_Update

#!/bin/sh

# Parse the command line option (only version is required)
new_chrome_version=$1;

old_chrome_version=`cat chromium.spec | grep 'Version:' | awk {'print $2'}`
old_pnacl_version=`cat chromium.spec | grep 'pnacl_version' | awk {'print $3'}`
old_nacl_version=`cat chromium.spec | grep 'newlib_version' | awk {'print $3'}`
old_glibc_version=`cat chromium.spec | grep 'glibc_version' | awk {'print $3'}`

sed -i "s|${old_chrome_version}|${new_chrome_version}|g" chromium.spec

rm chromium-*.tar.xz
# Get the new chromium tarball
wget http://commondatastorage.googleapis.com/chromium-browser-official/chromium-${new_chrome_version}.tar.xz

# Unpack the chromium tarball and check which NaCl versions it requires
tar -Jxf chromium-${new_chrome_version}.tar.xz chromium-${new_chrome_version}/native_client/TOOL_REVISIONS

# Update the chromium spec-file so that it download the right NaCl tarballs
pnacl_version=`cat chromium-${new_chrome_version}/native_client/TOOL_REVISIONS | grep 'PNACL_VERSION' | awk -F = {'print $2'}`
sed -i "s|pnacl_version $old_pnacl_version|pnacl_version $pnacl_version|g" chromium.spec
nacl_version=`cat chromium-${new_chrome_version}/native_client/TOOL_REVISIONS | grep 'NEWLIB_VERSION' | awk -F = {'print $2'}`
sed -i "s|newlib_version $old_nacl_version|newlib_version $nacl_version|g" chromium.spec
glibc_version=`cat chromium-${new_chrome_version}/native_client/TOOL_REVISIONS | grep 'GLIBC_VERSION' | awk -F = {'print $2'}`
sed -i "s|glibc_version $old_glibc_version|glibc_version $glibc_version|g" chromium.spec

rm toolchain_linux_x86.tar.bz2
rm nacl*tgz
# Update all tarballs
wget http://commondatastorage.googleapis.com/nativeclient-archive2/x86_toolchain/r${glibc_version}/toolchain_linux_x86.tar.bz2
wget http://commondatastorage.googleapis.com/nativeclient-archive2/toolchain/${nacl_version}/naclsdk_linux_x86.tgz
wget http://commondatastorage.googleapis.com/nativeclient-archive2/toolchain/${pnacl_version}/naclsdk_pnacl_linux_x86.tgz
wget http://commondatastorage.googleapis.com/nativeclient-archive2/toolchain/${pnacl_version}/naclsdk_pnacl_translator.tgz

# Cleanup 
rm -rf chromium-${new_chrome_version}
# Edit the ChangeLog
osc vc -m"Update to Chromium ${new_chrome_version}"

# Remove and add the new tarballs
osc addremove 
#osc ci -m"New Update"
openSUSE Build Service is sponsored by