LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   updating google chrome (https://www.linuxquestions.org/questions/slackware-14/updating-google-chrome-4175589197/)

tramni1980 09-11-2016 12:52 AM

updating google chrome
 
Hello,
I am using google-chrome as a default browser. Because it is not part of stock Slackware (only found in extra), there are no official Slackware updates for it. So I regularly check for a new version of google-chrome and then run the SlackBuild on it. However, it is sometimes cumbersome to find out whether I am actually running the latest version, as version numbers are not explicitly part of the package name of the precompiled binaries. My question is, is there an easy straightforward way to find out whether the Chrome version I am running is the latest? I tried so far Help -> About Google Chrome, but only the version installed is written there, without any hint whether this is actually the latest version.

Thank you very much for your attention.

Best regards,
Martin

bassmadrigal 09-11-2016 01:00 AM

This script will be your best friend :) Although, I don't think it has a way to test if you're running the latest version without building a new package if you're not. You can also have it automatically install it with the -i option.

https://gist.github.com/ruario/9672759

jamison20000e 09-11-2016 03:16 AM

Being that it's google try searching... eg: what is the latest version of google chrome ::: https://www.whatismybrowser.com/guid...version/chrome

tramni1980 09-11-2016 03:41 AM

Thank you all, this web site was all I needed.
@jamison20000e: Thanks a lot, I googled a lot but I could not find that page before you posted it to me here.

GazL 09-11-2016 04:37 AM

Oddly, if you put "google chrome stable release" into google, it returns Linux-47.0.2526.106 at the top of the search results, which is clearly not the latest.

Personally, I keep an eye on https://googlechromereleases.blogspot.co.uk/

kjhambrick 09-11-2016 07:07 AM

Quote:

Originally Posted by jamison20000e (Post 5603590)
Being that it's google try searching... eg: what is the latest version of google chrome ::: https://www.whatismybrowser.com/guid...version/chrome

Nice link jamison20000e !

Below is a commandline script to extract the version from the text in the page.

Added ~/bin/get-latest-google-chrome to my Package Management 'arsenal' :)

# run the script:
Code:

bin/get-latest-google-chrome
# get this output:
Code:

53.0.2785.101
I like your link better than ruriaro's script that bassmadrigal linked for this purpose because like tramni1980, all I want to know is 'what's the latest ?' and I don't have to download the latest ~50MB .rpm package to find out 'what is the latest version of google-chrome ?'

Thanks again !

-- kjh

# this is get-latest-google-chrome
Code:

#!/bin/sh
#
# thanks to jamison20000e for the link ( see below, Url= )
#
# http://www.linuxquestions.org/questions/slackware-14/updating-google-chrome-4175589197/#post5603590
#
# if the script ever breaks, check the settings of Url and REx ...
#
# to check the Url: 
#
# wget https://www.whatismybrowser.com/guides/the-latest-version/chrome -qO -
#
# If that returns nothing, the Url has changed.  Fix the Url
#
# Otherwise, the REx may have changed and fixing the REx is a 'reader exercise'
#
Url="https://www.whatismybrowser.com/guides/the-latest-version/chrome" # fix me ?
REx="^ *<h2>the latest version of chrome is:.*</h2>"                  # fix me ?
Ret="0"

Ver="$(wget "$Url" -qO - | \
      grep -i "$REx"    | \
      sed -e 's/^.*: *//' \
          -e 's/<.*$//')"

[ "$Ver" = "" ] && Ret=1

echo "$Ver"
exit $Ret


kjhambrick 09-11-2016 08:42 AM

hmmm ...

Looking at rurio's script ( line 54 ), the version could be determined with a remote `rpm query` on the url ( which only downloads the rpm header ):

Below is the output from the `rpm -qi -p <<URL>>` command and a script wrapper that constructs a Slackware Package Name from the rpm info header.

I called the script get-latest-google-chrome.

This is the command line and the output:
Code:

# bin/get-latest-google-chrome

google-chrome-53.0.2785.101-x86_64-1

Note that the output from jamison20000e's script is still faster ...

-- kjh

# check the rpm command
Code:

