From 73086d5731e184d377d7011defa54ea441c495fa Mon Sep 17 00:00:00 2001 From: Kristian Klausen <kristian@klausen.dk> Date: Fri, 29 Jul 2022 00:38:28 +0200 Subject: [PATCH] wrapper --- .../files/libvirt-executor-update-base-image | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/gitlab_runner/files/libvirt-executor-update-base-image b/roles/gitlab_runner/files/libvirt-executor-update-base-image index 9fc17c750..539f0f732 100755 --- a/roles/gitlab_runner/files/libvirt-executor-update-base-image +++ b/roles/gitlab_runner/files/libvirt-executor-update-base-image @@ -14,6 +14,11 @@ cleanup() { rm -r "${tmpdir}" } +arch-chroot() { + # Workaround https://github.com/archlinux/arch-install-scripts/issues/21 + command arch-chroot "${1}" unshare --fork --pid "${@:2}" +} + tmpdir="$(mktemp --directory --tmpdir="/var/tmp")" trap cleanup EXIT @@ -27,13 +32,8 @@ qemu-img convert -f qcow2 -O raw Arch-Linux-x86_64-basic.qcow2 Arch-Linux-x86_64 loopdev="$(losetup --find --partscan --show "${image}")" mount --mkdir "${loopdev}p2" mnt -arch-chroot mnt bash -e <<'EOF' -pacman-key --init -pacman-key --populate -pid="$(pgrep gpg-agent)" -gpgconf --homedir /etc/pacman.d/gnupg --kill gpg-agent -tail --pid="${pid}" -f /dev/null -EOF +arch-chroot mnt pacman-key --init +arch-chroot mnt pacman-key --populate # shellcheck disable=SC2016 printf 'Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' > mnt/etc/pacman.d/mirrorlist -- GitLab