From 9987e72dfe028c5d75e3f884d7302313cf616c3e Mon Sep 17 00:00:00 2001 From: Lleyton Gray Date: Fri, 22 Nov 2024 17:01:43 -0800 Subject: [PATCH] try workaround --- katsu/modules/base/polycrystal.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/katsu/modules/base/polycrystal.sh b/katsu/modules/base/polycrystal.sh index 0735f6c..b056c63 100644 --- a/katsu/modules/base/polycrystal.sh +++ b/katsu/modules/base/polycrystal.sh @@ -1,4 +1,23 @@ #!/bin/bash -x +set -euo pipefail + +cleanup() { + for mnt in sys proc; do + umount /mnt/mock-mount/$mnt + done + umount /mnt/mock-mount + umount /mnt/mock-mount +} + if [ -x "$(command -v polycrystal)" ]; then - polycrystal + trap cleanup EXIT + mkdir -p /mnt/mock-mount + mount --bind / /mnt/mock-mount + mount --make-private /mnt/mock-mount + mount --bind /mnt/mock-mount /mnt/mock-mount + for mnt in proc sys; do + mount --bind /$mnt /mnt/mock-mount/$mnt + done + + chroot /mnt/mock-mount bash -c polycrystal fi