#!/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
AA_USERNS_TOGGLE=/proc/sys/kernel/apparmor_restrict_unprivileged_userns
if ! systemd-detect-virt -c && [ -e $AA_USERNS_TOGGLE ]; then
    echo 0 | sudo tee $AA_USERNS_TOGGLE
fi

debian/rules build-arch-post-check
