Move services into repo

Add the services from meta-witherspoon into this repo.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I3e652b56d5635d3b31ac0ba32f9be2ebfb950ab7
diff --git a/meson.build b/meson.build
index 9cc02ad..45212d5 100644
--- a/meson.build
+++ b/meson.build
@@ -23,6 +23,22 @@
 sdbuspp = find_program('sdbus++')
 sdeventplus = dependency('sdeventplus')
 
+systemd = dependency('systemd')
+servicedir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+
+services = [
+    'power-supply-monitor@.service',
+    'pseq-monitor-pgood.service',
+    'pseq-monitor.service'
+]
+
+foreach service : services
+  configure_file(input: 'services/' + service,
+                 output: service,
+                 copy: true,
+                 install_dir: servicedir)
+endforeach
+
 conf = configuration_data()
 conf.set_quoted(
     'INPUT_HISTORY_BUSNAME_ROOT', get_option('input-history-busname-root'))
diff --git a/services/power-supply-monitor@.service b/services/power-supply-monitor@.service
new file mode 100644
index 0000000..bf02758
--- /dev/null
+++ b/services/power-supply-monitor@.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Power Supply %I Monitor
+Wants=mapper-wait@-xyz-openbmc_project-inventory-system-chassis-motherboard-powersupply%i.service
+After=mapper-wait@-xyz-openbmc_project-inventory-system-chassis-motherboard-powersupply%i.service
+Wants=mapper-wait@-org-openbmc-control-power0.service
+After=mapper-wait@-org-openbmc-control-power0.service
+ConditionPathExists={envfiledir}/obmc/power-supply-monitor/power-supply-monitor-%i.conf
+
+[Service]
+EnvironmentFile={envfiledir}/obmc/power-supply-monitor/power-supply-monitor-%i.conf
+ExecStart=/usr/bin/env psu-monitor --path=${{DEVPATH}} --instance=${{INSTANCE}} --inventory=${{INVENTORY}} --num-history-records=${{NUM_HISTORY_RECORDS}} --sync-gpio-path=${{SYNC_GPIO_PATH}} --sync-gpio-num=${{SYNC_GPIO_NUM}}
+SyslogIdentifier=psu-monitor
+
+[Install]
+RequiredBy=multi-user.target
diff --git a/services/pseq-monitor-pgood.service b/services/pseq-monitor-pgood.service
new file mode 100644
index 0000000..206fc66
--- /dev/null
+++ b/services/pseq-monitor-pgood.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Power Sequencer Power-on Monitor
+Wants=op-power-start@0.service
+After=op-power-start@0.service
+Conflicts=obmc-chassis-poweroff@0.target
+ConditionPathExists=!/run/openbmc/chassis@0-on
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/env pseq-monitor -a pgood-monitor -i 5000
+SyslogIdentifier=pseq-monitor
diff --git a/services/pseq-monitor.service b/services/pseq-monitor.service
new file mode 100644
index 0000000..8ce3b37
--- /dev/null
+++ b/services/pseq-monitor.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Power Sequencer Runtime Monitor
+Wants=obmc-host-start-pre@0.target
+Before=obmc-host-start-pre@0.target
+After=obmc-power-on@0.target
+Conflicts=obmc-chassis-poweroff@0.target
+
+[Service]
+ExecStart=/usr/bin/env pseq-monitor -a runtime-monitor -i 500
+SyslogIdentifier=pseq-monitor