settings: meta-zaius: add override
Zaius had a way to override the reboot policy setting. Make sure that
still works with the new settings application.
Change-Id: I51e32705b9aa4787fadab211f57b5fdcf75a3207
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/settings/phosphor-settings-manager.bbappend b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/settings/phosphor-settings-manager.bbappend
new file mode 100644
index 0000000..5a54204
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/settings/phosphor-settings-manager.bbappend
@@ -0,0 +1,2 @@
+FILESEXTRAPATHS_append_zaius := ":${THISDIR}/${PN}"
+SRC_URI_append_zaius = " file://powerpolicy-default-ALWAYS_POWER_ON.override.yml"
diff --git a/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/settings/phosphor-settings-manager/powerpolicy-default-ALWAYS_POWER_ON.override.yml b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/settings/phosphor-settings-manager/powerpolicy-default-ALWAYS_POWER_ON.override.yml
new file mode 100644
index 0000000..5b88341
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/settings/phosphor-settings-manager/powerpolicy-default-ALWAYS_POWER_ON.override.yml
@@ -0,0 +1,5 @@
+---
+/xyz/openbmc_project/control/host0/power_restore_policy:
+ Interface: xyz.openbmc_project.Control.Power.RestorePolicy
+ Defaults:
+ PowerRestorePolicy: RestorePolicy::Policy::AlwaysOn
diff --git a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb
index dcc6fe3..525a9fd 100644
--- a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb
+++ b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb
@@ -24,7 +24,39 @@
RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces"
S = "${WORKDIR}/git"
+SRC_URI += "file://merge_settings.py"
EXTRA_OECONF = " \
SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \
"
+
+# Collect files in SRC_URI that end in ".override.yml" and call a script that
+# writes their contents over that of settings.yaml, which is then updated to
+# the merged data values.
+# This doesn't correctly handle globs in ".override.yml" entries in SRC_URI.
+python do_merge_settings () {
+ import subprocess
+
+ # TODO: Perform the merge in a temporary directory?
+ workdir = d.getVar('WORKDIR', True)
+ nativedir = d.getVar('STAGING_DIR_NATIVE', True)
+ settingsdir = d.getVar('settings_datadir', True)
+ settingsdir = settingsdir[1:]
+ settingsdir = os.path.join(nativedir, settingsdir)
+ cmd = []
+ cmd.append(os.path.join(workdir, 'merge_settings.py'))
+ cmd.append(os.path.join(settingsdir, 'defaults.yaml'))
+
+ fetch = bb.fetch2.Fetch([], d)
+ override_urls = filter(lambda f: f.endswith('.override.yml'), fetch.urls)
+ for url in override_urls:
+ bb.debug(2, 'Overriding with source: ' + url)
+ local_base = os.path.basename(fetch.localpath(url))
+ filename = os.path.join(workdir, local_base)
+ cmd.append(filename)
+
+ # Invoke the script and don't catch any resulting exception.
+ subprocess.check_call(cmd)
+}
+# python-pyyaml-native is installed by do_configure, so put this task after
+addtask merge_settings after do_configure before do_compile
diff --git a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings/merge_settings.py b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager/merge_settings.py
similarity index 100%
rename from meta-phosphor/common/recipes-phosphor/settings/phosphor-settings/merge_settings.py
rename to meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager/merge_settings.py
diff --git a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings/merge_settings.py b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings/merge_settings.py
new file mode 120000
index 0000000..f1395f0
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings/merge_settings.py
@@ -0,0 +1 @@
+../phosphor-settings-manager/merge_settings.py
\ No newline at end of file