systemd: limit bbclass hooks to class-target scope

Allow the phosphor systemd and dbus bbclasses to be inherited
by recipes using BBCLASSEXTEND (native, etc).  No-op in non-target
recipe class context.

Tested:  Built an image and verified dbus and systemd unit files.
Change-Id: Ib2f64233f89d05679c568527a074d9236729201f
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/classes/obmc-phosphor-dbus-service.bbclass b/classes/obmc-phosphor-dbus-service.bbclass
index 029d260..77fffe0 100644
--- a/classes/obmc-phosphor-dbus-service.bbclass
+++ b/classes/obmc-phosphor-dbus-service.bbclass
@@ -124,6 +124,11 @@
             % (d.getVar('dbus_system_servicesdir', True), search_match))
 
 
+    if d.getVar('CLASSOVERRIDE', True) != 'class-target':
+        return
+
+    d.appendVarFlag('do_install', 'postfuncs', ' dbus_do_postinst')
+
     for pkg in listvar_to_list(d, 'DBUS_PACKAGES'):
         if pkg not in (d.getVar('SYSTEMD_PACKAGES', True) or ''):
             set_append(d, 'SYSTEMD_PACKAGES', pkg)
@@ -169,6 +174,4 @@
         done
 }
 
-do_install[postfuncs] += "dbus_do_postinst"
-
 inherit obmc-phosphor-systemd
diff --git a/classes/obmc-phosphor-systemd.bbclass b/classes/obmc-phosphor-systemd.bbclass
index c6a2e69..3a3234f 100644
--- a/classes/obmc-phosphor-systemd.bbclass
+++ b/classes/obmc-phosphor-systemd.bbclass
@@ -198,6 +198,11 @@
         add_sd_user(d, '%s' % dest, pkg)
 
 
+    if d.getVar('CLASSOVERRIDE', True) != 'class-target':
+        return
+
+    d.appendVarFlag('do_install', 'postfuncs', ' systemd_do_postinst')
+
     pn = d.getVar('PN', True)
     if d.getVar('SYSTEMD_SERVICE_%s' % pn, True) is None:
         d.setVar('SYSTEMD_SERVICE_%s' % pn, '%s.service' % pn)
@@ -326,6 +331,3 @@
                         ${D}${systemd_system_unitdir}/$s
         done
 }
-
-
-do_install[postfuncs] += "systemd_do_postinst"