ledmanager: Add LED_ORG_JSON_PATTERNS to filter installed json files
Since not all machines need to install all the files in the configs
directory, LED_ORG_JSON_PATTERNS is added to selectively install the
json files required by each machine. By default, the variable is
initialized to match the dbus sub-directories.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I026e2bd8bd0efd717c79a026f97aa95f7054a335
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/meta-phosphor/recipes-phosphor/leds/phosphor-led-manager_git.bb b/meta-phosphor/recipes-phosphor/leds/phosphor-led-manager_git.bb
index 40f6af4..0fda6c8 100644
--- a/meta-phosphor/recipes-phosphor/leds/phosphor-led-manager_git.bb
+++ b/meta-phosphor/recipes-phosphor/leds/phosphor-led-manager_git.bb
@@ -24,6 +24,18 @@
PV = "1.0+git${SRCPV}"
PR = "r1"
+LED_ORG_JSON_PATTERNS ??= "${@ d.getVar('OBMC_ORG_YAML_SUBDIRS').replace('/', '.')}"
+LED_CONFIG_GREP_ARGS = "${@ ''.join([ ' -e ' + x for x in d.getVar('LED_ORG_JSON_PATTERNS').split() ])}"
+do_install:append() {
+ for f in "${D}${datadir}/${PN}/"*.json ;
+ do
+ if ! echo "$(basename $f)" | grep -q ${LED_CONFIG_GREP_ARGS};
+ then
+ rm -f ${f}
+ fi
+ done
+}
+
SYSTEMD_PACKAGES = "${PN} ${PN}-faultmonitor"
S = "${WORKDIR}/git"
SYSTEMD_SERVICE:${PN} += "obmc-led-group-start@.service obmc-led-group-stop@.service"