Skip to contentSkip to conversation

sysstat: Correct our systemd unit file

PATCH New Peter Kjellerstedt 1 participant 2 messages Nov 13, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sysstat: Correct our systemd unit file

In commit 8862f21e (sysstat: 12.1.3 -> 12.1.6), sa_lib_dir was changed from "${libdir}/sa" to "${libexecdir}/sa" to avoid problems with multilib. However, the systemd unit file was not changed accordingly, which lead to the following error when trying to start the service:

systemd[4698]: sysstat.service: Failed at step EXEC spawning /usr/lib/sa/sa1: No such file or directory

---
 meta/recipes-extended/sysstat/sysstat.inc             | 4 ++--
 meta/recipes-extended/sysstat/sysstat/sysstat.service | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
meta/recipes-extended/sysstat/sysstat.inc +2 -2
index 5a7d2114ca..9394090136 100644
@@ -49,7 +49,7 @@ do_install() {
 	        if ${@bb.utils.contains('PACKAGECONFIG', 'cron', 'false', 'true', d)}; then
 			install -d ${D}${systemd_unitdir}/system
 			install -m 0644 ${WORKDIR}/sysstat.service ${D}${systemd_unitdir}/system
-			sed -i -e 's#@LIBDIR@#${libdir}#g' ${D}${systemd_unitdir}/system/sysstat.service
+			sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_unitdir}/system/sysstat.service
 	        fi
 	fi
 }
@@ -62,6 +62,6 @@ pkg_postinst_${PN} () {
 	fi
 }
 
-FILES_${PN} += "${libdir}/sa ${systemd_system_unitdir}"
+FILES_${PN} += "${systemd_system_unitdir}"
 
 TARGET_CC_ARCH += "${LDFLAGS}"
meta/recipes-extended/sysstat/sysstat/sysstat.service +1 -1
index aff07109f5..ca46befb99 100644
@@ -5,7 +5,7 @@ Description=Resets System Activity Logs
 Type=oneshot
 RemainAfterExit=yes
 User=root
-ExecStart=@LIBDIR@/sa/sa1 --boot
+ExecStart=@LIBEXECDIR@/sa/sa1 --boot
 
 [Install]
 WantedBy=multi-user.target
Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/2 sysstat: Correct when to use the package provided systemd unit files

There have been a number of changes back and forth as to when and how to use the systemd unit files provided by the package. The correct condition is actually that both cron and systemd need to be enabled for them to be installed.

---
 meta/recipes-extended/sysstat/sysstat.inc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-extended/sysstat/sysstat.inc +4 -2
index 9394090136..62de36b44b 100644
@@ -17,7 +17,7 @@ DEPENDS += "base-passwd"
 # autotools-brokensep as this package doesn't use automake
 inherit autotools-brokensep gettext systemd upstream-version-is-even
 
-PACKAGECONFIG ??= ""
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
 PACKAGECONFIG[lm-sensors] = "--enable-sensors,--disable-sensors,lmsensors,lmsensors-libsensors"
 PACKAGECONFIG[cron] = "--enable-install-cron --enable-copy-only,--disable-install-cron --disable-copy-only"
 PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_system_unitdir}"
@@ -46,7 +46,9 @@ do_install() {
 	        echo "d ${localstatedir}/log/sa - - - -" \
 		     > ${D}${sysconfdir}/tmpfiles.d/sysstat.conf
 
-	        if ${@bb.utils.contains('PACKAGECONFIG', 'cron', 'false', 'true', d)}; then
+		# Unless both cron and systemd are enabled, install our own
+		# systemd unit file. Otherwise the package will install one.
+	        if ${@bb.utils.contains('PACKAGECONFIG', 'cron systemd', 'false', 'true', d)}; then
 			install -d ${D}${systemd_unitdir}/system
 			install -m 0644 ${WORKDIR}/sysstat.service ${D}${systemd_unitdir}/system
 			sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_unitdir}/system/sysstat.service
Signature · 1 line
2.21.0