Fix previous commit, removing hardcoded /var/lib/lxc from lxc-start-ephemeral

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 <stgraber@ubuntu.com>
This commit is contained in:
Stéphane Graber 2012-09-07 14:53:19 -04:00
parent caf32f58cd
commit 95a717e9b9
3 changed files with 8 additions and 3 deletions

View File

@ -143,6 +143,7 @@ AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
AC_CHECK_HEADERS([sys/signalfd.h])
AC_PROG_GCC_TRADITIONAL
AC_PROG_SED
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall"

View File

@ -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)

View File

@ -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"))