You are not logged in.

#1 2014-07-08 14:58:41

HiImTye
Member
From: Nanaimo, BC, Canada
Registered: 2012-05-09
Posts: 930

How do you track updates?

I would be interested to see the problems resulting from actually running an -Syu after not running one for such a long period of time. I've seen multiple threads started here that resulted from not ever running it and then suddenly doing so

re: running it every hour to see if there's an update, I just have cron check hourly and conky tell me if there's Arch or AUR updates


# Split off from a TGN'ed thread...

Last edited by jasonwryan (2014-07-08 22:58:50)

Offline

#2 2014-07-08 15:18:35

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,923
Website

Re: How do you track updates?

HiImTye wrote:

I just have cron check hourly and conky tell me if there's Arch or AUR updates

You mean with "/usr/bin/checkupdates"? I do that too. It's sooo much nicer having conky just tell me if I need to do an update. smile

Offline

#3 2014-07-08 15:23:35

HiImTye
Member
From: Nanaimo, BC, Canada
Registered: 2012-05-09
Posts: 930

Re: How do you track updates?

no, I use a custom script because when I wrote it I couldn't find any built-in mechanism to check it and it works without any problems so I haven't changed it

Offline

#4 2014-07-08 15:37:02

jjacky
Member
Registered: 2011-11-09
Posts: 344
Website

Re: How do you track updates?

HiImTye wrote:

no, I use a custom script because when I wrote it I couldn't find any built-in mechanism to check it and it works without any problems so I haven't changed it

Note that this can cause issues, because if you don't do a sysupgrade right after, you have still sync-ed your dbs, so your next install (-S) is really a -Sy which isn't good. Hence checkupdates.

(Also it seems your script can't deal with updates for both (repo) packages & AUR packages at the same time. Also grep can count (-c) then you can drop the `|wc -l`)

Offline

#5 2014-07-08 15:56:07

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,136

Re: How do you track updates?

I tried updating a rarely used machine from a year later, and kabooley, it wanted all kinds of intermediate packages and their dependencies.  I just reinstalled from scratch, it wasn't an essential install.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#6 2014-07-08 16:09:06

HiImTye
Member
From: Nanaimo, BC, Canada
Registered: 2012-05-09
Posts: 930

Re: How do you track updates?

jjacky wrote:

Note that this can cause issues, because if you don't do a sysupgrade right after, you have still sync-ed your dbs, so your next install (-S) is really a -Sy which isn't good. Hence checkupdates.

the man page says that it doesn't actually do anything

       -p, --print
           Only print the targets instead of performing the actual operation (sync, remove or upgrade). Use --print-format to specify how targets are
           displayed. The default format string is "%l", which displays URLs with -S, filenames with -U and pkgname-pkgver with -R.
jjacky wrote:

(Also it seems your script can't deal with updates for both (repo) packages & AUR packages at the same time.

that's OK, my conky script uses human language (i.e. "2 AUR Updates Available!"), so it doesn't need to display both

jjacky wrote:

Also grep can count (-c) then you can drop the `|wc -l`)

good to know, I hadn't considered that before now. I'm always finding little shortcuts to trim my one liners wink

Offline

#7 2014-07-08 16:11:08

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 6,816

Re: How do you track updates?

The 'p' affects the 'u' portion, not the 'y' portion. You're syncing the databases to be able to get the list.

Offline

#8 2014-07-08 16:32:19

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,923
Website

Re: How do you track updates?

The other reason to use the official "checkupdates" application is because if conky is checking for updates then you won't be able to use pacman to install or remove software.

...which is rare that it would ever happen, but it could happen! tongue

Offline

#9 2014-07-08 17:48:13

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,136

Re: How do you track updates?

drcouzelis wrote:

The other reason to use the official "checkupdates" application is because if conky is checking for updates then you won't be able to use pacman to install or remove software.

...which is rare that it would ever happen, but it could happen! tongue

It might conk your system!


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#10 2014-07-08 17:52:34

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: How do you track updates?

jjacky wrote:

Also grep can count (-c) then you can drop the `|wc -l`)

<head explodes>

Thank you for posting!

Offline

#11 2014-07-08 19:50:34

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: How do you track updates?

HiImTye wrote:

no, I use a custom script because when I wrote it I couldn't find any built-in mechanism to check it and it works without any problems so I haven't changed it

I slapped together pretty much the same thing a couple weeks ago, but with the reasons jakobcreutzfeldt mentioned in mind:

#!/usr/bin/env bash

