[systemd-devel] [PATCH v2] networkd: disable tmpfiles and sysusers bits associated with networkd

Ɓukasz Stelmach l.stelmach at samsung.com
Mon Nov 24 00:28:57 PST 2014


On a system configured without networkd and sysusers there still needs
to be the unnecessary systemd-network user, otherwise systemd-tmpfiles
fails to start.

Use m4 to include information associated with networkd in tmpfiles.d and
sysusers.d conditionally. Do not install it if netwrorkd is not enabled.
---
 Makefile.am                |  4 ++++
 configure.ac               |  1 +
 sysusers.d/.gitignore      |  1 +
 sysusers.d/systemd.conf    | 12 ------------
 sysusers.d/systemd.conf.m4 | 14 ++++++++++++++
 tmpfiles.d/.gitignore      |  3 ++-
 tmpfiles.d/systemd.conf    | 32 --------------------------------
 tmpfiles.d/systemd.conf.m4 | 34 ++++++++++++++++++++++++++++++++++
 8 files changed, 56 insertions(+), 45 deletions(-)
 delete mode 100644 sysusers.d/systemd.conf
 create mode 100644 sysusers.d/systemd.conf.m4
 delete mode 100644 tmpfiles.d/systemd.conf
 create mode 100644 tmpfiles.d/systemd.conf.m4

diff --git a/Makefile.am b/Makefile.am
index fae946a..69d9c9e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5821,6 +5821,10 @@ src/%: src/%.m4
 	$(AM_V_at)$(MKDIR_P) $(dir $@)
 	$(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
 
+sysusers.d/%: sysusers.d/%.m4
+	$(AM_V_at)$(MKDIR_P) $(dir $@)
+	$(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
+
 tmpfiles.d/%: tmpfiles.d/%.m4
 	$(AM_V_at)$(MKDIR_P) $(dir $@)
 	$(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
diff --git a/configure.ac b/configure.ac
index c3b4ea3..5ec2e6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1050,6 +1050,7 @@ AC_ARG_ENABLE(networkd, AS_HELP_STRING([--disable-networkd], [disable networkd])
 AS_IF([test "x$enable_networkd" != "xno"], [
         AC_DEFINE(ENABLE_NETWORKD, 1, [Define if networkd support is to be enabled])
         have_networkd=yes
+        M4_DEFINES="$M4_DEFINES -DENABLE_NETWORKD"
 ])
 AM_CONDITIONAL(ENABLE_NETWORKD, [test "x$have_networkd" = "xyes"])
 
diff --git a/sysusers.d/.gitignore b/sysusers.d/.gitignore
index f7957a9..bb3aaaf 100644
--- a/sysusers.d/.gitignore
+++ b/sysusers.d/.gitignore
@@ -1 +1,2 @@
 /basic.conf
+/systemd.conf
diff --git a/sysusers.d/systemd.conf b/sysusers.d/systemd.conf
deleted file mode 100644
index 95437b8..0000000
--- a/sysusers.d/systemd.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-g systemd-journal   - -
-u systemd-bus-proxy - "systemd Bus Proxy"
-u systemd-network   - "systemd Network Management"
-u systemd-resolve   - "systemd Resolver"
-u systemd-timesync  - "systemd Time Synchronization"
diff --git a/sysusers.d/systemd.conf.m4 b/sysusers.d/systemd.conf.m4
new file mode 100644
index 0000000..eeb13fb
--- /dev/null
+++ b/sysusers.d/systemd.conf.m4
@@ -0,0 +1,14 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+g systemd-journal   - -
+u systemd-bus-proxy - "systemd Bus Proxy"
+m4_ifdef(`ENABLE_NETWORKD',
+u systemd-network   - "systemd Network Management"
+)m4_dnl
+u systemd-resolve   - "systemd Resolver"
+u systemd-timesync  - "systemd Time Synchronization"
diff --git a/tmpfiles.d/.gitignore b/tmpfiles.d/.gitignore
index eb32315..4f0ecaa 100644
--- a/tmpfiles.d/.gitignore
+++ b/tmpfiles.d/.gitignore
@@ -1 +1,2 @@
-etc.conf
+/etc.conf
+/systemd.conf
diff --git a/tmpfiles.d/systemd.conf b/tmpfiles.d/systemd.conf
deleted file mode 100644
index 9ca5ad2..0000000
--- a/tmpfiles.d/systemd.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# See tmpfiles.d(5) for details
-
-d /run/user 0755 root root -
-F! /run/utmp 0664 root utmp -
-
-d /run/systemd/ask-password 0755 root root -
-d /run/systemd/seats 0755 root root -
-d /run/systemd/sessions 0755 root root -
-d /run/systemd/users 0755 root root -
-d /run/systemd/machines 0755 root root -
-d /run/systemd/shutdown 0755 root root -
-d /run/systemd/netif 0755 systemd-network systemd-network -
-d /run/systemd/netif/links 0755 systemd-network systemd-network -
-d /run/systemd/netif/leases 0755 systemd-network systemd-network -
-
-d /run/log 0755 root root -
-
-z /run/log/journal 2755 root systemd-journal - -
-Z /run/log/journal/%m ~2750 root systemd-journal - -
-
-z /var/log/journal 2755 root systemd-journal - -
-z /var/log/journal/%m 2755 root systemd-journal - -
-
-d /var/lib/systemd 0755 root root -
-d /var/lib/systemd/coredump 0755 root root 3d
diff --git a/tmpfiles.d/systemd.conf.m4 b/tmpfiles.d/systemd.conf.m4
new file mode 100644
index 0000000..ad05f43
--- /dev/null
+++ b/tmpfiles.d/systemd.conf.m4
@@ -0,0 +1,34 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+# See tmpfiles.d(5) for details
+
+d /run/user 0755 root root -
+F! /run/utmp 0664 root utmp -
+
+d /run/systemd/ask-password 0755 root root -
+d /run/systemd/seats 0755 root root -
+d /run/systemd/sessions 0755 root root -
+d /run/systemd/users 0755 root root -
+d /run/systemd/machines 0755 root root -
+d /run/systemd/shutdown 0755 root root -
+m4_ifdef(`ENABLE_NETWORKD',
+d /run/systemd/netif 0755 systemd-network systemd-network -
+d /run/systemd/netif/links 0755 systemd-network systemd-network -
+d /run/systemd/netif/leases 0755 systemd-network systemd-network -
+)m4_dnl
+
+d /run/log 0755 root root -
+
+z /run/log/journal 2755 root systemd-journal - -
+Z /run/log/journal/%m ~2750 root systemd-journal - -
+
+z /var/log/journal 2755 root systemd-journal - -
+z /var/log/journal/%m 2755 root systemd-journal - -
+
+d /var/lib/systemd 0755 root root -
+d /var/lib/systemd/coredump 0755 root root 3d
-- 
2.0.4



More information about the systemd-devel mailing list