Add initial files
This commit is contained in:
commit
a05d264295
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# mikroskeem's AUR build bot
|
||||
|
||||
NOTE: This is actually not ready, so it is not recommended to run it in production (don't be like me!)
|
||||
|
||||
## Installing
|
||||
|
||||
* Set up new Arch Linux nspawn container (I recommend using this [script](https://gist.github.com/artizirk/fab2ce13277a190ee6063b03b8e0a6e9) made by @artizirk)
|
||||
* Install [aurutils](https://aur.archlinux.org/packages/aurutils) and set it up
|
||||
* Copy `buildpkg` to `/usr/bin` in builder container
|
||||
* Set up [OpenSMTPD](https://wiki.archlinux.org/index.php/OpenSMTPD) server on container and host (to send emails to builder in case of failure)
|
||||
- Note: Don't forget to firewall!
|
||||
* Copy `aur` script to `/usr/bin` in host machine
|
||||
* Set up nginx to serve packages to host (and maybe for public)
|
||||
|
||||
## Known issues
|
||||
* You can't edit PKGBUILD-s
|
||||
* You can't accept GPG keys automatically (insecure to do so, but you can do `gpg --recv-key <key>` in container shell)
|
||||
* Not documentated enough!
|
||||
* Probably something more I'm not currently aware of
|
12
aur
Executable file
12
aur
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
aur(){
|
||||
if [ -z "$1" ]; then
|
||||
echo "aur: <package name to build and install>"
|
||||
return 1
|
||||
fi
|
||||
sudo machinectl shell --setenv=INVOKER="${USER}@$(hostname)" builduser@builder /usr/bin/buildpkg $1
|
||||
}
|
||||
|
||||
aur $*
|
||||
|
||||
# vim: set ft=sh
|
45
buildpkg
Executable file
45
buildpkg
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get package name
|
||||
PACKAGE=${1}
|
||||
shift
|
||||
|
||||
# Defaults
|
||||
XDG_CACHE_HOME=${XDG_CACHE_HOME:="${HOME}/.cache"}
|
||||
PKG_SOURCE_DIR="$XDG_CACHE_HOME/aursync/$PACKAGE"
|
||||
MAIL_RECIPIENT=${INVOKER:="mark@Willywonka"}
|
||||
|
||||
if [ ! "$(whoami)" == "builduser" ]; then
|
||||
su builduser -c "${0}" "${PACKAGE}"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Update packages
|
||||
echo "#### Updating packages"
|
||||
sudo pacman --noconfirm -Syu
|
||||
|
||||
# aursync starts 'less' to show files, no thanks
|
||||
export PAGER=cat
|
||||
|
||||
# Check for previous failed build and clean up
|
||||
if [ -f "$PKG_SOURCE_DIR/FAILED" ]; then
|
||||
echo "#### Cleaning up previous failed build"
|
||||
rm -rf "$PKG_SOURCE_DIR"
|
||||
fi
|
||||
|
||||
# Start aursync
|
||||
LOGF=$(mktemp)
|
||||
(
|
||||
set -o pipefail
|
||||
aursync -n ${PACKAGE} | tee ${LOGF}
|
||||
)
|
||||
|
||||
# Mark package source dir failed
|
||||
if [ ! $? -eq 0 ]; then
|
||||
touch "$PKG_SOURCE_DIR/FAILED"
|
||||
echo "#### Build failed"
|
||||
cat ${LOGF} | mail -s "Build for AUR package '$PACKAGE' failed" ${MAIL_RECIPIENT}
|
||||
fi
|
||||
rm ${LOGF}
|
||||
|
||||
# vim:ft=sh
|
8
smtpd/smtpd.conf
Normal file
8
smtpd/smtpd.conf
Normal file
@ -0,0 +1,8 @@
|
||||
listen on host0
|
||||
|
||||
table aliases file:/etc/smtpd/aliases
|
||||
table vdoms "/etc/smtpd/vdoms"
|
||||
|
||||
accept for local alias <aliases> deliver to mbox
|
||||
accept from any for domain <vdoms> deliver to mbox
|
||||
accept for any relay
|
1
smtpd/vdoms
Normal file
1
smtpd/vdoms
Normal file
@ -0,0 +1 @@
|
||||
builder
|
Loading…
Reference in New Issue
Block a user