rpm -qi -p https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
#
# which returns:
#
warning: https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
Name        : google-chrome-stable
Version    : 53.0.2785.101
Release    : 1
Architecture: x86_64
Install Date: (not installed)
Group      : Applications/Internet
Size        : 189953467
License    : Multiple, see https://chrome.google.com/
Signature  : DSA/SHA1, Tue Sep  6 21:02:28 2016, Key ID a040830f7fac5991
Source RPM  : google-chrome-stable-53.0.2785.101-1.src.rpm
Build Date  : Tue Sep  6 20:21:57 2016
Build Host  : lin64-3-m0.official.chromium.org
Relocations : /opt
Packager    : Chrome Linux Team <chromium-dev@chromium.org>
Vendor      : Google Inc.
URL        : https://chrome.google.com/
Summary    : Google Chrome
Description :
The web browser from Google

Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.

#
# This is one way to set the Slackware Package Name straight from the horses mouth ( google.com's rpm info header ):
#
# I called the script get-latest-google-chrome and then did: chmod 755 get-latest-google-chrome
#
Code:

#!/bin/sh

Url="https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm"

rpm -qi -p "$Url" 2>/dev/null | \
gawk '
BEGIN {

  FS  = ":"
  Ver = Rel = Arch = ""
  Got = 0
}
# main
{
  if ( Got == 3 )
  {
      exit( 0 )
  }
  if ( $1 ~ /^ *Version/ )        # that is a tilde, not a dash
  {
      Got ++
      Ver = $2
      gsub( /^ */, "", Ver )
      next
  }
  if ( $1 ~ /^ *Release/ )        # that is a tilde, not a dash
  {
      Got ++
      Rel = $2
      gsub( /^ */, "", Rel )
      next
  }
  if ( $1 ~ /^ *Architecture/ )  # that is a tilde, not a dash
  {
      Got ++
      Arch = $2
      gsub( /^ */, "", Arch )
      next
  }
}
END {

  if (( Got == 3 ) && ( Ver != "" ) && ( Rel != "" ) && ( Arch != "" ))
  {
      print "google-chrome-" Ver "-" Arch "-" Rel
      exit( 0 )
  }
  exit( 1 )
}'
exit $?


bassmadrigal 09-11-2016 09:42 AM

Quote:

Originally Posted by kjhambrick (Post 5603687)
hmmm ...

Looking at rurio's script ( line 54 ), the version could be determined with a remote `rpm query` on the url ( which only downloads the rpm header ):

That wget command doesn't download the whole file. It just outputs the version almost immediately. Depending on if you don't want to sift through all the information on the rpm -qi -p output, you could just use his wget command.

Code:

jbhansen@craven-moorhead:~$ wget -qO- https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm | head -c96 | strings | rev | awk -F"[:-]" '/emorhc/ { print $1 "-" $2 }' | rev
53.0.2785.101-1


kjhambrick 09-11-2016 01:43 PM

Good call bassmadrigal !

I missed `... | head -c96 | ...` in ruario's pipeline.

That would be even quicker than the `rpm -il -p <<URL>>` command !

Thanks for that !

I do like looking at the google site for the VERSION Setting since the 3rd party site could change or even 'disappear'.

Thanks again.

-- kjh

ruario 09-13-2016 05:09 AM

In addition to my script, here is a one liner that I provided to the Chrome maintainer on Arch a few years back to quickly check the version numbers for all Chrome streams. It works by extracting the info from the RPM YUM/DNF repository:

Code:

wget -qO- https://dl.google.com/linux/chrome/rpm/stable/x86_64/repodata/other.xml.gz | zcat | awk -F\" '/pkgid/{ sub(".*-","",$4); print $4": "$10 }'

ruario 09-13-2016 07:36 AM

Quote:

Originally Posted by kjhambrick (Post 5603655)
I like your link better than ruriaro's script that bassmadrigal linked for this purpose because like tramni1980, all I want to know is 'what's the latest ?' and I don't have to download the latest ~50MB .rpm package to find out 'what is the latest version of google-chrome ?'

Yeah that would be dumb, which is why my script does NOT do that either. It only downloads, if there is a new version. If there isn't it simply tells you you have the latest version and prints that version number on screen.

ruario 09-13-2016 07:49 AM

Quote:

