LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-14-2016, 07:36 AM   #16
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512

rurio --

I don't much cotton to the idea of auto-updating software on my Machines.

Been there, done that on an old RH Box and it made a mess and I wasn't sure how the mess was made nor what that mess was and finding and fixing it caused a four-hour outage on a customer's mission-critical Box.

Not to mention the disasters I see from time-to-time on customer's Windows Boxen.

Anyway, it's something I don't do any more if I can prevent it.

Another thing is I try to not write content to the HDD until I am ready to do something with it.

Enough philosophizing ... Let me say first of all that I really do like your google-chrome.SlackBuild script ( latest-chrome Version 1.3.3 )

It is much easier to use than the official one in Slackware64/extra/google-chrome/ because it checks for updates and it does the downloads automatically ( lazy-ole-me likes that ).

And I REALLY like the fact that I can build the package as a 'joe' ( no need to be root ).

Thanks for asking the question which made me look closely at latest-chrome to see what it actually does.

Now that I've looked at latest-chrome, there is no reason it couldn't be run as a cronjob.

My only suggestion would be to add an optional 'report-only' mode ( which is what I am after )

Something like this ...

Code:
let report_only = 0 ;   # default is 'build the package' but allow an override
#
# ... update_available is tested ...
#
if ( update_available == 0 ){ 
   if ( report_only != 1 ) {
      print "google-chrome is already installed" ; 
   } 
   exit 0 ;             # RetCode == 0 -> google-chrome is up-to-date
} 
#
# if running in 'report only mode' exit here
#
if ( report_only == 1 ) {
   print "google-chrome ($VERSION) is available"
   exit 1 ;             # RetCode == 1 -> an update is available
}
This way, I would get reminders until I am up-to-date but the latest-chrome won't bother to build the Package until I am ready for it.

But I don't want to mess with your script so that I can update it if ever needs an update.

That's why I created and installed `check-version-xml.sh` as a cronjob.

OTOH, if you want it, below is a patch which adds a -r ( or --report-only ) commandline arg to latest-chrome

When run in report-only mode, latest-chrome will simply check the version and ... if up-to-date then exit( 0 ) else { print a message ; exit( 1 ) }

Finally, speaking of cronjobs, I received an email from check-version-xml.sh this morning: google-chrome-53.0.2785.113-x86_64-1 is available

HTH ...

-- kjh

# diff -Naur latest-chrome latest-chrome.orig
Code:
--- latest-chrome-orig  2016-03-10 14:23:46.000000000 -0600
+++ latest-chrome       2016-09-14 07:02:33.440998762 -0500
@@ -29,8 +29,18 @@
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
+REPORT_ONLY=N      # default - same as always -- package up google-chrome
+#
+# Check if the user asked for report-only ...
+#
+if [ "$1" = "-r" -o "$1" = "--report-only" ]; then
+   REPORT_ONLY=Y
+   AUTO_INSTALL=N
+#
+# REPORT_ONLY and AUTO_INSTALL are mutually-exclusive ... elif works
+#
 # Check if the user asked for auto-install
-if [ "$1" = "-i" -o "$1" = "--install" ]; then
+elif [ "$1" = "-i" -o "$1" = "--install" ]; then
   if [ "$UID" = "0" ]; then
     AUTO_INSTALL=Y
   else
@@ -68,9 +78,22 @@
 
 # Don't start repackaging if the same version is already installed
 if /bin/ls /var/log/packages/google-chrome-$VERSION-* >/dev/null 2>&1 ; then
-  echo "Google Chrome ($VERSION) is already installed; exiting"
+  # 
+  # don't print when report-only mode
+  #
+  if [ "$REPORT_ONLY" != "Y" ] ; then
+     echo "Google Chrome ($VERSION) is already installed; exiting"
+  fi
+
   exit 0
 fi
+#
+# report only ... exit here
+#
+if [ "$REPORT_ONLY" = "Y" ] ; then
+   echo "Google Chrome ($VERSION) is available"
+   exit 1
+fi
 
 CWD=$(pwd)
 TMP=${TMP:-/tmp}

Last edited by kjhambrick; 09-14-2016 at 08:39 AM. Reason: spelling / grammar
 
Old 09-15-2016, 02:32 AM   #17
gda
Member
 
