forked from Spark/builder
30 lines
647 B
Bash
Executable File
30 lines
647 B
Bash
Executable File
#!/usr/bin/env bash
|
|
shopt -s nullglob
|
|
|
|
# Upgrade
|
|
pacman -Suy --noconfirm
|
|
|
|
# Create a builder user
|
|
useradd -U builder
|
|
builder_uid=$(id -u builder)
|
|
builder_gid=$(id -g builder)
|
|
|
|
# gnupg dir permissions
|
|
chown -R "$builder_uid:$builder_gid" /.gnupg /buildroot
|
|
|
|
# Add sudo permissions for pacman to install dependencies
|
|
printf '%s ALL=(ALL) NOPASSWD: /usr/bin/pacman\n' 'builder' > /etc/sudoers.d/builduser
|
|
|
|
# Workdir
|
|
cd /buildroot
|
|
|
|
# Install all additional packages
|
|
deps=( ./deps/* )
|
|
[[ $deps ]] && pacman -U "${deps[@]}"
|
|
|
|
# Build the damn thing
|
|
sudo -u builder GNUPGHOME="/.gnupg" makepkg "$@"
|
|
|
|
# Return the permissions
|
|
chown -R root:root /buildroot
|