Skip to content

Instantly share code, notes, and snippets.

@tenforward
Last active December 22, 2023 07:00
Show Gist options
  • Save tenforward/b488c043f7dfcf150fb0b8cf0f26c156 to your computer and use it in GitHub Desktop.
Save tenforward/b488c043f7dfcf150fb0b8cf0f26c156 to your computer and use it in GitHub Desktop.
#!/bin/bash
INSTALLED_VERSION=$(head -n 1 /var/log/packages/google_chrome | awk '{ print $3 }' | sed -e 's/google_chrome-//' -e 's/-x86_64-B.//')
url="https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm"
pkgbase="google_chrome"
compress=tzst
arch=$(uname -m)
logger "start update-chrome.sh"
cd /tmp
source /usr/share/plamobuild_functions.sh
P=/tmp/chrome
get_current_version()
{
curl -s "https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Linux&num=1" | jq -r .[].version
}
CURRENT_VERSION=$(get_current_version)
convert_package()
{
rpm2tar ${url##*/}
if [ -x /usr/bin/rpm ]; then
vers=$(rpm -qpi google-chrome-stable_current_x86_64.rpm 2>/dev/null | egrep '^Version' | awk '{ print $3 }')
else
vers="stable"
fi
check_root
if [ -d $P ]; then
rm -rf $P
fi
mkdir -p $P
tar xf $W/$(basename ${url##*/} .rpm).tar -C $P
rm -rf $P/etc
rm -rf $P/usr/share/gnome-control-center
install_tweak
convert_links
cd $P
/sbin/makepkg /tmp/google_chrome-"$vers"-"$arch"-B1.$compress <<EOF
y
1
EOF
}
if [ $CURRENT_VERSION != $INSTALLED_VERSION ]; then
download_sources
convert_package
updatepkg -f /tmp/google_chrome-"$vers"-"$arch"-B1.$compress
rm -f /tmp/$(basename ${url##*/} .rpm).{rpm,tar}
notify-send -u normal "Google Chrome Info" "google chrome is updated."
else
notify-send -u low "Google Chrome Info" "google chrome is up-to-date."
fi
logger "end update-chrome.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment