Managing packages on Arch Linux

My simple workflow for managing packages on Arch Linux.

Pacman and AUR

Arch’s package manager Pacman is great. It makes it really easy to update and manage packages that you have installed. Updating is as simple as

sudo pacman -Syu

Before too long you’ll find that you want to install something from the Arch User Repository. This allows community members to create and share PKGBUILD files. It is also easy to create your own if whatever you want isn’t already in the AUR.

To work with packages from the AUR there are a few options to choose from. Many go for yaourt but personally I prefer the more lightweight cower.

Managing updates

I’m interested in seeing what has been updated, particular for packages from AUR. I run dwm and this allows you to set the contents of a status bar with xsetroot. You can get the number of updates available for pacman and aur installed packages with the following.

pacman -Qqu | wc -l
cower -u | wc -l

So you can use this in an .xinitrc file to set the status and check these values every minute

while true; do
  PMUPDATES="$(pacman -Qqu | wc -l)"
  AURUPDATES="$(cower -u | wc -l)"
  xsetroot -name "$PMUPDATES $AURUPDATES $(date +"%F %R")"
  sleep 60
done &
exec dwm

Now whenever you want to you can glance up to the top right of the screen and see if there are updates available.

cower icons
cower icons

Another alternative is to use checkupdates, one of the many useful helper scripts bundled with pacman. For details, run

checkupdates -h

To see the full list of the helper scripts, run

pacman -Ql pacman | awk -F/ '/bin/ {print $4}'

Cower

I really like cower. It does just enough. I like to review what has changed and check PKGBUILD files before I install them. I took most of Jason Ryan’s cowerd script and have it in my PATH like this.

#!/usr/bin/env sh

cd $HOME/src && cower -d "$1"
builddir="$_"
cd "$builddir" && ${EDITOR:-vi} PKGBUILD
makepkg -si && cd - &>/dev/null
rm -Rf "$builddir"

To check what is available I run

cower -u

Then update with

cowerd [package name]

Simple is good

Since I moved over from Arch Linux I’ve loved the simplicy that Arch, dwm and other suckless tools have offered me. Pacman and cower make package management a breeze.

Tags

Can you help make this article better? You can edit it here and send me a pull request.

See Also