#!/bin/sh
set -e

case "$(dpkg-architecture -qDEB_HOST_ARCH)" in
    i386)
        # The i386 debci runners are not powerful enough to run all the
        # testsuite within the default timeout. Disable the biarch ones.
        export DEB_BUILD_PROFILES="nobiarch"
        ;;
    *)
        ;;
esac

# Disable user namespace if we're not in a container
if ! systemd-detect-virt -c; then
    echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
fi

debian/rules build-arch-post-check
