Skip to content

Instantly share code, notes, and snippets.

@dnut
Last active December 17, 2020 00:46
Show Gist options
  • Save dnut/601852ecc5a8a1803fa075a0db35b8e8 to your computer and use it in GitHub Desktop.
Save dnut/601852ecc5a8a1803fa075a0db35b8e8 to your computer and use it in GitHub Desktop.
aurbox - Create a fresh chroot for clean AUR package builds in Arch Linux.
direc=$(mktemp -d /mnt/aur.XXX)
mount -t tmpfs -o size=8G $direc $direc
pacstrap $direc base base-devel git vim
arch-chroot $direc <<"EOF"
cpu_core_count=$(getconf _NPROCESSORS_ONLN)
useradd -m aur
echo 'aur ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
echo "MAKEFLAGS=\"-j${cpu_core_count}\"" >> /etc/makepkg.conf
echo -e '[multilib]\nInclude = /etc/pacman.d/mirrorlist' >> /etc/pacman.conf
sudo -u aur -- bash <<EOG
cd /home/aur/
mkdir .gnupg
echo 'keyserver ha.pool.sks-keyservers.net' >> .gnupg/gpg.conf
echo 'keyserver-options auto-key-retrieve' >> .gnupg/gpg.conf
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin/
makepkg -si --noconfirm
EOG
EOF
echo -e "\n\nCreated aurbox at '$direc'. Entering chroot as aur user:\n"
arch-chroot $direc /bin/su - aur
echo -e "\nTo clean up the aurbox, execute these commands:\numount $direc\nrm -r $direc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment