Commit 061ba5d0 by Stéphane Graber

Add --with-runtime-path to configure

This allows older distros to override /run with whatever their own path is, mostly useful for old RedHat and possibly Android. Reported-by: 's avatarRobert Vogelgesang <vogel@users.sourceforge.net> Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent be660853
...@@ -12,7 +12,7 @@ env LXC_NETWORK="10.0.3.0/24" ...@@ -12,7 +12,7 @@ env LXC_NETWORK="10.0.3.0/24"
env LXC_DHCP_RANGE="10.0.3.2,10.0.3.254" env LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"
env LXC_DHCP_MAX="253" env LXC_DHCP_MAX="253"
env LXC_DHCP_CONFILE="" env LXC_DHCP_CONFILE=""
env varrun="/var/run/lxc" env varrun="/run/lxc"
env LXC_DOMAIN="" env LXC_DOMAIN=""
pre-start script pre-start script
......
...@@ -397,6 +397,13 @@ AC_ARG_ENABLE([tests], ...@@ -397,6 +397,13 @@ AC_ARG_ENABLE([tests],
[], [enable_tests=no]) [], [enable_tests=no])
AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"]) AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
# Allow overriding the default runtime dir (/run)
AC_ARG_WITH([runtime-path],
[AC_HELP_STRING(
[--with-runtime-path=dir],
[runtime directory (default: /run)]
)], [], [with_runtime_path=['/run']])
# LXC container path, where the containers are actually stored # LXC container path, where the containers are actually stored
# This is overridden by an entry in the file called LXCCONF # This is overridden by an entry in the file called LXCCONF
# (i.e. /etc/lxc/lxc.conf) # (i.e. /etc/lxc/lxc.conf)
...@@ -425,7 +432,7 @@ AC_ARG_WITH([usernic-db], ...@@ -425,7 +432,7 @@ AC_ARG_WITH([usernic-db],
[AC_HELP_STRING( [AC_HELP_STRING(
[--with-usernic-db], [--with-usernic-db],
[lxc user nic database] [lxc user nic database]
)], [], [with_usernic_db=['/run/lxc/nics']]) )], [], [with_usernic_db=['$(with_runtime_path)/lxc/nics']])
# Rootfs path, where the container mount structure is assembled # Rootfs path, where the container mount structure is assembled
AC_ARG_WITH([rootfs-path], AC_ARG_WITH([rootfs-path],
...@@ -484,6 +491,7 @@ AS_AC_EXPAND(LXCTEMPLATECONFIG, "$datadir/lxc/config") ...@@ -484,6 +491,7 @@ AS_AC_EXPAND(LXCTEMPLATECONFIG, "$datadir/lxc/config")
AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks") AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
AS_AC_EXPAND(LXCINITDIR, "$libexecdir") AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
AS_AC_EXPAND(LOGPATH, "$with_log_path") AS_AC_EXPAND(LOGPATH, "$with_log_path")
AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path")
AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"]) AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
# Check for some standard kernel headers # Check for some standard kernel headers
......
...@@ -120,7 +120,8 @@ AM_CFLAGS=-I$(top_srcdir)/src \ ...@@ -120,7 +120,8 @@ AM_CFLAGS=-I$(top_srcdir)/src \
-DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\" \ -DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\" \
-DLXC_USERNIC_DB=\"$(LXC_USERNIC_DB)\" \ -DLXC_USERNIC_DB=\"$(LXC_USERNIC_DB)\" \
-DLXC_USERNIC_CONF=\"$(LXC_USERNIC_CONF)\" \ -DLXC_USERNIC_CONF=\"$(LXC_USERNIC_CONF)\" \
-DDEFAULT_CGROUP_PATTERN=\"$(DEFAULT_CGROUP_PATTERN)\" -DDEFAULT_CGROUP_PATTERN=\"$(DEFAULT_CGROUP_PATTERN)\" \
-DRUNTIME_PATH=\"$(RUNTIME_PATH)\"
if ENABLE_APPARMOR if ENABLE_APPARMOR
AM_CFLAGS += -DHAVE_APPARMOR AM_CFLAGS += -DHAVE_APPARMOR
......
...@@ -382,7 +382,7 @@ const char *get_rundir() ...@@ -382,7 +382,7 @@ const char *get_rundir()
rundir = getenv("XDG_RUNTIME_DIR"); rundir = getenv("XDG_RUNTIME_DIR");
if (geteuid() == 0 || rundir == NULL) if (geteuid() == 0 || rundir == NULL)
rundir = "/run"; rundir = RUNTIME_PATH;
return rundir; return rundir;
} }
......
...@@ -28,7 +28,8 @@ AM_CFLAGS=-I$(top_srcdir)/src \ ...@@ -28,7 +28,8 @@ AM_CFLAGS=-I$(top_srcdir)/src \
-DLXCPATH=\"$(LXCPATH)\" \ -DLXCPATH=\"$(LXCPATH)\" \
-DLXC_GLOBAL_CONF=\"$(LXC_GLOBAL_CONF)\" \ -DLXC_GLOBAL_CONF=\"$(LXC_GLOBAL_CONF)\" \
-DLXCINITDIR=\"$(LXCINITDIR)\" \ -DLXCINITDIR=\"$(LXCINITDIR)\" \
-DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\" -DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\" \
-DRUNTIME_PATH=\"$(RUNTIME_PATH)\"
if ENABLE_APPARMOR if ENABLE_APPARMOR
AM_CFLAGS += -DHAVE_APPARMOR AM_CFLAGS += -DHAVE_APPARMOR
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "lxc/lxclock.h" #include "lxc/lxclock.h"
#include "config.h"
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
...@@ -121,10 +122,7 @@ int main(int argc, char *argv[]) ...@@ -121,10 +122,7 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
struct stat sb; struct stat sb;
// we don't create the file until the container is running, so this char *pathname = RUNTIME_PATH "/lock/lxc/var/lib/lxc/";
// bit of the test needs to be changed
//char *pathname = "/run/lock/lxc/var/lib/lxc/" mycontainername;
char *pathname = "/run/lock/lxc/var/lib/lxc/";
ret = stat(pathname, &sb); ret = stat(pathname, &sb);
if (ret != 0) { if (ret != 0) {
fprintf(stderr, "%d: filename %s not created\n", __LINE__, fprintf(stderr, "%d: filename %s not created\n", __LINE__,
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# This test assumes an Ubuntu host
if [ $(id -u) -ne 0 ]; then if [ $(id -u) -ne 0 ]; then
echo 'run as root' echo 'run as root'
exit 1 exit 1
...@@ -34,7 +36,7 @@ cleanup() { ...@@ -34,7 +36,7 @@ cleanup() {
run_cmd lxc-stop -n c1 -k run_cmd lxc-stop -n c1 -k
pkill -u $(id -u $TUSER) -9 pkill -u $(id -u $TUSER) -9
sed -i '/lxcunpriv/d' /var/run/lxc/nics /etc/lxc/lxc-usernet sed -i '/lxcunpriv/d' /run/lxc/nics /etc/lxc/lxc-usernet
sed -i '/^lxcunpriv:/d' /etc/subuid /etc/subgid sed -i '/^lxcunpriv:/d' /etc/subuid /etc/subgid
rm -Rf $HDIR /run/user/$(id -u $TUSER) rm -Rf $HDIR /run/user/$(id -u $TUSER)
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# This test assumes an Ubuntu host
DONE=0 DONE=0
LXC_USER_NIC="@LIBEXECDIR@/lxc/lxc-user-nic" LXC_USER_NIC="@LIBEXECDIR@/lxc/lxc-user-nic"
...@@ -31,7 +33,7 @@ cleanup() { ...@@ -31,7 +33,7 @@ cleanup() {
lxc-stop -n usernic-c1 -k lxc-stop -n usernic-c1 -k
lxc-destroy -n usernic-c1 lxc-destroy -n usernic-c1
sed -i '/usernic-user/d' /var/run/lxc/nics /etc/lxc/lxc-usernet sed -i '/usernic-user/d' /run/lxc/nics /etc/lxc/lxc-usernet
ifconfig usernic-br0 down ifconfig usernic-br0 down
ifconfig usernic-br1 down ifconfig usernic-br1 down
brctl delbr usernic-br0 brctl delbr usernic-br0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment