diff --git a/aur-utils/Containerfile b/aur-utils/Containerfile deleted file mode 100644 index e69de29..0000000 diff --git a/aurutils/Containerfile b/aurutils/Containerfile new file mode 100644 index 0000000..bebc26a --- /dev/null +++ b/aurutils/Containerfile @@ -0,0 +1,73 @@ +FROM docker.io/archlinux/archlinux:latest + +# Update pacma dtaabase +# Initialize pacman key +# Ensure archlinux-keyring package is up to date +# Update all packages + +RUN pacman -Sy && \ + pacman-key --init && \ + pacman -S --noconfirm archlinux-keyring && \ + pacman -Su --noconfirm + +# Install packages required for cloning and building the aur-utils repo + +RUN pacman -S --noconfirm base-devel git curl jq man-db man-pages nano + +# Install additional aurutils dependencies +# https://github.com/aurutils/aurutils/blob/release/makepkg/PKGBUILD#L14 + +RUN pacman -S --noconfirm pacutils trurl perl perl-json-xs + +# Copy in makepkg config file, aur sudo ocnfig, custom repo config, and include custom repo config in main pacman config + +COPY --chown=root:root --chmod=0664 makepkg.conf /etc/makepkg.conf.d/makepkg.conf +COPY --chown=root:root --chmod=0600 aur.sudo /etc/sudoers.d/aur +COPY --chown=root:root --chmod=0664 home.repo.conf /etc/pacman.d/home.repo.conf +RUN cat <> /etc/pacman.conf + +[home] +Include = /etc/pacman.d/home.repo.conf + +EOF + +# Create the aur system user + +RUN useradd -r -U -m -d /aur aur && \ + mkdir /repo && \ + chmod 0775 /repo && \ + chown aur:aur /repo + +# Switch to aur user for build operations + +USER aur + +# Git clone the aur-utils repo +# Checkout the latest release, fetching latest release version from github API via curl + +RUN git clone https://github.com/aurutils/aurutils.git /aur/aurutils && \ + cd /aur/aurutils && \ + git switch --detach $(curl -sSfL https://api.github.com/repos/aurutils/aurutils/releases/latest | jq -r .tag_name) + +# Ensure makepkg dirs exist + +RUN mkdir -p /aur/{builddir,srcdest,srcpkgdest,log} + +# Init the home repo db +# Update pacman sources + +RUN repo-add /repo/home.db.tar.zst && \ + sudo pacman -Sy + +# Build the aurutils package + +RUN makepkg --nosign -i --noconfirm -D /aur/aurutils/makepkg + +RUN rm /repo/aurutils-git*.pkg.tar.zst && \ + rm -r /aur/aurutils + +# Set working directory and entrypoint + +WORKDIR /aur +ENV PATH=/usr/local/bin:/usr/bin +ENTRYPOINT ["/bin/bash"] diff --git a/aurutils/aur.sudo b/aurutils/aur.sudo new file mode 100644 index 0000000..b36bfc5 --- /dev/null +++ b/aurutils/aur.sudo @@ -0,0 +1 @@ +aur ALL=(root) NOPASSWD: /usr/lib/aurutils/*, /usr/bin/pacman * diff --git a/aurutils/home.repo.conf b/aurutils/home.repo.conf new file mode 100644 index 0000000..3b85c91 --- /dev/null +++ b/aurutils/home.repo.conf @@ -0,0 +1,3 @@ +# SigLevel = Required TrustedOnly +SigLevel = Optional TrustAll +Server = file:///repo diff --git a/aurutils/makepkg.conf b/aurutils/makepkg.conf new file mode 100644 index 0000000..0a8ff2c --- /dev/null +++ b/aurutils/makepkg.conf @@ -0,0 +1,20 @@ +# Global Options + +OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge debug lto autodeps) +MAKEFLAGS="-j2" +PACKAGER="Balsillie Homelab " + +# Build Environment + +BUILDDIR=/aur/builddir +BUILDENV=(!distcc color !ccache check sign) +GPGKEY=$AUR_GPG_KEY_THUMBPRINT + +# Outputs + +PKGDEST=/repo +SRCDEST=/aur/srcdest +SRCPKGDEST=/aur/srcpkgdest +LOGDEST=/aur/log +PKGEXT=".pkg.tar.zst" +SRCEXT=".src.tar.zst" \ No newline at end of file