LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Check for updates by Changelog.txt digest? (https://www.linuxquestions.org/questions/slackware-14/check-for-updates-by-changelog-txt-digest-4175631388/)

drgibbon 06-07-2018 01:43 AM

Check for updates by Changelog.txt digest?
 
I noticed recently that the 14.2 Changelog.txt is 471K, and that `slackpkg check-updates` looks for updates by downloading the whole file (checkchangelog in /usr/libexec/slackpkg/core-functions.sh). What do people think about the idea of having a Changelog.txt.md5 file that slackpkg can download and compare as an initial test for updates? The data transfer would be cut down to ~50 bytes. Doesn't seem like a huge difference in one instance (although it would be a little bit quicker), but it would add up to quite a bit across all Slackware users globally.

volkerdi 06-07-2018 01:40 PM

Excellent idea drgibbon. I've put together a proposed patch for slackpkg (still untested) that determines if the ChangeLog is different by comparing CHECKSUMS.md5.asc which is very small and if it hasn't changed we know the ChangeLog didn't change either. Really no need to introduce a new digest file specifically for the ChangeLog.

volkerdi 06-07-2018 01:43 PM

1 Attachment(s)
Here it is, for anyone that might want to test and verify that it works correctly.

Xsane 06-07-2018 01:50 PM

Quote:

Originally Posted by drgibbon (Post 5864565)
What do people think about the idea of having a Changelog.txt.md5 file that slackpkg can download and compare as an initial test for updates?

I use CHECKSUMS.md5.asc from the tree root. 163 bytes, WFM.

Edit:
Doh, outdrawn by BDFL.
These are not the droids you're looking for.

rworkman 06-07-2018 07:13 PM

https://git.rlworkman.net/slackpkg/c...484756e20ad0e8 :-)

drgibbon 06-07-2018 11:28 PM

Nice! I hadn't thought of just using the CHECKSUMS.md5 sig file, which is even better as there is nothing to change in the workflow :thumbsup:

Btw, I've updated the function on my system, so I'll see how it fares on the next 14.2 update.

gus3 06-08-2018 12:02 AM

Okay, I am now officially just a worm. I never thought to use other true flags.

But, really, I download ChangeLog.txt only once, after saving the prior ChangeLog.txt into ChangeLog.txt.orig. If their MD5 sums are the same, no update, so I delete ChangeLog.txt.orig and exit.

Then again, if their MD5 sums are different, I do a few rsync's to fetch the new trees for binaries and sources. Then I delete ChangeLog.txt.orig and exit.

But what if an rsync gets interrupted with Ctrl-C or X crashes or the power fails? Well, the ChangeLog.txt.orig still exists when I restart the update.sh script, so I skip all the other tests and just do the rsync's again.

How to force a fresh rsync, even if the remote stuff hasn't changed, just to be sure? It's easy:

$ echo blah >> ChangeLog.txt

then re-run update.sh.

It works for me.

GazL 06-08-2018 04:11 AM

For comparison, an rsync that pulls no changes comprises of around 170K transferred. I was just contemplating the idea of pulling down CHECKSUMS.md5.asc and launching the rsync only when necessary, but I get the feeling the protocol overhead associated with pulling the file down with ftp/http will probably negate a good part of the savings made by not running the rsync.

edit:

Ok, the html headers weren't as significant as I thought and I decided it might be worth it after all. Anyone who keeps a local mirror with rsync might be interested in this simple pre-test script:

Code:

#!/bin/bash

URL="https://slackware.uk/slackware/slackware64-current/CHECKSUMS.md5.asc"
FILE=/srv/slackware/slackware64-current/CHECKSUMS.md5.asc

same()
{
  md5sum --check --strict --status \
    <( md5sum < "$FILE" ) < <( curl -sS "$URL" )
}

if same ; then
  echo "Your mirror is up to date. No action necessary"
  exit 0
else
  echo "Your mirror is out of date. Resyncronise"
  exit 1
fi


Skaendo 06-08-2018 04:35 AM

1 Attachment(s)
Why on earth are you all not just plugging one of these: http://slackfeeds.sagredo.eu/ into a feed reader?

GazL 06-08-2018 05:44 AM

Quote:

Originally Posted by Skaendo (Post 5865017)
Why on earth are you all not just plugging one of these: http://slackfeeds.sagredo.eu/ into a feed reader?

Because you can't do something like the following with a feed-reader

check_updates || { resync_mirror && system_update ;}

Skaendo 06-08-2018 11:36 AM

Quote:

Originally Posted by GazL (Post 5865028)
Because you can't do something like the following with a feed-reader

check_updates || { resync_mirror && system_update ;}

Ok, I see your point. But I don't have to manually check for updates every {day,week,month,year}. I think that it's just one less headache because I don't have to constantly check. When I see my Slackware feed light up, I update, otherwise I don't worry.

GazL 06-08-2018 11:53 AM

Yep, both are valid approaches. Nothing wrong with RSS if that suits your workflow better.

drgibbon 06-09-2018 02:46 AM

I think that's one of the nice things about SlackwareŚwe have the option to do things our own way! For what it's worth, I also watch for Slackware updates over RSS (amongst other things like SBo, git repos, news, etc., using Newsboat*), but `slackpkg check-updates` is very convenient for scripting/cron jobs.

@volkerdi just tested the new code with the latest update, works well, cheers! :hattip:

*Not entirely related, but for those interested you can do some neat tricks with Newsboat. As I only use chromium from the alien repo I don't want to see all RSS updates, so I filter the feed like this:
Code:

# in ~/.newsboat/urls
http://www.slackware.com/~alien/slackbuilds/ChangeLog.rss

# in ~/.newsboat/config
ignore-article "http://www.slackware.com/~alien/slackbuilds/ChangeLog.rss" "content !~ \".*chromium:.*\""

Then updates will only show for chromium (obviously could be reworked for whatever programs). Works very nicely alongside tmux.

chrisretusn 06-09-2018 06:22 AM

Quote:

Originally Posted by GazL (Post 5865137)
Yep, both are valid approaches. Nothing wrong with RSS if that suits your workflow better.

Yep.

My approach? I use Alien Bob's mirror-slackware-current.sh script via a cron job to mirror:
slackware-current
Slackware64-14.2
slackware64-current

Get notified by email when it updates. Great for updating my other computers. Use RSS too for other Slackware stuff.


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