#  Run '/usr/bin/checkupdates' to get a count of the number of pending package
#  updates. If the number is 20 or greater, or a kernel update is pending, print
#  the number of updates to the statusbar and send a pop-up notification.
#  Otherwise, exit silently.

pkg=$(checkupdates | wc -l)
kernel=$(checkupdates | grep -c ^linux$)

if [ "$pkg" -lt 20 ] && [ "$kernel" -eq 0 ]; then
    exit 0
elif [ "$pkg" -ge 20 ] || [ "$kernel" -ge 1 ]; then
    notify-send "Pending updates:" "$(checkupdates)";
    echo "PACKAGES: [ $pkg ]"
fi

'grep -oc linux' would obviously catch any package with "linux" in the name, but since the kernel and headers are updated more often than all the rest I got lazy. tongue

EDIT: I also use "alias pacin=sudo pacman -Syu", so if I install a package from the official repos the system just gets updated as a matter of course.

EDIT2: Updated with slithery's recommendation.

Last edited by ANOKNUSA (2014-07-08 21:42:58)

Offline

#12 2014-07-08 21:20:23

Slithery
Forum Moderator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 2,592

Re: How do you track updates?

ANOKNUSA wrote:

'grep -oc linux' would obviously catch any package with "linux" in the name

grep -oc ^linux$

No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#13 2014-07-08 21:41:51

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: How do you track updates?

slithery wrote:
ANOKNUSA wrote:

'grep -oc linux' would obviously catch any package with "linux" in the name

grep -oc ^linux$

Awesome, thanks a lot. And while testing your recommendation I realized that the '-o' flag output is suppressed when using '-c' anyway, so 'grep -c' is all that's needed.

Offline

#14 2014-07-08 21:58:19

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 24,810
Website

Re: How do you track updates?

ANOKNUSA wrote:

I slapped together pretty much the same thing a couple weeks ago...

Why rerun checkupdates when you can just read from the db? Run checkupdates as a cron job every $x hours, and poll the /tmp db every $x minutes for your statusbar.

pup="$(pacman -Qqu --dbpath /tmp/checkup-db-jason/ | wc -l)"
if (( pup > 0 )); then
   echo -en "$pup"
else
    echo "0"
fi

Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#15 2014-07-08 22:12:12

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,716

Re: How do you track updates?

slithery wrote:
ANOKNUSA wrote:

'grep -oc linux' would obviously catch any package with "linux" in the name

grep -oc ^linux$

Of course, that would only match the linux package. Try

grep -c '\<linux\>'

This silver ladybug at line 28...

Offline

#16 2014-07-09 01:42:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 19,055
Website

Re: How do you track updates?

@ANOKNUSA, as you specify bash as the interpreter, there is no reason to use the separate process `[' for the tests - use the `[[' bash builtin.  This will save spawning a few extra sub-processes.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#17 2014-07-09 02:48:01

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: How do you track updates?

jasonwryan wrote:

Why rerun checkupdates when you can just read from the db? Run checkupdates as a cron job every $x hours, and poll the /tmp db every $x minutes for your statusbar.

Good call. It's pretty senseless to run 'chekcupdates' more than once. As for the statusbar, my statusline is dynamically built using i3blocks. All "blocks" are separate scripts run independently at different intervals; only the clock and a task reminder are shown constantly, while everything else only appears when certain conditions are met. My 'pkgup' script runs once every four hours and only provides output when the number of updates reaches 20+ or a kernel update is available, so I may as well just update the temporary database within the script.

@lolilolicon: linux and linux-headers get updated simultaneously, so I only need to know when one package is ready.
@ Trillby: Thanks. I suppose since the package counts are integers I don't need the double quotes either.

Offline

#18 2014-07-09 04:41:36

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,716

Re: How do you track updates?

ANOKNUSA wrote:

@lolilolicon: linux and linux-headers get updated simultaneously, so I only need to know when one package is ready.

Ah I see, you only want to catch the kernel packages. This seems to be a reasonable assumption; I think it's more reliable to catch the linux-*-headers packages, if you have installed other kernels such as linux-lts (which you want to catch too), since there are packages like linux-howtos. It seems linux-api-headers should be excluded too.

pcregrep '^linux(-[^-\s]+)*(?<!-api)-headers$'

EDIT: except if you don't have the corresponding -headers package installed hmm
EDIT²: https://xkcd.com/1313/

Last edited by lolilolicon (2014-07-09 04:49:38)


This silver ladybug at line 28...

Offline

Board footer

Powered by FluxBB