From 39e2cbec3cc9f49e3edd65b2aa4bdd3983a25fea Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 24 Jul 2018 11:49:14 +0200 Subject: [PATCH] tests: lxc-test-apparmor-mount: check environment early don't kill all my processes when running it as user... Signed-off-by: Wolfgang Bumiller --- src/tests/lxc-test-apparmor-mount | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tests/lxc-test-apparmor-mount b/src/tests/lxc-test-apparmor-mount index 144467c88..56d598f4c 100755 --- a/src/tests/lxc-test-apparmor-mount +++ b/src/tests/lxc-test-apparmor-mount @@ -23,6 +23,16 @@ set -e +# Only run on a normally configured ubuntu lxc system +if [ ! -d /sys/class/net/lxcbr0 ]; then + echo "lxcbr0 is not configured." + exit 1 +fi +if [ "$(id -u)" != "0" ]; then + echo "ERROR: Must run as root." + exit 1 +fi + if [ -f /proc/self/ns/cgroup ]; then default_profile="lxc-container-default-cgns (enforce)" else @@ -74,16 +84,6 @@ clear_log() { trap cleanup exit -# Only run on a normally configured ubuntu lxc system -if [ ! -d /sys/class/net/lxcbr0 ]; then - echo "lxcbr0 is not configured." - exit 1 -fi -if [ "$(id -u)" != "0" ]; then - echo "ERROR: Must run as root." - exit 1 -fi - chmod 0666 "$logfile" # This would be much simpler if we could run it as -- 2.47.2