]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Add --with-runtime-path to configure
authorStéphane Graber <stgraber@ubuntu.com>
Tue, 11 Feb 2014 22:40:20 +0000 (17:40 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 11 Feb 2014 23:57:57 +0000 (18:57 -0500)
This allows older distros to override /run with whatever their own path
is, mostly useful for old RedHat and possibly Android.

Reported-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
config/init/upstart/lxc-net.conf
configure.ac
src/lxc/Makefile.am
src/lxc/utils.c
src/tests/Makefile.am
src/tests/locktests.c
src/tests/lxc-test-unpriv
src/tests/lxc-test-usernic.in

index 3ae3e95c3702f44bbf70fc2f93e648a0ad406d52..86e9a719fec907d06bfa378759968bc246d35aad 100644 (file)
@@ -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_MAX="253"
 env LXC_DHCP_CONFILE=""
-env varrun="/var/run/lxc"
+env varrun="/run/lxc"
 env LXC_DOMAIN=""
 
 pre-start script
index b07ac143b28a7c0c3f606addcb03b672ab02e93c..5346ba243fdcc474da5fe073658072544dccbf9e 100644 (file)
@@ -397,6 +397,13 @@ AC_ARG_ENABLE([tests],
        [], [enable_tests=no])
 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
 # This is overridden by an entry in the file called LXCCONF
 # (i.e. /etc/lxc/lxc.conf)
@@ -425,7 +432,7 @@ AC_ARG_WITH([usernic-db],
        [AC_HELP_STRING(
                [--with-usernic-db],
                [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
 AC_ARG_WITH([rootfs-path],
@@ -484,6 +491,7 @@ AS_AC_EXPAND(LXCTEMPLATECONFIG, "$datadir/lxc/config")
 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
 AS_AC_EXPAND(LOGPATH, "$with_log_path")
+AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path")
 AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
 
 # Check for some standard kernel headers
index c6ef8f59eb5cdb33e0747875d299eec454eb9f07..e69c9a653203455b67a89256a186ea4fada06b60 100644 (file)
@@ -120,7 +120,8 @@ AM_CFLAGS=-I$(top_srcdir)/src \
        -DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\" \
        -DLXC_USERNIC_DB=\"$(LXC_USERNIC_DB)\" \
        -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
 AM_CFLAGS += -DHAVE_APPARMOR
index 411917e0f0089a5088d4ca9c3642cc748c971ac0..b7a29cb3955c7f0182ecde7ca8b5cb886a109891 100644 (file)
@@ -382,7 +382,7 @@ const char *get_rundir()
 
        rundir = getenv("XDG_RUNTIME_DIR");
        if (geteuid() == 0 || rundir == NULL)
-               rundir = "/run";
+               rundir = RUNTIME_PATH;
        return rundir;
 }
 
index bd1f8cea05186697445a3cbc44074b0a2d320eba..de1f7e6961384cf48488b66fdb0ee5fef4d647f7 100644 (file)
@@ -28,7 +28,8 @@ AM_CFLAGS=-I$(top_srcdir)/src \
        -DLXCPATH=\"$(LXCPATH)\" \
        -DLXC_GLOBAL_CONF=\"$(LXC_GLOBAL_CONF)\" \
        -DLXCINITDIR=\"$(LXCINITDIR)\" \
-       -DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\"
+       -DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\" \
+       -DRUNTIME_PATH=\"$(RUNTIME_PATH)\"
 
 if ENABLE_APPARMOR
 AM_CFLAGS += -DHAVE_APPARMOR
index c3f5352ceeb7f19de775485652d55539fc251968..2d04052a2adf0383d593f516a5790224fe49e8ed 100644 (file)
@@ -17,6 +17,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 #include "lxc/lxclock.h"
+#include "config.h"
 #include <unistd.h>
 #include <signal.h>
 #include <stdio.h>
@@ -121,10 +122,7 @@ int main(int argc, char *argv[])
                exit(1);
        }
        struct stat sb;
-       // we don't create the file until the container is running, so this
-       // 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/";
+       char *pathname = RUNTIME_PATH "/lock/lxc/var/lib/lxc/";
        ret = stat(pathname, &sb);
        if (ret != 0) {
                fprintf(stderr, "%d: filename %s not created\n", __LINE__,
index d9a5c5c570816a31a6f5ba2fe7c5769d89d16ee2..9e3fe211d69046a93dfa309ecd30c63273f093dc 100755 (executable)
@@ -21,6 +21,8 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
+# This test assumes an Ubuntu host
+
 if [ $(id -u) -ne 0 ]; then
        echo 'run as root'
        exit 1
@@ -34,7 +36,7 @@ cleanup() {
        run_cmd lxc-stop -n c1 -k
        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
 
        rm -Rf $HDIR /run/user/$(id -u $TUSER)
index 846e592b1161ae337f36badd84e61321ee9621ab..4f96d2eaeaf54002c7afae03a10558f22f172701 100755 (executable)
@@ -21,6 +21,8 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
+# This test assumes an Ubuntu host
+
 DONE=0
 LXC_USER_NIC="@LIBEXECDIR@/lxc/lxc-user-nic"
 
@@ -31,7 +33,7 @@ cleanup() {
                lxc-stop -n usernic-c1 -k
                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-br1 down
                brctl delbr usernic-br0