[meta-swupdate,v6,1/2] swupdate: back to init system specific packaging
diff mbox series

Message ID 20191110194625.32119-2-adrian.freihofer@siemens.com
State Changes Requested
Headers show
Series
  • swupdate: improve systemd config
Related show

Commit Message

Freihofer, Adrian Nov. 10, 2019, 7:46 p.m. UTC
---
 recipes-support/swupdate/swupdate.inc | 58 ++++++++++++++---------------------
 1 file changed, 23 insertions(+), 35 deletions(-)

Patch
diff mbox series

diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index 65df706..9745536 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -16,27 +16,22 @@  PACKAGES =+ " \
     ${PN}-client \
     ${PN}-lua \
     ${PN}-progress \
-    ${PN}-progress-sd \
-    ${PN}-sd \
-    ${PN}-sv \
     ${PN}-tools \
     ${PN}-tools-hawkbit \
     ${PN}-usb \
-    ${PN}-usb-sd \
     ${PN}-www \
 "
 
 FILES_${PN}-client = "${bindir}/swupdate-client"
 FILES_${PN}-lua += "${libdir}/lua/"
-FILES_${PN}-progress = "${bindir}/swupdate-progress"
-FILES_${PN}-progress-sd = "${systemd_system_unitdir}/swupdate-progress.service"
-FILES_${PN}-sd = " \
-    ${systemd_system_unitdir}/swupdate.socket \
-    ${systemd_system_unitdir}/swupdate.service \
+FILES_${PN}-progress = " \
+    ${bindir}/swupdate-progress \
+    ${systemd_system_unitdir}/swupdate-progress.service \
+"
+FILES_${PN}-usb = " \
+    ${sysconfdir}/udev/rules.d/swupdate-usb.rules \
+    ${systemd_system_unitdir}/swupdate-usb@.service \
 "
-FILES_${PN}-sv = "${sysconfdir}/init.d/*"
-FILES_${PN}-usb = "${sysconfdir}/udev/rules.d/swupdate-usb.rules"
-FILES_${PN}-usb-sd = "${systemd_system_unitdir}/swupdate-usb@.service"
 FILES_${PN}-tools-hawkbit = " \
     ${bindir}/swupdate-hawkbitcfg \
     ${bindir}/swupdate-sendtohawkbit \
@@ -44,15 +39,16 @@  FILES_${PN}-tools-hawkbit = " \
 FILES_${PN} += " \
     ${libdir}/tmpfiles.d \
     ${libdir}/swupdate/* \
+    ${systemd_system_unitdir}/swupdate.socket \
+    ${systemd_system_unitdir}/swupdate.service \
+    ${sysconfdir}/init.d/* \
 "
 FILES_${PN}-www = " \
     ${libdir}/swupdate/conf.d/*mongoose* \
     /www/* \
 "
 
-RDEPENDS_${PN}-progress += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'swupdate-progress-sd', '', d)}"
-RDEPENDS_${PN}-usb += "${PN}-client ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'swupdate-usb-sd', '', d)}"
-RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'swupdate-sd', 'swupdate-sv', d)}"
+RDEPENDS_${PN}-usb += "${PN}-client"
 
 # The tools package is deprecated, it is an empty meta package for backward compatibility
 RDEPENDS_${PN}-tools += "${PN}-client ${PN}-progress ${PN}-tools-hawkbit ${PN}-usb"
@@ -150,14 +146,14 @@  python () {
 }
 
 do_configure () {
-    # Always install systemd support and the swupdate.sh shell wrapper.
-    # This allows to build swupdate packages init manager agnostic and splitt the file to separate packages.
-    #grep -v 'CONFIG_SYSTEMD' ${WORKDIR}/defconfig > ${S}/.config
-    #echo "# Global settings from swupdate recipe" >> ${S}/.config
-    #echo "CONFIG_SYSTEMD=y" >> ${S}/.config
-    #echo "CONFIG_SYSTEMD_SYSTEM_UNITDIR=\"${systemd_system_unitdir}\"" >> ${S}/.config
-
-    cp ${WORKDIR}/defconfig ${S}/.config
+    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        grep -v 'CONFIG_SYSTEMD' ${WORKDIR}/defconfig > ${S}/.config
+        echo "# Global settings from swupdate recipe" >> ${S}/.config
+        echo "CONFIG_SYSTEMD=y" >> ${S}/.config
+        echo "CONFIG_SYSTEMD_SYSTEM_UNITDIR=\"${systemd_system_unitdir}\"" >> ${S}/.config
+    else
+        cp ${WORKDIR}/defconfig ${S}/.config
+    fi
     merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
     cml1_do_configure
 }
@@ -185,15 +181,7 @@  do_install () {
 INITSCRIPT_NAME = "swupdate"
 INITSCRIPT_PARAMS = "defaults 70"
 
-SYSTEMD_PACKAGES_append = " ${PN}-sd ${PN}-progress-sd ${PN}-usb-sd"
-SYSTEMD_SERVICE_${PN}-sd = "swupdate.service"
-SYSTEMD_SERVICE_${PN}-progress-sd = "swupdate-progress.service"
-SYSTEMD_SERVICE_${PN}-usb-sd = "swupdate-usb@.service"
-
-# Prevents the systemd.bbclass from deleting scripts or service files.
-rm_systemd_unitdir () {
-    return 0
-}
-rm_sysvinit_initddir () {
-    return 0
-}
+SYSTEMD_PACKAGES = "${PN} ${PN}-progress ${PN}-usb"
+SYSTEMD_SERVICE_${PN} = "swupdate.service"
+SYSTEMD_SERVICE_${PN}-progress = "swupdate-progress.service"
+SYSTEMD_SERVICE_${PN}-usb = "swupdate-usb@.service"