#!/usr/bin/env bash
#
# Update all AUR packages in $HOME/pkg

find $HOME/pkg -mindepth 1 -maxdepth 1 -type d -print0 | while read -d $'\0' pkgdir
do
  cd "$pkgdir"
  pullres=$(git pull --rebase)
  if [ "$pullres" = "Already up to date." ]; then
    continue
  fi

  makepkg -si --noconfirm --needed
done