diff options
| author | Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com> | 2024-10-01 16:14:24 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2024-10-02 19:54:53 -0700 |
| commit | d801dfaa24f321b996b3fe42bb575766f17c0be3 (patch) | |
| tree | 427991c3accfab30e341d62c7686daa461db373f | |
| parent | 5ac897fae9b09ff607ee37a1b0e0cee08988a83b (diff) | |
| download | meta-openembedded-d801dfaa24f321b996b3fe42bb575766f17c0be3.tar.gz | |
netdata: use builtin packaging service files
Netdata now provides its own systemd service files. They provide better
hardening than the one we were defining in the recipe.
Unfortunately, the CMakeLists.txt file wants to install them into /lib
rather than /usr/lib. I added mv commands to put them in the expected
location depending on usrmerge.
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-webserver/recipes-webadmin/netdata/netdata/0002-Do-not-hardcode-systemd-unit-directories.patch | 38 | ||||
| -rw-r--r-- | meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb | 20 |
2 files changed, 49 insertions, 9 deletions
diff --git a/meta-webserver/recipes-webadmin/netdata/netdata/0002-Do-not-hardcode-systemd-unit-directories.patch b/meta-webserver/recipes-webadmin/netdata/netdata/0002-Do-not-hardcode-systemd-unit-directories.patch new file mode 100644 index 0000000000..f8509e993a --- /dev/null +++ b/meta-webserver/recipes-webadmin/netdata/netdata/0002-Do-not-hardcode-systemd-unit-directories.patch | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | From 67b9343e986ac6c9e3482bec938aa31deaab3ce7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com> | ||
| 3 | Date: Tue, 1 Oct 2024 17:01:33 +0200 | ||
| 4 | Subject: [PATCH] Do not hardcode systemd unit directories | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [oe-core specific] | ||
| 7 | Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com> | ||
| 8 | --- | ||
| 9 | CMakeLists.txt | 6 +++--- | ||
| 10 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 13 | index 622bf88..ef3a771 100644 | ||
| 14 | --- a/CMakeLists.txt | ||
| 15 | +++ b/CMakeLists.txt | ||
| 16 | @@ -2533,7 +2533,7 @@ if(BUILD_FOR_PACKAGING) | ||
| 17 | install(FILES | ||
| 18 | ${CMAKE_BINARY_DIR}/system/systemd/netdata.service | ||
| 19 | COMPONENT netdata | ||
| 20 | - DESTINATION lib/systemd/system) | ||
| 21 | + DESTINATION $ENV{systemd_system_unitdir}) | ||
| 22 | install(DIRECTORY | ||
| 23 | COMPONENT netdata | ||
| 24 | DESTINATION usr/lib/systemd/journald@netdata.conf.d) | ||
| 25 | @@ -2622,11 +2622,11 @@ if(NOT OS_WINDOWS) | ||
| 26 | install(FILES | ||
| 27 | ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service | ||
| 28 | COMPONENT netdata | ||
| 29 | - DESTINATION lib/systemd/system) | ||
| 30 | + DESTINATION $ENV{systemd_system_unitdir}) | ||
| 31 | install(FILES | ||
| 32 | system/systemd/netdata-updater.timer | ||
| 33 | COMPONENT netdata | ||
| 34 | - DESTINATION lib/systemd/system) | ||
| 35 | + DESTINATION $ENV{systemd_system_unitdir}) | ||
| 36 | endif() | ||
| 37 | endif() | ||
| 38 | |||
diff --git a/meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb b/meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb index 4138614597..347680870a 100644 --- a/meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb +++ b/meta-webserver/recipes-webadmin/netdata/netdata_1.47.1.bb | |||
| @@ -7,13 +7,13 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=fc9b848046ef54b5eaee6071947abd24" | |||
| 7 | 7 | ||
| 8 | DEPENDS += "json-c libuv libyaml util-linux zlib lz4" | 8 | DEPENDS += "json-c libuv libyaml util-linux zlib lz4" |
| 9 | 9 | ||
| 10 | SRC_URI = "\ | 10 | SRC_URI = " \ |
| 11 | https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BPN}-v${PV}.tar.gz \ | 11 | https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BPN}-v${PV}.tar.gz \ |
| 12 | file://0001-cmake-Add-check-for-64bit-builtin-atomics.patch \ | 12 | file://0001-cmake-Add-check-for-64bit-builtin-atomics.patch \ |
| 13 | file://0002-Do-not-hardcode-systemd-unit-directories.patch \ | ||
| 13 | file://netdata.conf \ | 14 | file://netdata.conf \ |
| 14 | file://netdata.service \ | ||
| 15 | file://netdata-volatiles.conf \ | 15 | file://netdata-volatiles.conf \ |
| 16 | " | 16 | " |
| 17 | SRC_URI[sha256sum] = "fb970a4b571ffd542b7d24220ef806a4c1b56c535e0f549a9978860a9f1dcc9c" | 17 | SRC_URI[sha256sum] = "fb970a4b571ffd542b7d24220ef806a4c1b56c535e0f549a9978860a9f1dcc9c" |
| 18 | 18 | ||
| 19 | UPSTREAM_CHECK_URI = "https://github.com/${BPN}/${BPN}/tags" | 19 | UPSTREAM_CHECK_URI = "https://github.com/${BPN}/${BPN}/tags" |
| @@ -36,7 +36,8 @@ export LIBS | |||
| 36 | 36 | ||
| 37 | #systemd | 37 | #systemd |
| 38 | SYSTEMD_PACKAGES = "${PN}" | 38 | SYSTEMD_PACKAGES = "${PN}" |
| 39 | SYSTEMD_SERVICE:${PN} = "netdata.service" | 39 | export SERVICE_FILES = "netdata.service netdata-updater.service netdata-updater.timer" |
| 40 | SYSTEMD_SERVICE:${PN} = "${SERVICE_FILES}" | ||
| 40 | SYSTEMD_AUTO_ENABLE:${PN} = "enable" | 41 | SYSTEMD_AUTO_ENABLE:${PN} = "enable" |
| 41 | 42 | ||
| 42 | #User specific | 43 | #User specific |
| @@ -57,7 +58,7 @@ PACKAGECONFIG[systemd] = "-DENABLE_PLUGIN_SYSTEMD_JOURNAL=ON,-DENABLE_PLUGIN_SYS | |||
| 57 | PACKAGECONFIG[docker] = ",,virtual/docker," | 58 | PACKAGECONFIG[docker] = ",,virtual/docker," |
| 58 | 59 | ||
| 59 | # ebpf doesn't compile (or detect) the cross compilation well | 60 | # ebpf doesn't compile (or detect) the cross compilation well |
| 60 | EXTRA_OECMAKE += "-DENABLE_PLUGIN_EBPF=OFF -DENABLE_PLUGIN_GO=OFF \ | 61 | EXTRA_OECMAKE += "-DENABLE_PLUGIN_EBPF=OFF -DENABLE_PLUGIN_GO=OFF -DBUILD_FOR_PACKAGING=${@bb.utils.contains('DISTRO_FEATURES','systemd','ON','OFF',d)} \ |
| 61 | -DENABLE_ACLK=OFF -DENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE=OFF -DCMAKE_INSTALL_PREFIX='${base_prefix}'" | 62 | -DENABLE_ACLK=OFF -DENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE=OFF -DCMAKE_INSTALL_PREFIX='${base_prefix}'" |
| 62 | 63 | ||
| 63 | do_install:append() { | 64 | do_install:append() { |
| @@ -67,9 +68,6 @@ do_install:append() { | |||
| 67 | 68 | ||
| 68 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | 69 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
| 69 | # Install systemd unit files | 70 | # Install systemd unit files |
| 70 | install -d ${D}${systemd_unitdir}/system | ||
| 71 | install -m 0644 ${UNPACKDIR}/netdata.service ${D}${systemd_unitdir}/system | ||
| 72 | sed -i -e 's,@@datadir,${datadir_native},g' ${D}${systemd_unitdir}/system/netdata.service | ||
| 73 | install -Dm 0644 ${UNPACKDIR}/netdata-volatiles.conf ${D}${sysconfdir}/tmpfiles.d/netdata.conf | 71 | install -Dm 0644 ${UNPACKDIR}/netdata-volatiles.conf ${D}${sysconfdir}/tmpfiles.d/netdata.conf |
| 74 | fi | 72 | fi |
| 75 | 73 | ||
| @@ -90,6 +88,10 @@ do_install:append() { | |||
| 90 | chown -R netdata:netdata ${D}${datadir}/netdata/web | 88 | chown -R netdata:netdata ${D}${datadir}/netdata/web |
| 91 | } | 89 | } |
| 92 | 90 | ||
| 93 | FILES:${PN} += "${localstatedir}/cache/netdata/ ${localstatedir}/lib/netdata/" | 91 | FILES:${PN} += " \ |
| 92 | ${localstatedir}/cache/netdata/ \ | ||
| 93 | ${localstatedir}/lib/netdata/ \ | ||
| 94 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/journald@netdata.conf.d', '', d)} \ | ||
| 95 | " | ||
| 94 | 96 | ||
| 95 | RDEPENDS:${PN} = "bash python3-core zlib" | 97 | RDEPENDS:${PN} = "bash python3-core zlib" |
