rpcbind: add systemd support
authorAurélien Chabot <aurelien@chabot.fr>
Sun, 19 Jul 2015 21:02:39 +0000 (23:02 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 27 Jul 2015 21:45:01 +0000 (23:45 +0200)
systemd files taken from Arch Linux.

[Thomas:
 - fix indentation
 - indicate source of systemd files.]

Signed-off-by: Aurélien Chabot <aurelien@chabot.fr>
Acked-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/rpcbind/rpcbind.mk
package/rpcbind/rpcbind.service [new file with mode: 0644]
package/rpcbind/rpcbind.socket [new file with mode: 0644]

index 1e28af9e9a5791f137277870ed3c49ba9856f1d5..4360d1f47a3fda139bcfb2658deb012f684358e6 100644 (file)
@@ -14,11 +14,27 @@ RPCBIND_CONF_ENV += \
        CFLAGS="$(TARGET_CFLAGS) `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`"
 RPCBIND_DEPENDENCIES += libtirpc host-pkgconf
 RPCBIND_CONF_OPTS += --with-rpcuser=root
+
+ifeq ($(BR2_INIT_SYSTEMD),y)
+RPCBIND_CONF_OPTS += --with-systemdsystemunitdir=/usr/lib/systemd/system
+else
 RPCBIND_CONF_OPTS += --with-systemdsystemunitdir=no
+endif
+
+define RPCBIND_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -m 0755 -D package/rpcbind/rpcbind.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/rpcbind.service
+       $(INSTALL) -m 0755 -D package/rpcbind/rpcbind.socket \
+               $(TARGET_DIR)/usr/lib/systemd/system/rpcbind.socket
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/sockets.target.wants
+       ln -fs ../../../../usr/lib/systemd/system/rpcbind.socket \
+               $(TARGET_DIR)/etc/systemd/system/sockets.target.wants/rpcbind.socket
+endef
 
 define RPCBIND_INSTALL_INIT_SYSV
        $(INSTALL) -m 0755 -D package/rpcbind/S30rpcbind \
                $(TARGET_DIR)/etc/init.d/S30rpcbind
 endef
 
+
 $(eval $(autotools-package))
diff --git a/package/rpcbind/rpcbind.service b/package/rpcbind/rpcbind.service
new file mode 100644 (file)
index 0000000..b7a32a1
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=RPC bind service
+Requires=rpcbind.socket
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/rpcbind
+
+[Install]
+Also=rpcbind.socket
diff --git a/package/rpcbind/rpcbind.socket b/package/rpcbind/rpcbind.socket
new file mode 100644 (file)
index 0000000..d63c1d9
--- /dev/null
@@ -0,0 +1,8 @@
+[Unit]
+Description=RPCbind Server Activation Socket
+
+[Socket]
+ListenStream=/var/run/rpcbind.sock
+
+[Install]
+WantedBy=sockets.target