Skip to content

Commit

Permalink
chore(aur): added aur packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed May 12, 2024
1 parent 3c1e1e5 commit e00aff9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packaging/aur/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM archlinux:base-devel

# makepkg cannot (and should not) be run as root:
RUN useradd -m build && \
pacman -Syu --noconfirm && \
pacman -Sy --noconfirm git && \
# Allow build to run stuff as root (to install dependencies):
echo "build ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/build

# Continue execution (and CMD) as build:
USER build
WORKDIR /home/build

# Auto-fetch GPG keys (for checking signatures):
RUN mkdir .gnupg && \
touch .gnupg/gpg.conf && \
echo "keyserver-options auto-key-retrieve" > .gnupg/gpg.conf && \
git clone https://aur.archlinux.org/paru-bin.git && \
cd paru-bin && \
makepkg --noconfirm --syncdeps --rmdeps --install --clean

COPY run.sh /run.sh

# Build the package
WORKDIR /pkg
CMD ["/bin/bash", "/run.sh"]
28 changes: 28 additions & 0 deletions packaging/aur/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

set -e

# Make a copy so we never alter the original
cp -r /pkg /tmp/pkg
cd /tmp/pkg

# Sync database
if [ -n "$SYNC_DATABASE" ]; then
paru -S --refresh
fi

# Do the actual building. Paru will fetch all dependencies for us (including
# AUR dependencies) and then build the package.
paru -U --noconfirm

# Store the built package(s). Ensure permissions match the original PKGBUILD.
if [ -n "$EXPORT_PKG" ]; then
sudo chown "$(stat -c '%u:%g' /pkg/PKGBUILD)" ./*pkg.tar*
sudo mv ./*pkg.tar* /pkg
fi
# Export .SRCINFO for built package
if [ -n "$EXPORT_SRC" ]; then
makepkg --printsrcinfo > .SRCINFO
sudo chown "$(stat -c '%u:%g' /pkg/PKGBUILD)" ./.SRCINFO
sudo mv ./.SRCINFO /pkg
fi

0 comments on commit e00aff9

Please sign in to comment.