bare-metal-host-monitor: Use service type notify

We want to be able to start other services after this daemon has
finished its startup code. So, this commit updates the host-gpio-monitor
code to notify systemd when the initialization is done.

Tested:
Set the bare metal flag /var/google/config-package/enable-bm.flag
Did a power cycle, and confirmed the services started in the expected
order.

Change-Id: I51d1aed7509795852f5873f71ae6ba57401ae6b9
Signed-off-by: John Wedig <johnwedig@google.com>
diff --git a/subprojects/bare-metal-host-monitor/host-gpio-monitor@.service.in b/subprojects/bare-metal-host-monitor/host-gpio-monitor@.service.in
index e4accf2..3e1f6a1 100644
--- a/subprojects/bare-metal-host-monitor/host-gpio-monitor@.service.in
+++ b/subprojects/bare-metal-host-monitor/host-gpio-monitor@.service.in
@@ -5,6 +5,7 @@
 After=xyz.openbmc_project.Chassis.Control.Power@%i.service
 
 [Service]
+Type=notify
 Restart=always
 ExecStart=@@BIN@ host_gpio_monitor --host_label %i
 
diff --git a/subprojects/bare-metal-host-monitor/host_gpio_monitor.cpp b/subprojects/bare-metal-host-monitor/host_gpio_monitor.cpp
index 17af6f6..d1755b5 100644
--- a/subprojects/bare-metal-host-monitor/host_gpio_monitor.cpp
+++ b/subprojects/bare-metal-host-monitor/host_gpio_monitor.cpp
@@ -4,6 +4,8 @@
 
 #include "host_gpio_monitor_conf.hpp"
 
+#include <systemd/sd-daemon.h>
+
 #include <boost/asio/io_context.hpp>
 #include <boost/asio/steady_timer.hpp>
 #include <phosphor-logging/lg2.hpp>
@@ -100,6 +102,10 @@
 
         /* check IPMI status at startup */
         checkPostCompleteStartup(conn, host_label);
+
+        /* Notify that the service is done starting up. */
+        sd_notify(0, "READY=1");
+
         /*
          * Set up an event handler to process Post Complete GPIO state changes.
          */