diff mbox series

[meta-webserver] netdata: WebUI choice between all (default), v0, v1 or v2

Message ID 20241103143038.186087-1-jan.vermaete@gmail.com
State Accepted
Headers show
Series [meta-webserver] netdata: WebUI choice between all (default), v0, v1 or v2 | expand

Commit Message

Jan Vermaete Nov. 3, 2024, 2:30 p.m. UTC
Added a PACKAGECONFIG to select the version of the WebUI to be installed.
When not set, all versions (v0, v1 and v2) will be installed.  What is the
default of Netdata.

Enabling only the v1 version makes the package 25% smaller.

More info: https://github.com/netdata/netdata/issues/15640#issuecomment-1946041083

Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
---
 .../netdata/netdata_1.47.5.bb                 | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox series

Patch

diff --git a/meta-webserver/recipes-webadmin/netdata/netdata_1.47.5.bb b/meta-webserver/recipes-webadmin/netdata/netdata_1.47.5.bb
index 88dbe19e4..7693335da 100644
--- a/meta-webserver/recipes-webadmin/netdata/netdata_1.47.5.bb
+++ b/meta-webserver/recipes-webadmin/netdata/netdata_1.47.5.bb
@@ -75,6 +75,10 @@  PACKAGECONFIG[cups] = "-DENABLE_PLUGIN_CUPS=ON,-DENABLE_PLUGIN_CUPS=OFF,cups"
 PACKAGECONFIG[systemd] = "-DENABLE_PLUGIN_SYSTEMD_JOURNAL=ON,-DENABLE_PLUGIN_SYSTEMD_JOURNAL=OFF,systemd"
 PACKAGECONFIG[docker] = ",,virtual/docker, virtual/docker"
 PACKAGECONFIG[go] = "-DENABLE_PLUGIN_GO=ON, -DENABLE_PLUGIN_GO=OFF"
+# WebUI (packageconfig not set: v0, v1 & v2)
+PACKAGECONFIG[webui_v0] = ",,,,,webui_v1 webui_v2"
+PACKAGECONFIG[webui_v1] = ",,,,,webui_v0 webui_v2"
+PACKAGECONFIG[webui_v2] = ",,,,,webui_v0 webui_v1"
 
 # ebpf doesn't compile (or detect) the cross compilation well
 EXTRA_OECMAKE += "-DENABLE_PLUGIN_EBPF=OFF -DBUILD_FOR_PACKAGING=${@bb.utils.contains('DISTRO_FEATURES','systemd','ON','OFF',d)} \
@@ -123,6 +127,22 @@  do_install:append() {
     install --group netdata --owner netdata --directory ${D}${localstatedir}/cache/netdata
     install --group netdata --owner netdata --directory ${D}${localstatedir}/lib/netdata
 
+    # webUI
+    if  "${@bb.utils.contains('PACKAGECONFIG', 'webui_v0', 'true', 'false', d)}"; then
+        rm -rf ${D}${datadir}/netdata/web/v1
+        rm -rf ${D}${datadir}/netdata/web/v2
+        install -m 0644 ${D}${datadir}/netdata/web/v0/index.html ${D}${datadir}/netdata/web/
+    fi
+    if "${@bb.utils.contains('PACKAGECONFIG', 'webui_v1', 'true', 'false', d)}"; then
+        rm -rf ${D}${datadir}/netdata/web/v0
+        rm -rf ${D}${datadir}/netdata/web/v2
+        install -m 0644 ${D}${datadir}/netdata/web/v1/index.html ${D}${datadir}/netdata/web/
+    fi
+    if "${@bb.utils.contains('PACKAGECONFIG', 'webui_v2', 'true', 'false', d)}"; then
+        rm -rf ${D}${datadir}/netdata/web/v0
+        rm -rf ${D}${datadir}/netdata/web/v1
+        install -m 0644 ${D}${datadir}/netdata/web/v2/index.html ${D}${datadir}/netdata/web/
+    fi
     chown -R netdata:netdata ${D}${datadir}/netdata/web
 }