]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
create the lxc directory with lxc-setcap
authorDaniel Lezcano <daniel.lezcano@free.fr>
Fri, 10 Jul 2009 06:58:27 +0000 (08:58 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 10 Jul 2009 06:58:27 +0000 (08:58 +0200)
There are several cases:
 * we run the lxc-create as root, the @path@/var/lib/lxc will be created
 * we run the lxc-create as non-root, the creation of the directory will
   fail with "permission denied", so we should call lxc-setcap before
 * we run lxc-setcap (always as root), we create the directory and set
   the permission for everyone.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc-setcap.in

index 48377292c7c8418e6f2d5b593575180de888a7d4..69c5bc56f1fe4d301d81a4f35109720ed533c6a2 100644 (file)
@@ -49,7 +49,9 @@ lxc_setcaps()
     setcap $LXC_UNSHARE_CAPS=ep @BINDIR@/lxc-unshare
     setcap $LXC_NETSTAT_CAPS=ep @BINDIR@/lxc-netstat
     setcap $LXC_INIT_CAPS=ep @LIBEXECDIR@/lxc-init
-    chmod 2777 @LXCPATH@
+
+    test -e @LXCPATH@ || mkdir -p @LXCPATH@
+    chmod 0777 @LXCPATH@
 }
 
 lxc_dropcaps()