phosphor-state-manager: move chassis symlinks to correct subpkg

The `multi-user.target.requires/...Chassis@{i}.service` symlinks were
being added to the `obmc-targets` sub-package, but nothing explicitly
depends on the `chassis` sub-package.  On systems that do not include
the `chassis` sub-package, this results in broken symlinks.

Move these `Chassis@{i}.service` symlinks into the `chassis`
sub-package since that is where the original service file resides.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iefc8c0bf8eb9b5f43fa67a13bf52ceb4ce55e52e
diff --git a/meta-phosphor/recipes-phosphor/state/phosphor-state-manager-systemd-links.inc b/meta-phosphor/recipes-phosphor/state/phosphor-state-manager-systemd-links.inc
index 3a4898b..aa0dc0e 100644
--- a/meta-phosphor/recipes-phosphor/state/phosphor-state-manager-systemd-links.inc
+++ b/meta-phosphor/recipes-phosphor/state/phosphor-state-manager-systemd-links.inc
@@ -12,10 +12,6 @@
         TARGET="../xyz.openbmc_project.State.Host@.service"
         ln -s $TARGET $LINK
 
-        LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
-        TARGET="../xyz.openbmc_project.State.Chassis@.service"
-        ln -s $TARGET $LINK
-
         LINK="$D$systemd_system_unitdir/multi-user.target.requires/obmc-host-reset@${i}.target"
         TARGET="../obmc-host-reset@.target"
         ln -s $TARGET $LINK
@@ -106,6 +102,17 @@
     done
 }
 
+pkg_postinst:${PN}-chassis:append() {
+    for i in ${OBMC_HOST_INSTANCES};
+    do
+        mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
+
+        LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
+        TARGET="../xyz.openbmc_project.State.Chassis@.service"
+        ln -s $TARGET $LINK
+    done
+}
+
 pkg_postinst:${PN}-chassis-check-power-status:append() {
 
     for i in ${OBMC_HOST_INSTANCES};
@@ -185,6 +192,16 @@
     done
 }
 
+pkg_prerm:${PN}-chassis:append() {
+    for i in ${OBMC_HOST_INSTANCES};
+    do
+
+        LINK="$D$systemd_system_unitdir/multi-user.target.requires/xyz.openbmc_project.State.Chassis@${i}.service"
+        rm $LINK
+
+    done
+}
+
 pkg_prerm:${PN}-chassis-check-power-status:append() {
 
     for i in ${OBMC_HOST_INSTANCES};