Registered: Oct 2015
Posts: 130

Rep: Reputation: 27
I also don't like automatic package updates....

I have the following bash script in my daily crontab which is very basic (for sure it can be improved!) but it works as I like .
It makes the following actions:
- get the latest google chrome version from the web (.deb file)
- check is the installed version is updated
- if not it generates the new slackbuild
- logs all the activities in a log file
- finally it informs the user about the new slackbuild (which is ready to be installed - manually - using upgradepkg)

It requires to have in the INSTALL_DIR the standard slackbuilds files (README, google-chrome.SlackBuild, slack-desc)

Code:
#!/bin/sh
INSTALL_DIR=/usr/local/chrome_update
LOG=/var/log/google_chrome_update.log

if [ ! -d $INSTALL_DIR ]; then
  echo "$(/bin/date), ERROR: directory $INSTALL_DIR not found!" >> $LOG
  exit 1
fi

GC=""
if [ -x /usr/bin/google-chrome ]; then
  GC=/usr/bin/google-chrome
elif [ -x /usr/bin/google-chrome-stable ]; then
  GC=/usr/bin/google-chrome-stable
fi

if [ -z "$GC" ] || [ ! -x "$GC" ]; then
  echo "$(/bin/date), WARNING: Could not detect an installed version of Google Chrome" >> $LOG
  exit 1
fi
 
cd $INSTALL_DIR

CURVERSION=$($GC --version | awk '{print $3}')
echo "$(/bin/date), INFO: Google Chrome installed: ${CURVERSION}" >> $LOG

case "$(uname -m)" in
  i?86) DEBARCH="i386";;
  x86_64) DEBARCH="amd64";;
  *) echo "$(/bin/date), INFO: Package for $(uname -m) architecture is not available." >> $LOG ; exit 1 ;;
esac

if [ -s google-chrome-stable_current_${DEBARCH}.deb ]; then
  rm -f google-chrome-stable_current_${DEBARCH}.deb
fi

echo "$(/bin/date), INFO: Searching for an updated Google Chrome version..." >> $LOG
echo "google-chrome-stable_current_${DEBARCH}.deb"
/usr/bin/curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_${DEBARCH}.deb

NEWVERSION=$(/usr/bin/bsdtar xqOf google-chrome-stable_current_${DEBARCH}.deb control.tar.gz | /usr/bin/bsdtar -xOf- control | /bin/sed -n "s/^Version: \([0-9.]*\)-.*/\1/p")

if [ "${CURVERSION}" = "${NEWVERSION}" ]; then
  echo "$(/bin/date), INFO: Google Chrome already updated!" >> $LOG
  rm -f google-chrome-stable_current_${DEBARCH}.deb
  exit 0
fi

./google-chrome.SlackBuild > /tmp/google_chrome_build
FILENAME=$(/bin/tail -n 2 /tmp/google_chrome_build | grep "Slackware package" | awk '{print $3}')

echo "$(/bin/date), INFO: New version of Google Chrome (${NEWVERSION}) found!" >> $LOG
echo "$(/bin/date), INFO: Slackware package is available at: ${FILENAME}" >> $LOG
echo "New version of Google Chrome (${NEWVERSION})." > /tmp/google_chrome_msg
echo "Slackware package is available at:" >> /tmp/google_chrome_msg
echo "${FILENAME}" >> /tmp/google_chrome_msg

wall /tmp/google_chrome_msg

rm -f /tmp/google_chrome_msg
rm -f /tmp/google_chrome_build
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Chrome OS is not dead, insists Google veep in charge of Chrome OS LXer Syndicated Linux News 0 10-31-2015 05:11 AM
LXer: Google Releases Chrome 44 Stable for Windows, Mac OS X, Linux, and Chrome OS LXer Syndicated Linux News 0 07-21-2015 07:03 PM
Google Chrome New Tab Page (!)= Chrome OS Desktop Kenny_Strawn Linux - General 6 02-19-2011 05:36 PM
LXer: As Goes Chrome OS, So Goes Google's Chrome Browser LXer Syndicated Linux News 4 10-09-2010 03:18 PM
LXer: Google Chrome Automatically Installs Google Repository in Ubuntu LXer Syndicated Linux News 3 05-07-2010 11:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration