meta-phosphor: ldap: nsswitch: add rootfs posthook

An ldap image feature was recently added.  If the image feature is used
without the distro feature, nsswitch will have the wrong content and the
function won't work.  Move this logic to a rootfs post hook so that the
distro feature is not required (and can be deprecated) and because this
is the expected way to make these sorts of modifications to base files
anyway.

Change-Id: I216c666a149802d73a69897b57b144642d83db5e
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/classes/obmc-phosphor-image.bbclass b/classes/obmc-phosphor-image.bbclass
index 1c744ca..5961839 100644
--- a/classes/obmc-phosphor-image.bbclass
+++ b/classes/obmc-phosphor-image.bbclass
@@ -84,3 +84,11 @@
         echo "SYSTEMD_PAGER=" >> ${IMAGE_ROOTFS}${sysconfdir}/profile
         echo "export SYSTEMD_PAGER" >> ${IMAGE_ROOTFS}${sysconfdir}/profile
 }
+
+enable_ldap_nsswitch() {
+    sed -i 's/\(\(passwd\|group\|shadow\):\s*\).*/\1files ldap/' \
+        "${IMAGE_ROOTFS}${sysconfdir}/nsswitch.conf"
+}
+
+ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('IMAGE_FEATURES', 'obmc-user-mgmt-ldap', 'enable_ldap_nsswitch ;', '', d)}"
+