acpi-power-state-daemon: install templated service correctly

The latest yocto update is flagging an error on machines using this
recipe. The reason appears to be because the templated services are
added to the SYSTEMD_SERVICE variable but they are not properly
installed into the filesystem.

Install the templated service file utilizing a more direct and tested
method.

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I8f856e43244cc766fcec92ba9e21a6b98c9dbd03
diff --git a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon_%.bbappend b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon_%.bbappend
index 0c20dc4..a472a7b 100644
--- a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon_%.bbappend
+++ b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon_%.bbappend
@@ -18,7 +18,6 @@
 SYSTEMD_SERVICE:${PN}:append:gbs = " \
     gbs-host-s0-set-failsafe.service \
     gbs-host-s5-set-failsafe.service \
-    gbs-host-set-boot-failsafe@${CHASSIS_INSTANCE}.service \
     gbs-check-host-state.service \
     gbs-host-ready.target \
     "
@@ -41,3 +40,20 @@
     install -m 0644 ${WORKDIR}/gbs-check-host-state.service ${D}${systemd_system_unitdir}
     install -m 0644 ${WORKDIR}/gbs-host-ready.target ${D}${systemd_system_unitdir}
 }
+
+pkg_postinst:${PN}:append() {
+    mkdir -p $D$systemd_system_unitdir/gbs-host-ready.target.wants
+    for i in ${OBMC_CHASSIS_INSTANCES};
+    do
+        LINK="$D$systemd_system_unitdir/gbs-host-ready.target.wants/gbs-host-set-boot-failsafe@${i}.service"
+        TARGET="../gbs-host-set-boot-failsafe@.service"
+        ln -s $TARGET $LINK
+    done
+}
+pkg_prerm:${PN}:append() {
+    for i in ${OBMC_CHASSIS_INSTANCES};
+    do
+        LINK="$D$systemd_system_unitdir/gbs-host-ready.target.wants/gbs-host-set-boot-failsafe@${i}.service"
+        rm $LINK
+    done
+}