You are not logged in.

#1 2017-04-20 22:18:36

mjiricka
Member
Registered: 2017-04-20
Posts: 10

archnews: Yet another Arch news utility

Hello!

I was looking for an utility that would quickly show the Arch Linux news feed in command line before I upgrade my system. A long time ago I tried pacmatic, but did not like it. Also other utilities I found did not suit my needs. So I wrote this one:

https://github.com/mjiricka/archnews

It's in pure Python 3 and has many command line options. So maybe somebody else would be interested? :-)

MJ

Offline

#2 2017-04-21 07:43:50

phw
Member
Registered: 2013-05-27
Posts: 318

Re: archnews: Yet another Arch news utility

This is pretty cool, clean and simple. I like it and very useful. I seldom look at the news before updating, usually I end up looking after I encounter some issue smile Hopefully this tool will help me doing it the other way round.

Offline

#3 2017-04-21 08:34:39

hcjl
Member
From: berlin
Registered: 2007-06-29
Posts: 330

Re: archnews: Yet another Arch news utility

Yes, I also like it. Would be great to have an aur package for it;-)

Offline

#4 2017-04-21 10:52:46

mjiricka
Member
Registered: 2017-04-20
Posts: 10

Re: archnews: Yet another Arch news utility

I have never packed anything, but if there is demand for it, I will try to do it!

Only problem I see is that I will have to rename it, because in AUR is already a package named "archnews".

Offline

#5 2017-04-21 11:25:25

mis
Member
Registered: 2016-03-16
Posts: 234

Re: archnews: Yet another Arch news utility

@mjiricka, nice smile

I've written a wrapper that uses archnews to show the most recent news when -Syu is passed.

#!/bin/bash

#
# pacman wrapper that uses archnews python script
# to show most recent Arch news when passing -Syu
#
# <https://github.com/mjiricka/archnews>
#
# Usage: copy archnews to /usr/local/bin/
#        save this script as /usr/local/bin/pacnews
#        alias pacman='pacnews'


blue='\033[01;34m'
white='\033[01;37m'
normal='\033[0m'

news_file="${HOME}/.archnews.txt"

# create news file at first usage
[[ ! -f "$news_file" ]] && touch "${news_file}"

if [[ "$1" == "-Syu" ]]; then
        # get most recent news
        archnews -n 1 > /tmp/archnews.txt

        # compare with stored
        cmp /tmp/archnews.txt "${news_file}" > /dev/null 2>&1
        if (($? != 0)); then
                cat /tmp/archnews.txt
                printf "\n${blue}:: ${white}"
                read -p "Mark this news read? [Y,n] " answer
                printf "${normal}\n"
                answer=${answer,,} # tolower
                if [[ "$answer" =~ ^(yes|y ) || -z "$answer" ]]; then
                        mv /tmp/archnews.txt "${news_file}"
                fi
                exit 0
        fi
fi

exec pacman "$@"

Last edited by mis (2017-04-21 12:06:32)

Offline

#6 2017-04-21 23:21:04

glyons
Member
From: Europa
Registered: 2016-10-14
Posts: 37

Re: archnews: Yet another Arch news utility

mjiricka wrote:

Hello!

I was looking for an utility that would quickly show the Arch Linux news feed in command line before I upgrade my system. A long time ago I tried pacmatic, but did not like it. Also other utilities I found did not suit my needs. So I wrote this one:

https://github.com/mjiricka/archnews

It's in pure Python 3 and has many command line options. So maybe somebody else would be interested? :-)

MJ

FYI

There's a package in AUR called "cylon" that does that.

Type cylon -u for update report, needs pacaur and arch-audit installed also.

It shows you last 4 items of news feed and output of Arch-audit -q -u (CVE data)
Then number and names of all updates  and then asks if you want to update system with pacaur.

Also here's a link to a thread on how to get the news feed in Bash.
https://bbs.archlinux.org/viewtopic.php?id=146850

Offline

#7 2017-04-22 09:29:43

mjiricka
Member
Registered: 2017-04-20
Posts: 10

Re: archnews: Yet another Arch news utility

glyons wrote:

FYI
There's a package in AUR called "cylon" that does that.
Type cylon -u for update report, needs pacaur and arch-audit installed also.

Thanks for the info! I did not know about "cylon". But it looks like a overkill for me to use it, I wouldn't use 99% of its functionality smile

glyons wrote:

Also here's a link to a thread on how to get the news feed in Bash.
https://bbs.archlinux.org/viewtopic.php?id=146850

I really think these days Python is much much better than Bash for things like this. Those `sed` commands are really hard to read. And in general HTML cannot be processed this way without making a lot of assumptions.

Last edited by mjiricka (2017-04-22 09:37:07)

Offline

#8 2017-04-30 22:26:17

mjiricka
Member
Registered: 2017-04-20
Posts: 10

Re: archnews: Yet another Arch news utility

mis wrote:

I've written a wrapper that uses archnews to show the most recent news when -Syu is passed.

Hello mis! I liked your idea and I have decided to integrate these things a little bit more together. In repo is also script `archnews_wrap`. It must be run from the directory with `archnews` (it is temporary, archnews should be global one day).

It can show only unread messages, messages can be mark as read and I think it is quite complete solution.

It would be great if you check it and give me a feedback what you think about it!

Offline

#9 2017-06-14 22:40:01

mjiricka
Member
Registered: 2017-04-20
Posts: 10

Re: archnews: Yet another Arch news utility

I am very happy to announce I finally finished the tool and made AUR package for it!

AUR package: https://aur.archlinux.org/packages/archnews2/
once again the source repo: https://github.com/mjiricka/archnews

Feel free upvoting it! wink)

Offline

Board footer

Powered by FluxBB