From 95a717e9b907de94bf29c91abca13012ec47d088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 7 Sep 2012 14:53:19 -0400 Subject: [PATCH] Fix previous commit, removing hardcoded /var/lib/lxc from lxc-start-ephemeral MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous commit was missing part of the changes, leading to a non-working version of lxc-start-ephemeral. This commit adds the missing parts. Signed-off-by: Stéphane Graber --- configure.ac | 1 + src/lxc/Makefile.am | 4 ++++ src/lxc/lxc-start-ephemeral.in | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 7018082bc..6f819d27a 100644 --- a/configure.ac +++ b/configure.ac @@ -143,6 +143,7 @@ AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include ]) AC_CHECK_HEADERS([sys/signalfd.h]) AC_PROG_GCC_TRADITIONAL +AC_PROG_SED if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall" diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am index 7d86ad661..11c025728 100644 --- a/src/lxc/Makefile.am +++ b/src/lxc/Makefile.am @@ -144,6 +144,10 @@ lxc_unshare_SOURCES = lxc_unshare.c lxc_wait_SOURCES = lxc_wait.c lxc_kill_SOURCES = lxc_kill.c +lxc-start-ephemeral: lxc-start-ephemeral.in + [ -f $@ ] && rm -f $@ || true + $(SED) -e "s:[@]LXCPATH@:$(LXCPATH):" $< > $@ + install-exec-local: install-soPROGRAMS mv $(DESTDIR)$(libdir)/liblxc.so $(DESTDIR)$(libdir)/liblxc.so.$(VERSION) /sbin/ldconfig -l $(DESTDIR)$(libdir)/liblxc.so.$(VERSION) diff --git a/src/lxc/lxc-start-ephemeral.in b/src/lxc/lxc-start-ephemeral.in index 4f238a361..71b186131 100644 --- a/src/lxc/lxc-start-ephemeral.in +++ b/src/lxc/lxc-start-ephemeral.in @@ -109,7 +109,7 @@ if not orig.defined: sys.exit(1) # Create the new container paths -dest_path = tempfile.mkdtemp(prefix="%s-" % args.orig, dir="/var/lib/lxc/") +dest_path = tempfile.mkdtemp(prefix="%s-" % args.orig, dir="@LXCPATH@") os.mkdir(os.path.join(dest_path, "rootfs")) # Setup the new container's configuration @@ -217,8 +217,8 @@ if not args.keep_data: with open(os.path.join(dest_path, "post-stop"), "w+") as fd: os.fchmod(fd.fileno(), 0o755) fd.write("""#!/bin/sh -[ -n "$1" ] && [ -d "/var/lib/lxc/$1/" ] && rm -Rf /var/lib/lxc/$1/ -""") +[ -d "%s" ] && rm -Rf "%s" +""" % (dest.get_config_item("lxc.rootfs"), dest.get_config_item("lxc.rootfs")) dest.set_config_item("lxc.hook.post-stop", os.path.join(dest_path, "post-stop"))