Originally Posted by ruario (Post 5604520)
In addition to my script, here is a one liner that I provided to the Chrome maintainer on Arch a few years back to quickly check the version numbers for all Chrome streams. It works by extracting the info from the RPM YUM/DNF repository:

Code:

wget -qO- https://dl.google.com/linux/chrome/rpm/stable/x86_64/repodata/other.xml.gz | zcat | awk -F\" '/pkgid/{ sub(".*-","",$4); print $4": "$10 }'

By the way, you can also do the same trick with the Deb APT repository (not that it makes much difference as the .rpm and .deb version numbers are always in sync):

Code:

wget -qO- https://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages.gz | zcat | awk -F "[ -]" '/Package: google-chrome/{print $4":";getline;print $2}'
P.S. I first wrote these kinds of tricks in January 2012 as a little rant on my blog:

https://web.archive.org/web/20140301...ersion-numbers

I have since changed my stance somewhat, but the basis for all these tricks is there in the blog post and comments. ;)

kjhambrick 09-13-2016 08:36 AM

Quote:

Originally Posted by ruario (Post 5604562)
Yeah that would be dumb, which is why my script does NOT do that either. It only downloads, if there is a new version. If there isn't it simply tells you you have the latest version and prints that version number on screen.

Yes, I missed the ... | head -c 96 | ... when checking for an update.

I've been running slackware64/extra/google-chrome/google-chrome.SlackBuild since I installed this Laptop.

After looking at your script, I may switch over to your's :)

Thanks ruario !

-- kjh

kjhambrick 09-13-2016 08:50 AM

Quote:

Originally Posted by ruario (Post 5604567)
By the way, you can also do the same trick with the Deb APT repository (not that it makes much difference as the .rpm and .deb version numbers are always in sync):

Code:

wget -qO- https://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages.gz | zcat | awk -F "[ -]" '/Package: google-chrome/{print $4":";getline;print $2}'
P.S. I first wrote these kinds of tricks in January 2012 as a little rant on my blog:

https://web.archive.org/web/20140301...ersion-numbers

I have since changed my stance somewhat, but the basis for all these tricks is there in the blog post and comments. ;)

Thanks again ruario.

Lot's to digest in your blog entry !

I'll take a look.

One sentence that stood out is that you said that chromium and google-chrome are different beasts ( :) something like that :) )

Yes they are different beasts !

I've got both Alien Bob's chromium and google-chrome from Slackware's google-chrome.SlackBuild installed.

I get Hardware Acceleration ( excluding the 'usual' exceptions for Linux ) with google-chrome but none at all for chromium ( 14.2 + Multilib + NVidia Blob ).

Something to investigate one of these days ...

-- kjh
#
# Playing ... Here is a modification of your command ( including your 'tag' that returns the package name as in /var/log/packages/google-chrome-*
#
Code:

# TAG=ro ; wget -qO- https://dl.google.com/linux/chrome/rpm/stable/x86_64/repodata/other.xml.gz | zcat | awk -F\" '/google-chrome-stable/{ print "google-chrome-" $10 "-" $6 "-" $12 "'"$TAG"'" }'

google-chrome-53.0.2785.101-x86_64-1ro

#
# this is the same commandline, but for the Slackware64/extra/ version:
#
Code:

# TAG="" ; wget -qO- https://dl.google.com/linux/chrome/rpm/stable/x86_64/repodata/other.xml.gz | zcat | awk -F\" '/google-chrome-stable/{ print "google-chrome-" $10 "-" $6 "-" $12 "'"$TAG"'" }'

google-chrome-53.0.2785.101-x86_64-1

#
# this format would make it easy to compare 'available' to 'installed' = $(basename "$(ls -1 /var/log/packages/google-chrome-*)") via a cronjob ...

ruario 09-14-2016 01:46 AM

Quote:

Originally Posted by kjhambrick (Post 5604582)
# this format would make it easy to compare 'available' to 'installed' = $(basename "$(ls -1 /var/log/packages/google-chrome-*)") via a cronjob ...

Can I ask why you want to do that in a cron job? What is the next step, install the new version if there is one? If yes, then my script already does this. Just call it with -i (for "install") and stick it in a cron job. If there is a new version it will download and install it, if not nothing will happen.


All times are GMT -5. The time now is 03:04 PM.