User:Alad/minaur

From ArchWiki
Jump to: navigation, search
Preview: This page is a preview of the aurhelper(7) man page shipped with aurutilsAUR.

The following is an example "minimal" implementation of an AUR helper.

  • AUR packages are cloned on every build with git clone(1).
  • Diffs are not supported, but files an be easily viewed in a single window through mc.
  • To preserve upstream sources, SRCDEST is used.
  • Packages are stored to PKGDEST, where they can e.g. be added to a local repository.
  • Input during the build process is not supported. (ad-hoc use of xargs(1))
Note: Dependency resolution and update functionality is done through auracle-gitAUR.

Example usage:

$ auracle buildorder yourface | awk '{print $2}' | xargs aurbuild
$ auracle sync | xargs aurbuild

makepkg configuration:

~/.config/pacman/makepkg.conf
SRCDEST=/home/sources
PKGDEST=/home/packages

Build script:

~/.local/bin/aurbuild
#!/bin/dash
if test -d aur; then
  mv aur aur.old
fi

for pkg; do
  git clone https://aur.archlinux.org/"$pkg".git aur/"$pkg"
done

mc aur/ # or editor supporting file manager functionality

for pkg; do
  if cd aur/"$pkg"; then
    # install all split packages
    makepkg -sir --noconfirm

    # makepkg <5.1 has no meaningful exit codes. 
    # alternative: parse stdout (LC_MESSAGES=C)
    case $? in
      0|13) continue  ;; # a package has already been built
         *) exit "$?" ;;
    esac
  else
    exit "$?"
  fi
done