tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

On linux, potentially setting INIT_SYSTEM=systemd?



Hi folks,

I needed to have a tunable for "is this a systemd system?" for a PLIST
variable, and figured INIT_SYSTEM is the right way to put it.

I'm hesitating to commit this because it might have unexpected effects,
what should I watch out for?

diff --git a/mk/platform/Linux.mk b/mk/platform/Linux.mk
index dc29ae418ca2..27723afb7057 100644
--- a/mk/platform/Linux.mk
+++ b/mk/platform/Linux.mk
@@ -216,3 +216,7 @@ OPSYS_HAS_SENDFILE= # defined
 OPSYS_HAS_EVENTFD=     # defined
 OPSYS_HAS_TIMERFD=     # defined
 OPSYS_HAS_POSIX_SPAWN= # defined
+
+.if exists(/run/systemd/system)
+INIT_SYSTEM?=          systemd
+.endif



-----

And then I used it like so, to resolve a PLIST issue:

diff --git a/www/yaws/Makefile b/www/yaws/Makefile
index 4d8f8a4d2b38..7cfa5580d786 100644
--- a/www/yaws/Makefile
+++ b/www/yaws/Makefile
@@ -45,6 +45,13 @@ CONF_FILES=          ${EGDIR}/yaws.conf ${PKG_SYSCONFDIR}/yaws.conf
 RCD_SCRIPTS=           yaws
 RCD_SCRIPT_SRC.yaws=   ${WRKSRC}/scripts/netbsd/yaws.sh
 
+PLIST_VARS+=   systemd rc.d
+.if ${INIT_SYSTEM} == "systemd"
+PLIST.systemd=         yes
+.else
+PLIST.rc.d=            yes
+.endif
+
 WWWDIR=                        ${PREFIX}/share/yaws/www
 
 OWN_DIRS=              ${VARBASE}/log/yaws
diff --git a/www/yaws/PLIST.Linux b/www/yaws/PLIST.Linux
index c16d9de16222..c08e636abd7e 100644
--- a/www/yaws/PLIST.Linux
+++ b/www/yaws/PLIST.Linux
@@ -1,3 +1,3 @@
 @comment $NetBSD: PLIST.Linux,v 1.1 2020/03/20 11:39:43 tnn Exp $
-lib/yaws/priv/lib/yaws_sendfile_drv.la
-share/examples/init.d/yaws
+${PLIST.rc.d}share/examples/init.d/yaws
+${PLIST.systemd}share/examples/systemd/system/yaws.service



Home | Main Index | Thread Index | Old Index