Add recipe for the new settings manager

Change-Id: I28b3454c0066649b0c163616247f9ca1bbf3abb3
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/meta-phosphor/classes/phosphor-settings-manager.bbclass b/meta-phosphor/classes/phosphor-settings-manager.bbclass
new file mode 100644
index 0000000..7e554f3
--- /dev/null
+++ b/meta-phosphor/classes/phosphor-settings-manager.bbclass
@@ -0,0 +1 @@
+settings_datadir="${datadir}/phosphor-settings/default"
diff --git a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
index f570c06..8ce984f 100644
--- a/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
+++ b/meta-phosphor/common/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bb
@@ -19,6 +19,7 @@
         ${PN}-software \
         ${PN}-host-check-mgmt \
         ${PN}-debug-collector \
+        ${PN}-settings \
         "
 
 SUMMARY_${PN}-bmc-state-mgmt = "BMC state management"
@@ -91,3 +92,8 @@
 RDEPENDS_${PN}-debug-collector = " \
         ${VIRTUAL-RUNTIME_obmc-debug-collector} \
         "
+
+SUMMARY_${PN}-settings = "Settings applications"
+RDEPENDS_${PN}-settings = " \
+        ${VIRTUAL-RUNTIME_obmc-settings-mgr} \
+        "
diff --git a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-defaults.bb b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-defaults.bb
new file mode 100644
index 0000000..37b8d4e
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-defaults.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Default settings"
+PR = "r1"
+
+inherit native
+inherit obmc-phosphor-license
+inherit phosphor-settings-manager
+
+SRC_URI += "file://defaults.yaml"
+
+PROVIDES += "virtual/phosphor-settings-defaults"
+
+S = "${WORKDIR}"
+
+do_install() {
+        DEST=${D}${settings_datadir}
+        install -d ${DEST}
+        install defaults.yaml ${DEST}
+}
diff --git a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-defaults/defaults.yaml b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-defaults/defaults.yaml
new file mode 100644
index 0000000..b054bb2
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-defaults/defaults.yaml
@@ -0,0 +1,32 @@
+/xyz/openbmc_project/control/host0/auto_reboot:
+    Interface: xyz.openbmc_project.Control.Boot.RebootPolicy
+    Defaults:
+        AutoReboot: 'false'
+
+/xyz/openbmc_project/control/host0/boot_source:
+    Interface: xyz.openbmc_project.Control.Boot.Source
+    Defaults:
+        BootSource: Source::Sources::Default
+
+/xyz/openbmc_project/control/host0/boot_mode:
+    Interface: xyz.openbmc_project.Control.Boot.Mode
+    Defaults:
+        BootMode: Mode::Modes::Regular
+
+/xyz/openbmc_project/control/host0/power_cap:
+    Interface: xyz.openbmc_project.Control.Power.Cap
+
+/xyz/openbmc_project/control/host0/power_restore_policy:
+    Interface: xyz.openbmc_project.Control.Power.RestorePolicy
+    Defaults:
+        PowerRestorePolicy: RestorePolicy::Policy::Restore
+
+/xyz/openbmc_project/time/owner:
+    Interface: xyz.openbmc_project.Time.Owner
+    Defaults:
+        TimeOwner: Owner::Owners::BMC
+
+/xyz/openbmc_project/time/sync_method:
+    Interface: xyz.openbmc_project.Time.Synchronization
+    Defaults:
+        TimeSyncMethod: Synchronization::Method::NTP
diff --git a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb
new file mode 100644
index 0000000..56db58b
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.bb
@@ -0,0 +1,28 @@
+SUMMARY = "Phosphor Settings Manager"
+DESCRIPTION = "Phosphor Settings Manager is an application that creates \
+d-bus objects to represent various user settings."
+PR = "r1"
+
+inherit autotools
+inherit obmc-phosphor-dbus-service
+inherit pythonnative
+inherit phosphor-settings-manager
+
+require phosphor-settings-manager.inc
+
+DBUS_SERVICE_${PN} = "xyz.openbmc_project.Settings.service"
+
+DEPENDS += "python-pyyaml-native"
+DEPENDS += "python-mako-native"
+DEPENDS += "autoconf-archive-native"
+DEPENDS += "virtual/phosphor-settings-defaults"
+DEPENDS += "sdbusplus sdbusplus-native"
+DEPENDS += "phosphor-dbus-interfaces phosphor-dbus-interfaces-native"
+
+RDEPENDS_${PN} += "sdbusplus phosphor-dbus-interfaces"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECONF = " \
+             SETTINGS_YAML=${STAGING_DIR_NATIVE}${settings_datadir}/defaults.yaml \
+             "
diff --git a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.inc b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.inc
new file mode 100644
index 0000000..53287e8
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager.inc
@@ -0,0 +1,5 @@
+HOMEPAGE = "http://github.com/openbmc/phosphor-settingsd"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc"
+SRC_URI += "git://github.com/openbmc/phosphor-settingsd"
+SRCREV = "89872291c360dfb33824738c066a2171c3306910"
diff --git a/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager/xyz.openbmc_project.Settings.service b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager/xyz.openbmc_project.Settings.service
new file mode 100644
index 0000000..8b4be9c
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/settings/phosphor-settings-manager/xyz.openbmc_project.Settings.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Phosphor Settings Daemon
+
+[Service]
+ExecStart={sbindir}/phosphor-settings-manager
+Restart=always
+Type=dbus
+BusName={BUSNAME}
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}
diff --git a/meta-phosphor/conf/distro/include/phosphor-defaults.inc b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
index 8704075..80a5c88 100644
--- a/meta-phosphor/conf/distro/include/phosphor-defaults.inc
+++ b/meta-phosphor/conf/distro/include/phosphor-defaults.inc
@@ -121,6 +121,11 @@
 VIRTUAL-RUNTIME_phosphor-hwmon-config ?= \
     "${@cf_enabled(d, 'obmc-mrw', 'phosphor-hwmon-config-mrw')}"
 
+# obmc-settings-mgr
+#
+# Provides a manager for user settings.
+VIRTUAL-RUNTIME_obmc-settings-mgr ?= "phosphor-settings-manager"
+
 # virtual/phosphor-ipmi-fru-hostfw-config
 #
 # The phosphor-ipmi-fru application is data-driven and requires an input