You are not logged in.

#1 2015-08-21 16:57:21

edagar
Member
Registered: 2015-08-21
Posts: 3

Script that displays relevant news entries before running pacman -Syu

Hey everyone,

I recently wrote this simple python script, and as I've found it quite useful I thought I'd share it with you.

The script first reads the pacman.log file and finds the date of the last full system upgrade. It then iterates over the news entries in the archlinux.org RSS feed, and compare the publication date of the entries with the date of the last full system upgrade. News entries with a publication date after (more recent than) the most recent system upgrade are considered relevant. If no relevant news entries are found, the script simply runs "pacman -Syu".
Otherwise, the relevant posts are displayed and the user is prompted whether or not to proceed with the update.

The script can be found at http://tobiasrang.com/svn/archupdate/update.py

I'd love to hear any thoughts or feedback you might have.
/edagar

Offline

#2 2015-08-21 17:02:24

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Script that displays relevant news entries before running pacman -Syu

I'm subscribed to the arch-announce mailing list, which is very low volume. I update much more often :-)
There's https://www.archlinux.org/packages/comm … /pacmatic/

Offline

#3 2015-08-21 17:11:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: Script that displays relevant news entries before running pacman -Syu


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2015-08-21 17:23:19

edagar
Member
Registered: 2015-08-21
Posts: 3

Re: Script that displays relevant news entries before running pacman -Syu

karol wrote:

I'm subscribed to the arch-announce mailing list, which is very low volume. I update much more often :-)

This is a good point, and also why I wrote the script the way I did - to only display news that may be relevant to the current upgrade.

I suspected that similar tools were around, but i've never heard of pacnanny or pacmatic before.
I'll check them out. thanks smile

Offline

#5 2015-08-22 19:32:35

kriz
Member
Registered: 2009-06-29
Posts: 96

Re: Script that displays relevant news entries before running pacman -Syu

This is my update script function part for the last two news items

bgreen () {(tput bold; tput setaf 2)}
bred () {(tput bold; tput setaf 1)}
yellow () {(tput setaf 3)}

last_news_items () {
wget -O /tmp/al.rss https://www.archlinux.org/feeds/news/ 2>/dev/null
rsscat () {(cat /tmp/al.rss | xmlstarlet sel -T -t -v $1 )}
time=$(rsscat '/rss/channel/item[1]/pubDate')
title=$(rsscat '/rss/channel/item[1]/title')
description=$(rsscat '/rss/channel/item[1]/description')is
time2=$(rsscat '/rss/channel/item[2]/pubDate')
title2=$(rsscat '/rss/channel/item[2]/title')
description2=$(rsscat '/rss/channel/item[2]/description')
bgreen ; printf "$title" ; yellow ;echo "     ${time//+0000/}"
tput sgr0; echo "$description" | sed -e 's/<[^>]*>//g'
bgreen ; printf "$title2" ; yellow ;echo "     ${time2//+0000/}"
tput sgr0; echo "$description2" | sed -e 's/<[^>]*>//g'
rm /tmp/al.rss
}

„Je verdinglichter die Welt, je dichter das Netz, das der Natur überworfen wurde, desto mehr beansprucht ideologisch das Denken, das jenes Netz spinnt, seinerseits Natur, Urerfahrung zu sein." Theodor W. Adorno [aus: Wozu noch Philosopie]

Offline

#6 2015-08-24 12:53:45

edagar
Member
Registered: 2015-08-21
Posts: 3

Re: Script that displays relevant news entries before running pacman -Syu

kriz wrote:

This is my update script function part for the last two news items

bgreen () {(tput bold; tput setaf 2)}
bred () {(tput bold; tput setaf 1)}
yellow () {(tput setaf 3)}

last_news_items () {
wget -O /tmp/al.rss https://www.archlinux.org/feeds/news/ 2>/dev/null
rsscat () {(cat /tmp/al.rss | xmlstarlet sel -T -t -v $1 )}
time=$(rsscat '/rss/channel/item[1]/pubDate')
title=$(rsscat '/rss/channel/item[1]/title')
description=$(rsscat '/rss/channel/item[1]/description')is
time2=$(rsscat '/rss/channel/item[2]/pubDate')
title2=$(rsscat '/rss/channel/item[2]/title')
description2=$(rsscat '/rss/channel/item[2]/description')
bgreen ; printf "$title" ; yellow ;echo "     ${time//+0000/}"
tput sgr0; echo "$description" | sed -e 's/<[^>]*>//g'
bgreen ; printf "$title2" ; yellow ;echo "     ${time2//+0000/}"
tput sgr0; echo "$description2" | sed -e 's/<[^>]*>//g'
rm /tmp/al.rss
}

Cool. Thanks for sharing your implementation smile

Offline

Board footer

Powered by FluxBB