]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Add systemd unit for lxc.net
authorMartin Pitt <martin.pitt@ubuntu.com>
Thu, 31 Jul 2014 06:53:53 +0000 (08:53 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 4 Aug 2014 19:24:17 +0000 (15:24 -0400)
This is the equivalent of the upstart lxc-net.conf to set up the LXC bridge.

This also drops "lxc.service" from tarballs. It is built source which depends
on configure options, so the statically shipped file will not work on most
systems.

https://launchpad.net/bugs/1312532

Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
.gitignore
config/init/systemd/Makefile.am
config/init/systemd/lxc-net.service.in [new file with mode: 0644]
config/init/systemd/lxc.service.in
configure.ac

index 26011e4837505cec18593550ea9cf9e86cd65075..e6de18f609c7e0d5b71dd4c5816590f9a87f1df2 100644 (file)
@@ -114,6 +114,7 @@ config/lt*.m4
 config/bash/lxc
 config/init/systemd/lxc-autostart-helper
 config/init/systemd/lxc.service
+config/init/systemd/lxc-net.service
 config/init/sysvinit/lxc
 
 doc/*.1
index 3bd221fc9a152b6468f026320c24d3087e031850..ed1e4ef745eb4d1c82447373c9f082abc8559706 100644 (file)
@@ -1,6 +1,8 @@
 EXTRA_DIST = \
        lxc-devsetup \
-       lxc.service
+       lxc.service.in \
+       lxc-net.service.in \
+       $(NULL)
 
 if INIT_SCRIPT_SYSTEMD
 lxc-autostart-helper: ../sysvinit/lxc.in $(top_builddir)/config.status
@@ -11,14 +13,15 @@ lxc-autostart-helper: ../sysvinit/lxc.in $(top_builddir)/config.status
            < $< > $@-t &&                                      \
            chmod a+x $@-t &&                                   \
            mv $@-t $@
-BUILT_SOURCES = lxc-autostart-helper
+BUILT_SOURCES = lxc-autostart-helper lxc.service lxc-net.service
 
-install-systemd: lxc.service lxc-devsetup lxc-autostart-helper
+install-systemd: lxc.service lxc-net.service lxc-devsetup lxc-autostart-helper
        $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
-       $(INSTALL_DATA) lxc.service $(DESTDIR)$(SYSTEMD_UNIT_DIR)/
+       $(INSTALL_DATA) lxc.service lxc-net.service $(DESTDIR)$(SYSTEMD_UNIT_DIR)/
 
 uninstall-systemd:
        rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/lxc.service
+       rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/lxc-net.service
        rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
 
 pkglibexec_SCRIPTS = lxc-devsetup lxc-autostart-helper
diff --git a/config/init/systemd/lxc-net.service.in b/config/init/systemd/lxc-net.service.in
new file mode 100644 (file)
index 0000000..37d1d69
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=LXC network bridge setup
+After=network.target
+Before=lxc.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=@DATADIR@/lxc/lxc.net start
+ExecStop=@DATADIR@/lxc/lxc.net stop
index 0a428a34667c17d0b45daff2e14b47bfe802f02e..c7f2813a78381e845d2d7ff13858f5619055fd3b 100644 (file)
@@ -1,6 +1,7 @@
 [Unit]
 Description=LXC Container Initialization and Autoboot Code
 After=syslog.target network.target
+Wants=lxc-net.service
 
 [Service]
 Type=oneshot
index db8e43a71964a269428ec961b4a7ad683234f65a..edae96f444274542e01b8a52fac409dda310d5c0 100644 (file)
@@ -614,6 +614,7 @@ AC_CONFIG_FILES([
        config/init/sysvinit/lxc
        config/init/systemd/Makefile
        config/init/systemd/lxc.service
+       config/init/systemd/lxc-net.service
        config/init/upstart/Makefile
        config/etc/Makefile
        config/templates/Makefile