systemd service file cleanups
cover systemd service file cleanups
All,
This set of patches fixes and cleans up some systemd service files for various packages.
avahi was build-tested on both systemd and busybox init. psplash started but failed due to lack of a framebuffer on my device. rsyslog, ofono, and connman appeared to be working correctly.
The previous versions of this series also moved the systemd installation location, and fixed a number of packages' udev rules installation directory. For now, I recommend those patches be dropped. When systemd is built to be installed in its default directory, it no longer searches /lib/udev for rules as the upstream default is /usr/lib/udev.
Unfortunately, it appears that either many packages are built assuming an un-split /usr/lib and /lib, or they are only tested on systems where systemd is installed to /lib when the split exists. I'm not sure its worth the effort to patch all of these upstream packages, and I instead recommend that we merge /lib and /usr/lib for systemd systems.
Finally, the gpsd patch has been dropped for now because it was attempting to incorrectly interact with the host systemd.
Mike Williams (5):
avahi: systemd cleanups
psplash: move systemd service files to /usr/lib
rsyslog: fix systemd service installation
ofono: enable systemd service by default
connman: enable systemd service by default
package/avahi/0002-disable-systemd-support.patch | 22 ---------------------- package/avahi/avahi.mk | 12 ++++++++++-- package/connman/connman.mk | 5 +++++ package/ofono/ofono.mk | 6 ++++++ package/psplash/psplash.mk | 8 ++++---- package/rsyslog/rsyslog.mk | 7 ++++--- 6 files changed, 29 insertions(+), 31 deletions(-) delete mode 100644 package/avahi/0002-disable-systemd-support.patch
Signature · 1 line
2.1.4
PATCH 1/5 avahi: systemd cleanups
* Move service files to /usr/lib/systemd/system/
* Only disable systemd support on non-systemd systems
--- package/avahi/0002-disable-systemd-support.patch | 22 ---------------------- package/avahi/avahi.mk | 12 ++++++++++-- 2 files changed, 10 insertions(+), 24 deletions(-) delete mode 100644 package/avahi/0002-disable-systemd-support.patch
package/avahi/0002-disable-systemd-support.patch deleted +0 -22
@@ -1,22 +0,0 @@ -[PATCH] avahi-daemon: disable systemd support - -Disable systemd support as it isn't needed for BR, and uses SOCK_CLOEXEC -which isn't available on uClibc. - -Signed-off-by: Peter Korsgaard <[email protected]> ---- - avahi-daemon/sd-daemon.h | 1 + - 1 file changed, 1 insertion(+) - -Index: avahi-0.6.27/avahi-daemon/sd-daemon.h -=================================================================== ---- avahi-0.6.27.orig/avahi-daemon/sd-daemon.h -+++ avahi-0.6.27/avahi-daemon/sd-daemon.h -@@ -66,6 +66,7 @@ extern "C" { - - See sd-daemon(7) for more information. - */ -+#define DISABLE_SYSTEMD /* no systemd support in BR */ - - #if __GNUC__ >= 4 - #define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
package/avahi/avahi.mk +10 -2
@@ -88,6 +88,12 @@ AVAHI_DEPENDENCIES = \ $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext) host-intltool \ host-pkgconf host-gettext +AVAHI_CFLAGS = $(TARGET_CFLAGS) + +ifneq ($(BR2_PACKAGE_SYSTEMD),y) +AVAHI_CFLAGS += -DDISABLE_SYSTEMD +endif + ifneq ($(BR2_PACKAGE_AVAHI_DAEMON)$(BR2_PACKAGE_AVAHI_AUTOIPD),) AVAHI_DEPENDENCIES += libdaemon else
@@ -154,6 +160,8 @@ else AVAHI_CONF_OPTS += --disable-python-dbus endif +AVAHI_CONF_ENV += CFLAGS="$(AVAHI_CFLAGS)" + AVAHI_MAKE_OPTS += $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),LIBS=-lintl) define AVAHI_USERS
@@ -185,10 +193,10 @@ ifeq ($(BR2_PACKAGE_AVAHI_DAEMON),y) define AVAHI_INSTALL_INIT_SYSTEMD mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants - ln -fs /lib/systemd/system/avahi-daemon.service \ + ln -fs ../../../../usr/lib/systemd/system/avahi-daemon.service \ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/avahi-daemon.service - ln -fs /lib/systemd/system/avahi-dnsconfd.service \ + ln -fs ../../../../usr/lib/systemd/system/avahi-dnsconfd.service \ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/avahi-dnsconfd.service $(INSTALL) -D -m 644 package/avahi/avahi_tmpfiles.conf \
Signature · 1 line
2.1.4
PATCH 1/5 avahi: systemd cleanups
Dear Mike Williams,
Quoted 1 line · Mike Williams
+ifneq ($(BR2_PACKAGE_SYSTEMD),y)
We normally use:
ifeq ($(BR2_PACKAGE_SYSTEMD),)
instead.
Other than that, applied.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 2/5 psplash: move systemd service files to /usr/lib
In reply to Mike Williams--- package/psplash/psplash.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
package/psplash/psplash.mk +4 -4
@@ -11,15 +11,15 @@ PSPLASH_AUTORECONF = YES define PSPLASH_INSTALL_INIT_SYSTEMD $(INSTALL) -D -m 644 package/psplash/psplash-start.service \ - $(TARGET_DIR)/etc/systemd/system/psplash-start.service + $(TARGET_DIR)/usr/lib/systemd/system/psplash-start.service $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants - ln -sf ../psplash-start.service \ + ln -sf ../../../../usr/lib/systemd/system/psplash-start.service \ $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants/ $(INSTALL) -D -m 644 package/psplash/psplash-quit.service \ - $(TARGET_DIR)/etc/systemd/system/psplash-quit.service + $(TARGET_DIR)/usr/lib/systemd/system/psplash-quit.service $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants - ln -sf ../psplash-quit.service \ + ln -sf ../../../../usr/lib/systemd/system/psplash-quit.service \ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/ endef
Signature · 1 line
2.1.4
PATCH 2/5 psplash: move systemd service files to /usr/lib
Dear Mike Williams,
Quoted 10 lines · Mike Williams
Signed-off-by Mike Williams <[email protected]>--- package/psplash/psplash.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)package/psplash/psplash.mk +0
-0
package/psplash/psplash.mk PSPLASH_AUTORECONF = YES · line 17
Quoted 9 lines
package/psplash/psplash.mk +2
-2@@ -11,15 +11,15 @@ PSPLASH_AUTORECONF = YES define PSPLASH_INSTALL_INIT_SYSTEMD $(INSTALL) -D -m 644 package/psplash/psplash-start.service \ - $(TARGET_DIR)/etc/systemd/system/psplash-start.service + $(TARGET_DIR)/usr/lib/systemd/system/psplash-start.service $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants - ln -sf ../psplash-start.service \ + ln -sf ../../../../usr/lib/systemd/system/psplash-start.service \ $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants/
We usually use a full destination path here.
package/psplash/psplash.mk PSPLASH_AUTORECONF = YES · line 23
Quoted 8 lines
package/psplash/psplash.mk +2
-2$(INSTALL) -D -m 644 package/psplash/psplash-quit.service \ - $(TARGET_DIR)/etc/systemd/system/psplash-quit.service + $(TARGET_DIR)/usr/lib/systemd/system/psplash-quit.service $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants - ln -sf ../psplash-quit.service \ + ln -sf ../../../../usr/lib/systemd/system/psplash-quit.service \ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/
And here.
Nonetheless, I've applied the patch as is, I'll let you decide in which direction the systemd service installation commands should be made consistent across packages.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 3/5 rsyslog: fix systemd service installation
In reply to Mike Williams--- package/rsyslog/rsyslog.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
package/rsyslog/rsyslog.mk +4 -3
@@ -65,11 +65,12 @@ define RSYSLOG_INSTALL_INIT_SYSV endef define RSYSLOG_INSTALL_INIT_SYSTEMD - ln -sf /lib/systemd/system/rsyslog.service \ + mkdir -p $(TARGET_DIR)/etc/systemd/system + ln -fs ../../../usr/lib/systemd/system/rsyslog.service \ $(TARGET_DIR)/etc/systemd/system/syslog.service mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants - ln -sf ../syslog.service \ - $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/syslog.service + ln -fs ../../../../usr/lib/systemd/system/rsyslog.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/rsyslog.service endef define RSYSLOG_INSTALL_CONF
Signature · 1 line
2.1.4
PATCH 3/5 rsyslog: fix systemd service installation
Dear Mike Williams,
package/rsyslog/rsyslog.mk define RSYSLOG_INSTALL_INIT_SYSV · line 70
Quoted 5 lines · Mike Williams
define
RSYSLOG_INSTALL_INIT_SYSTEMDpackage/rsyslog/rsyslog.mk +2
-1- ln -sf /lib/systemd/system/rsyslog.service \ + mkdir -p $(TARGET_DIR)/etc/systemd/system + ln -fs ../../../usr/lib/systemd/system/rsyslog.service \ $(TARGET_DIR)/etc/systemd/system/syslog.service
Why are we doing this link? In all other systemd service installation, we:
1/ install to /usr/lib/systemd/system/ when the service file has not
been installed by the package build system itself.
2/ create a symlink
from /etc/systemd/system/multi-user.target.wants/<foo>.service to /usr/lib/systemd/system/rsyslog.service
Why would we need this additional symlink here?
(Remember that when you're talking to me, you're talking to a complete system newbie.)
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 4/5 ofono: enable systemd service by default
In reply to Mike Williams--- package/ofono/ofono.mk | 6 ++++++ 1 file changed, 6 insertions(+)
package/ofono/ofono.mk +6 -0
@@ -26,6 +26,12 @@ define OFONO_INSTALL_INIT_SYSV $(INSTALL) -m 0755 -D package/ofono/S46ofono $(TARGET_DIR)/etc/init.d/S46ofono endef +define OFONO_INSTALL_INIT_SYSTEMD + mkdir -p $(TARGET_DIR)/etc/systemd/systemd/multi-user.target.wants + ln -fs ../../../../usr/lib/systemd/system/ofono.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants +endef + ifeq ($(BR2_PACKAGE_HAS_UDEV),y) OFONO_CONF_OPTS += --enable-udev OFONO_DEPENDENCIES += udev
Signature · 1 line
2.1.4
Thomas Petazzoni
AppliedPATCH 4/5 ofono: enable systemd service by default
Dear Mike Williams,
Quoted 4 lines · Mike Williams
Signed-off-by Mike Williams <[email protected]>--- package/ofono/ofono.mk | 6 ++++++ 1 file changed, 6 insertions(+)
Applied, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 5/5 connman: enable systemd service by default
In reply to Mike Williams--- package/connman/connman.mk | 5 +++++ 1 file changed, 5 insertions(+)
package/connman/connman.mk +5 -0
@@ -31,6 +31,11 @@ define CONNMAN_INSTALL_INIT_SYSV $(INSTALL) -m 0755 -D package/connman/S45connman $(TARGET_DIR)/etc/init.d/S45connman endef +define CONNMAN_INSTALL_INIT_SYSTEMD + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + ln -fs ../../../../usr/lib/systemd/system/connman.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/connman.service +endef ifeq ($(BR2_PACKAGE_CONNMAN_CLIENT),y) CONNMAN_CONF_OPTS += --enable-client
Signature · 1 line
2.1.4
Thomas Petazzoni
AppliedPATCH 5/5 connman: enable systemd service by default
Dear Mike Williams,
Quoted 4 lines · Mike Williams
Signed-off-by Mike Williams <[email protected]>--- package/connman/connman.mk | 5 +++++ 1 file changed, 5 insertions(+)
Applied, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com