I just wanted to throw this out there, hoping to make a contribution to the community. It’s a Google Chrome update script, based in part on the Google Chrome Install Tutorial previously posted for Clear Linux. I know that in the tutorial it said to just rerun the install commands periodically or whenever you see a new update, but this script will poll the latest version from Google Chrome’s Omaha Proxy, compare it to the version of the installed executable, then offer to update the executable for you. I made the script interactive so that you can run it manually or from autostart, but it can easily be modified to remove all the interactive elements.
I cannot guarantee that changes in Omaha Proxy or a sudden escalation in magnitude of version numbers won’t necessitate a change in the script to acommodate. The script can probably use some more refinement.
#!/bin/bash
clear
divider="==============================\n"
latest=$(curl -s https://omahaproxy.appspot.com/linux)
current=$(/opt/google/chrome/google-chrome --version | cut -c15-)
printf "$divider \033[1mGoogle Chrome Update Check\033[0m\n$divider"
printf "Latest Version: $latest\n"
if [ $latest = $current ]
then
printf "Current Version: $current\n$divider \033[1m\e[32mGoogle Chrome is up to date.\033[0m\n"
else
printf "Current Version: \033[3m\e[31m$current\033[0m\n$divider \033[1m\e[31mUPDATE GOOGLE CHROME NOW!!\033[0m\n$divider"
read -n 1 -r -p "Do you want to update now? (y/n): " response
case $response in
[Yy]* )
printf "\n\n\033[1mDownloading:\033[0m\n\n";
curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm;
printf "\n\033[1mUpdating:\033[0m\n\n";
sudo rpm -U --nodeps google-chrome*.rpm;
rm -f google-chrome*.rpm;
printf "\n\033[1m\e[32mGoogle Chrome has been updated.\033[0m\n";;
* )
printf "\n\n\033[1m\e[31mPlease update soon!!!\033[0m\n";;
esac
fi
printf "\n"
For those running Gnome, I have the following .desktop for both autostart and applications folders:
Is there no way to use the official URL’s for this project? Using HTTP instead of HTTPS also makes it further insecure… What if the person who runs this stops updating this?
@ahkok, I’m glad you caught that. I just swapped in https and the script works just as well. Easy fix.
As for the official URL, I was under the impression that this was an official URL for the project status? It lists all of Chrome’s releases, by OS and channel. It’s also listed in the FAQ from Chromium:
Sorry for editing things on the fly, but I just noticed from that Chromium FAQ how I could get just the version number from Omaha Proxy rather than grepping / cutting it out of the raw data. Now I just need to do the same thing from the “google-chrome --version” command… I still worry that a version number shift is going to cause numbers to be dropped off the end using cut. More research needed.
Yeah both should be executable, I used chmod 777 on both files however when I ran that and when I ran the +X command the terminal didn’t return anything, maybe I have gone wrong somewhere.
The update script is unaltered and saved in “/home/steven/Documents/” with the filename “update-chrome.sh” and permissions have been granted -x. The terminal just opens and shuts immediately. I was wondering if it has anything to do with the fact I have enabled auto-login so my system doesn’t require a password?