Skip to content

Commit

Permalink
Add systemd unit for lxc.net
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
martinpitt authored and stgraber committed Aug 4, 2014
1 parent 213b0fe commit 65b27d8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions config/init/systemd/Makefile.am
@@ -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
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions config/init/systemd/lxc-net.service.in
@@ -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
1 change: 1 addition & 0 deletions config/init/systemd/lxc.service.in
@@ -1,6 +1,7 @@
[Unit]
Description=LXC Container Initialization and Autoboot Code
After=syslog.target network.target
Wants=lxc-net.service

[Service]
Type=oneshot
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Expand Up @@ -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
Expand Down

0 comments on commit 65b27d8

Please sign in to comment.