aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2021-11-09 11:49:06 -0500
committerGalen Guyer <galen@galenguyer.com>2021-11-09 11:49:06 -0500
commitea271f4e9ddf09b11dab0dae03c553ff6598b7a9 (patch)
tree8ddc3dbb1709cad915349b947aff6f04773700d2
Initial commit
-rw-r--r--README.md52
-rw-r--r--build.sh7
-rw-r--r--constants.sh2
-rw-r--r--setup.sh16
4 files changed, 77 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b8cc964
--- /dev/null
+++ b/README.md
@@ -0,0 +1,52 @@
+# aur-builds
+automatic builds of aur packages on a cron job
+
+make an arch container/vm
+struggle with networking for a bit
+set up locales
+ - uncomment `en_US-UTF-8 UTF-8` from `/etc/locale.gen`
+ - run `locale-gen`
+ - run `echo 'LANG=en_US-UTF-8' >> /etc/locale.conf`
+
+set up a aur user for builds so we can do this without root:
+ - run `useradd --home-dir /var/aur/ --create-home aur`
+ - add `aur ALL=(ALL) NOPASSWD: /usr/bin/pacman, /usr/bin/mkarchroot, /usr/bin/arch-nspawn, /usr/bin/makechrootpkg` to the sudoers file
+
+set up nginx to serve repo files
+```nginx
+user aur;
+worker_processes 1;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ include mime.types;
+ default_type application/octet-stream;
+ sendfile on;
+
+ keepalive_timeout 65;
+
+ server {
+ listen 80;
+ server_name localhost;
+
+ location / {
+ root /var/aur/repo/;
+ autoindex on;
+ }
+ }
+}
+```
+
+run inital setup by copying in `constants.sh` and `setup.sh`, making `setup.sh` executable, and running `setup.sh`.
+
+add the following lines to /etc/pacman.conf. if you've updated constants.sh, make sure to update below
+```toml
+[aur-builds]
+SigLevel = Optional TrustAll
+Server = file:///var/aur/repo
+```
+
+if you have a gpg key, import it and run `pacman-key --add [PUBKEY_FILE]; pacman-key --lsign-key [KEY_ID]`. also add --sign to the aur command in `build.sh` \ No newline at end of file
diff --git a/build.sh b/build.sh
new file mode 100644
index 0000000..46a4c39
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+source ./constants.sh
+
+export PACKAGE_LIST="yay"
+
+sudo pacman -Syu
+aur sync --sign -A --noconfirm --noview --database "$REPO_NAME" --root "$REPO_ROOT" "$PACKAGE_LIST"
diff --git a/constants.sh b/constants.sh
new file mode 100644
index 0000000..93ce2d5
--- /dev/null
+++ b/constants.sh
@@ -0,0 +1,2 @@
+export REPO_NAME="aur-builds"
+export REPO_ROOT="/var/aur/repo"
diff --git a/setup.sh b/setup.sh
new file mode 100644
index 0000000..5ee70bf
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+source ./constants.sh
+
+echo "updating packages..."
+sudo pacman -Syyu --noconfirm
+sudo pacman -S base base-devel git --noconfirm
+
+echo "building aurutils..."
+cd /tmp
+curl --output aurutils.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/aurutils.tar.gz
+tar xf aurutils.tar.gz
+cd aurutils
+makepkg --syncdeps --noconfirm
+mkdir -p "$REPO_ROOT"
+sudo pacman -U --noconfirm aurutils-*.pkg.tar.zst
+repo-add "$REPO_ROOT/$REPO_NAME.db.tar.zst"