summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoan Bruguera2023-03-15 04:20:46 +0000
committerJoan Bruguera2023-03-15 04:20:46 +0000
commit0efe1530428a6d40b1e836c85b235bdafbd41ee2 (patch)
tree21a8af6cc0c5b133fb2786bf298e12ec77fed19f
parent9ea42d4999695d2483449b00bf1565552eb899e1 (diff)
downloadaur-0efe1530428a6d40b1e836c85b235bdafbd41ee2.tar.gz
Skip tests if user namespaces are not supported or restricted.
-rw-r--r--PKGBUILD6
1 files changed, 6 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 296efd49ec1c..f465d1dc3c9c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -17,6 +17,12 @@ build() {
check() {
cd $pkgname-$pkgver
+ # See https://github.com/nix-community/nix-user-chroot/tree/1.2.2#check-if-your-kernel-supports-user-namespaces-for-unprivileged-users
+ # Plus, ensure chroot works inside the user namespace (This fails, for example, inside a regular Podman container)
+ if ! unshare --user --pid --map-root-user chroot / true; then
+ echo "WARNING: Skipping tests because user namespaces are not supported or restricted" >&2
+ return
+ fi
cargo test --release --locked
}