Skip to contentSkip to conversation

rsyslog: Fix systemd service creation

PATCH New Maxime Hadjinlian 2 participants 2 messages Jul 14, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rsyslog: Fix systemd service creation

The rsyslog.service is installed by rsyslog, but the link is not created so the service is not enabled.
In order to install the service file, use the correct configure flag.

So the INSTALL_INIT_SYSTEMD will create the link, it will also create another link which is due to the fact that the rsyslog.service contains an Alias=

If we were to use systemctl enable to enable the service, it would create both,so we mimic that.

---
 package/rsyslog/rsyslog.mk | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
package/rsyslog/rsyslog.mk +19 -4
index 261f59d..5b30d28 100644
@@ -57,17 +57,32 @@ else
 RSYSLOG_CONF_OPTS += --disable-uuid
 endif
 
+ifeq ($(BR2_INIT_SYSTEMD),y)
+RSYSLOG_CONF_OPTS += \
+	--enable-systemd \
+	--with-systemdsystemunitdir=/usr/lib/systemd/system
+RSYSLOG_DEPENDENCIES += systemd
+else
+RSYSLOG_CONF_OPTS += --disable-systemd
+endif
+
 define RSYSLOG_INSTALL_INIT_SYSV
 	$(INSTALL) -m 0755 -D package/rsyslog/S01logging \
 		$(TARGET_DIR)/etc/init.d/S01logging
 endef
 
+# The rsyslog.service is installed by rsyslog, but the link is not created
+# so the service is not enabled.
+# We need to create another link which is due to the fact that the
+# rsyslog.service contains an Alias=
+# If we were to use systemctl enable to enable the service, it would
+# create both,so we mimic that.
 define RSYSLOG_INSTALL_INIT_SYSTEMD
-	ln -sf /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 -sf ../../../../usr/lib/systemd/system/rsyslog.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/rsyslog.service
+	ln -sf ../../../../usr/lib/systemd/system/rsyslog.service \
+		$(TARGET_DIR)/etc/systemd/system/syslog.service
 endef
 
 define RSYSLOG_INSTALL_CONF
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 rsyslog: Fix systemd service creation

Dear Maxime Hadjinlian,

Quoted 8 lines · Maxime Hadjinlian

The rsyslog.service is installed by rsyslog, but the link is not created so the service is not enabled.
In order to install the service file, use the correct configure flag.

So the INSTALL_INIT_SYSTEMD will create the link, it will also create another link which is due to the fact that the rsyslog.service contains an Alias=

Quoted 7 lines

If we were to use systemctl enable to enable the service, it would create both,so we mimic that.

---
 package/rsyslog/rsyslog.mk | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com