$(localstatedir) != $(prefix)/var

The current code assumes that localstatedir is equal to $(prefix)/var,
thus failing for example on debian, where prefix is /usr and
localstatedir is /var. This patch fixes this by expanding LXCPATH just
once in configure.ac to $(localstatedir)/lib/lxc and expanding that
variable everywhere else.

install-exec-local is changed to just do one mkdir -p, and taking into
account of the DESTDIR variable, user for example for packaging.

Changing the permission of LXCPATH is done in lxc-setcap

Signed-off-by: Guido Trotter <ultrotter@quaqua.net>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
Guido Trotter 2009-03-30 10:12:13 +01:00 committed by Daniel Lezcano
parent 85a3182189
commit abf424cf20
6 changed files with 8 additions and 6 deletions

View File

@ -19,6 +19,7 @@ AS_AC_EXPAND(BINDIR, $bindir)
AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
AS_AC_EXPAND(LXCPATH, "${localstatedir}/lib/lxc")
AC_CHECK_HEADERS([linux/netlink.h linux/genetlink.h], [], AC_MSG_ERROR([netlink headers not found]),
[#include <linux/types.h>

View File

@ -1,4 +1,4 @@
INCLUDES= -I$(top_srcdir)/src -DLXCPATH="\"$(localstatedir)/lxc\"" \
INCLUDES= -I$(top_srcdir)/src -DLXCPATH="\"@LXCPATH@\"" \
-DLXCBINDIR="\"$(bindir)\"" \
-DLXCLIBEXECDIR="\"$(libexecdir)\""
AM_LDFLAGS= -lutil
@ -132,5 +132,4 @@ lxc_version_SOURCES = lxc_version.c
lxc_version_LDADD = liblxc.la
install-exec-local:
@mkdir -p $(localstatedir) && mkdir -p $(prefix)/var/lxc && \
chmod ugo+rw $(prefix)/var/lxc
@mkdir -p $(DESTDIR)@LXCPATH@

View File

@ -1,6 +1,6 @@
#!/bin/bash
lxcpath=@LOCALSTATEDIR@/lxc
lxcpath=@LXCPATH@
if [ ! -r $lxcpath ]; then
exit 0

View File

@ -1,7 +1,7 @@
#!/bin/bash
# set -ex
lxcpath=@LOCALSTATEDIR@/lxc
lxcpath=@LXCPATH@
exec=""
if [ ! -r $lxcpath ]; then

View File

@ -1,7 +1,7 @@
#!/bin/bash
# set -ex
lxcpath=@LOCALSTATEDIR@/lxc
lxcpath=@LXCPATH@
if [ ! -r $lxcpath ]; then
exit 0

View File

@ -49,6 +49,7 @@ 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@
}
lxc_dropcaps()
@ -60,6 +61,7 @@ lxc_dropcaps()
setcap -r @BINDIR@/lxc-unshare
setcap -r @BINDIR@/lxc-netstat
setcap -r @LIBEXECDIR@/lxc-init
chmod 0755 @LXCPATH@
}
if [ "$(id -u)" != "0" ]; then