meta-google: Remove cracklib from image and libpam dependency

The package "cracklib" is not needed. Ideally in the future we will
start using Google GLOME.

The "libpam" library depends on cracklib, so override the libpam
recipe also, so that it no longer depends on cracklib.

Tested: This has been tested locally on our local product, which uses
OpenBMC, and it appeared to work just fine for us.

Signed-off-by: Kasun Athukorala <kasunath@google.com>
Change-Id: I0d7714766a2e14151f00f6582abee78dee43614d
Signed-off-by: Josh Lehan <krellan@google.com>
diff --git a/meta-google/recipes-extended/pam/libpam_%.bbappend b/meta-google/recipes-extended/pam/libpam_%.bbappend
new file mode 100644
index 0000000..287dab7
--- /dev/null
+++ b/meta-google/recipes-extended/pam/libpam_%.bbappend
@@ -0,0 +1,15 @@
+# Remove cracklib from PAM, to avoid breaking PAM and further dependencies
+# This allows cracklib to be neatly severed from the system.
+
+EXTRA_OECONF:append:gbmc = " --disable-cracklib"
+
+DEPENDS:remove:gbmc = "cracklib"
+
+RDEPENDS:${PN}-runtime:remove:gbmc = "pam-plugin-cracklib-suffix"
+
+RDEPENDS:${PN}-xtests:remove:gbmc = "${MLPREFIX}pam-plugin-cracklib-${libpam_suffix}"
+
+do_install:append:gbmc() {
+    # Remove reference to cracklib library from PAM config file
+    sed -i '/pam_cracklib.so/d' ${D}${sysconfdir}/pam.d/common-password
+}
diff --git a/meta-google/recipes-phosphor/images/obmc-phosphor-image.bbappend b/meta-google/recipes-phosphor/images/obmc-phosphor-image.bbappend
index 570493b..d421fdf 100644
--- a/meta-google/recipes-phosphor/images/obmc-phosphor-image.bbappend
+++ b/meta-google/recipes-phosphor/images/obmc-phosphor-image.bbappend
@@ -26,3 +26,7 @@
 # Add gBMC update recipes
 OBMC_IMAGE_EXTRA_INSTALL:append:gbmc = " dummy-gbmc-update"
 OBMC_IMAGE_EXTRA_INSTALL:append:gbmc = " virtual/bmc-update"
+
+# Jettison the cracklib package to save space.
+PACKAGE_INSTALL:remove:gbmc = "cracklib pam-plugin-cracklib"
+PACKAGE_EXCLUDE:gbmc = "cracklib pam-plugin-cracklib"