Email notification on package updates?

tamenaka

New Member


Messages: 3

I read in the handbook that you can be notified of system updates (via mail to root user) with a line in /etc/crontab

I've also seen that there are mailing lists for ports updates. The problem is that this would (unless I've missed something?) send me mails for any update to any package.

But what if I want to receive emails only for specific packages? Or better yet, all packages I've actually installed on my system?

Can you help me with this?

Thanks!
 

grahamperrin

Son of Beastie

Reaction score: 1,050
Messages: 3,528

Welcome to FreeBSD Forums.

… to receive emails only for specific packages…

FreshPorts:

1641497172171.png


<https://www.freshports.org/faq.php#watch-add>

<https://www.freshports.org/watch-list-maintenance.php>
 
OP
T

tamenaka

New Member


Messages: 3

Thanks for the reply!

Is there any way to get a notification directly from the system, as opposed to a 3rd party? It also doesn't feel quite optimal to have to subscribe to every package explicitly, since you might not always remember to update your subscriptions when you add/remove packages on your OS. Not to mention little dependency packages and whatnot which might also be updated, that you might not really know too much about.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,141
Messages: 39,753

The daily security emails already have some checks:
Code:
Checking for packages with security vulnerabilities:
Database fetched: Tue Dec 28 03:50:16 CET 2021
apache24-2.4.51

Checking for packages with mismatched checksums:
Don't worry, this is an old email I fished out of my mail folders, it's just to show you what's already there.
 

covacat

Daemon

Reaction score: 536
Messages: 1,098

if you use the 'latest' repo
you can run something like this from cron
pkg update && pkg version -UR|grep '<$'
 

grahamperrin

Son of Beastie

Reaction score: 1,050
Messages: 3,528

… packages I've actually installed …

pkg version -vRL=

pkg-version(8)

Throwing you in at the deep end (!), an example of unusual output:

Code:
% date ; uname -KU
Thu  6 Jan 2022 21:45:52 GMT
1400045 1400045
% pkg -vv | grep -e url -e enabled
    url             : "http://pkg0.pkt.freebsd.org/FreeBSD:14:amd64/latest",
    enabled         : yes,
    url             : "https://alpha.pkgbase.live/current/FreeBSD:14:amd64/latest",
    enabled         : no,
    url             : "file:///usr/local/poudriere/data/packages/main-default",
    enabled         : yes,
% sudo pkg version -vRL=
grahamperrin's password:
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating poudriere repository catalogue...
poudriere repository is up to date.
All repositories are up to date.
FreeBSD-clibs-14.snap20210513182414 ?   orphaned: base
anydesk-6.0.1_1                    ?   orphaned: deskutils/anydesk
citrix_ica-13.10.0                 ?   orphaned: net/citrix_ica
festlex-oald-1.4.1_1               ?   orphaned: audio/festlex-oald
gedkeeper-2.18.0                   ?   orphaned: misc/gedkeeper
gnuit-4.9.5_5                      ?   orphaned: misc/gnuit
kde-icons-black-and-white-2.0.a    ?   orphaned: x11-themes/kde-icons-black-and-white
linux-wps-office-11.1.0.10161      ?   orphaned: editors/linux-wps-office
riot-web-1.7.1                     ?   orphaned: www/riot-web
waterfox-2019.12.c                 ?   orphaned: www/waterfox
%
 

grahamperrin

Son of Beastie

Reaction score: 1,050
Messages: 3,528

… ports updates …

If you intend to build anything from ports: you can keep half an eye on the list of updates that flies by during an update to your copy of the repository.

It's not a methodical approach – not focused on what's installed – but I do enjoy the serendipity. I'll sometimes stumble across a new port, or something previously undiscovered, through speed-reading the list.

Nothing of interest to me today:

1641506367621.png

– I mean, nothing of interest in the ports repo. The src repo is much more exciting :cool:
 
OP
T

tamenaka

New Member


Messages: 3

The daily security emails already have some checks:
Code:
Checking for packages with security vulnerabilities:
Database fetched: Tue Dec 28 03:50:16 CET 2021
apache24-2.4.51

Checking for packages with mismatched checksums:
Don't worry, this is an old email I fished out of my mail folders, it's just to show you what's already there.
Thanks for bringing this to my attention. I'm coming from just recently getting acquainted with OpenBSD, and I didn't realize FreeBSD had daily reports like this as well. I am looking into setting up mailing to forward root mails to an external mail right now for more convenient monitoring of this. Hopefully the reports will suffice for the info I want. I've also thought about writing a simple bash script to just do both freebsd-update cron + pkg upgrade --dry-run and mail the output as an alternative, should this fail. I hope I'm going in the right direction with this...

Is there also a way to list major version upgrades? For example, if I've installed PHP 8.1 at one point, and later on PHP 8.2 or even 9.0 is released, is there a way you could determine when FreeBSD has a port available for that also? Or would for example pkg upgrade typically simply tell you if a package is obsoleted (no longer supported by original developers, etc.)?
 

monwarez

Active Member

Reaction score: 75
Messages: 165

It can be done (here check-update is an alias to version -RvL= )
pkg check-update | grep "<" | awk '{print $1" update to " substr($7,0,length($7)-1)}'

It need some re-work to separate the version from the pkg name although.
Here the rework (hum, it fail for package that have - in their name, we need to get the last index of -)
pkg check-update | grep "<" | awk '{print substr($1,0,index($1,"-")-1),substr($1,index($1,"-")+1) , "update to" , substr($7,0,length($7)-1)}'

Nothing that a rev cannot do (I am too lazy to find an only awk solution)
pkg check-update | grep "<" | rev | awk '{print substr($1,2),substr($7,0,index($7,"-")-1),substr($7,index($7,"-")+1)}' | rev | awk '{print $1,$2,"update to",$3}'
 

grahamperrin

Son of Beastie

Reaction score: 1,050
Messages: 3,528

Thanks, sorry, I meant something to filter, to list only major updates i.e. 369 to 370, or 5.something to 6.something.

The developer might not think of it as a major update, but it's, like, a change to the integer.
 
Top