]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tests: lxc-test-apparmor-mount: check environment early
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 24 Jul 2018 09:49:14 +0000 (11:49 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 24 Jul 2018 11:59:25 +0000 (13:59 +0200)
don't kill all my processes when running it as user...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/tests/lxc-test-apparmor-mount

index 144467c88455b4da1c57a19656e6c58b7e5d4da8..56d598f4cd147c48d44eadcf9029a5db33c52e24 100755 (executable)
 
 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