jasonwryan.com

Miscellaneous ephemera…

Simple aurphan notifier

image

If you are an Arch Linux user and you are not using aurphan, you can take a moment to hang your head in shame before you click on to whatever the next thing is. The package description sums up perfectly what aurphan does:

Finds packages in need of maintainers, bug fixes and patches. Adopt today!

Running aurphan -a, for example, will identify any AUR packages in your database that are not currently maintained; allowing you to log in to the AUR and hit the ‘Adopt’ button, leaving you feeling all worthy and fulfilled.1

If, like most Archers, you have a compulsive desire to automate everything then clearly typing (or even remembering to type) aurphan -a into a terminal periodically is as ludicrous as it is onerous. The obvious answer is some shell script and a cron job.

First, the cron job:

1
2
crontab -e
@hourly aurphan -a >/tmp/aurphans

Then, as part of my dwm-status script, a function to check that there are no new additions to the file and, if there are, flash a highlight:

1
2
3
4
5
6
aur(){
    aurphans="$(awk '$0 !~ /^No /' /tmp/aurphans | wc -l)"
    if [ $aurphans -gt 0 ]; then
        echo -en "\x03*\x01"
    fi
}

The awk filter excludes a null return, which is “No aurphans found.” Now, if any of the packages that I use from the AUR are disowned, I’ll be the first to know about it.

Notes
  1. Actual feeling may differ depending on the package you have adopted and the amount of prescription painkillers that you are currently ingesting…

Comments