certificates: clean up config recipes
Since the config recipe packages will create symlinks to the certificate
manager template, RDEPEND rather than RRECOMMEND on the certificate
manager package (which provides the template).
Avoid obmc-phosphor-systemd. Enabling systemd units is the realm of
packaging scripts and the SYSTEMD_LINK feature in obmc-phosphor-systemd
implements this incorrectly. Just directly code install, pkg_postinst
and pkg_prerm here rather than trying to fix obmc-phosphor-systemd - the
extra indirection is more harmful to ease of comprehension for seasoned
Yocto developers than the couple of lines of code it saves.
Change-Id: I69c1a2f7978909c93c122da2a729f2dfec77562e
Tested: Built witherspoon image and verified rootfs unchanged.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config.bb b/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config.bb
index 4e240ad..d41de2b 100644
--- a/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config.bb
+++ b/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config.bb
@@ -5,11 +5,24 @@
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/LICENSE;md5=19407077e42b1ba3d653da313f1f5b4e"
-RRECOMMENDS_${PN} = "phosphor-certificate-manager"
+RDEPENDS_${PN} = "phosphor-certificate-manager"
inherit allarch
-inherit obmc-phosphor-systemd
-SYSTEMD_SERVICE_${PN} = ""
-SYSTEMD_ENVIRONMENT_FILE_${PN} = "obmc/cert/authority"
-SYSTEMD_LINK_${PN} = "../phosphor-certificate-manager@.service:${SYSTEMD_DEFAULT_TARGET}.wants/phosphor-certificate-manager@authority.service"
+SRC_URI = "file://env"
+
+do_install() {
+ install -D ${WORKDIR}/env ${D}/${sysconfdir}/default/obmc/cert/authority
+}
+
+pkg_postinst_${PN}() {
+ LINK="$D$systemd_system_unitdir/multi-user.target.wants/phosphor-certificate-manager@authority.service"
+ TARGET="../phosphor-certificate-manager@.service"
+ mkdir -p $D$systemd_system_unitdir/multi-user.target.wants
+ ln -s $TARGET $LINK
+}
+
+pkg_prerm_${PN}() {
+ LINK="$D$systemd_system_unitdir/multi-user.target.wants/phosphor-certificate-manager@authority.service"
+ rm $LINK
+}
diff --git a/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/obmc/cert/authority b/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/env
similarity index 100%
rename from recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/obmc/cert/authority
rename to recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/env
diff --git a/recipes-phosphor/certificate/phosphor-nslcd-cert-config.bb b/recipes-phosphor/certificate/phosphor-nslcd-cert-config.bb
index c1dacfd..d344851 100644
--- a/recipes-phosphor/certificate/phosphor-nslcd-cert-config.bb
+++ b/recipes-phosphor/certificate/phosphor-nslcd-cert-config.bb
@@ -1,15 +1,28 @@
-SUMMARY = "Phosphor certificate manager configuration for an nslcd certificate"
+SUMMARY = "Phosphor certificate manager configuration for a nslcd certificate"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/LICENSE;md5=19407077e42b1ba3d653da313f1f5b4e"
-RRECOMMENDS_${PN} = "phosphor-certificate-manager"
+RDEPENDS_${PN} = "phosphor-certificate-manager"
inherit allarch
-inherit obmc-phosphor-systemd
-SYSTEMD_SERVICE_${PN} = ""
-SYSTEMD_ENVIRONMENT_FILE_${PN} = "obmc/cert/nslcd"
-SYSTEMD_LINK_${PN} = "../phosphor-certificate-manager@.service:${SYSTEMD_DEFAULT_TARGET}.wants/phosphor-certificate-manager@nslcd.service"
+SRC_URI = "file://env"
+
+do_install() {
+ install -D ${WORKDIR}/env ${D}/${sysconfdir}/default/obmc/cert/nslcd
+}
+
+pkg_postinst_${PN}() {
+ LINK="$D$systemd_system_unitdir/multi-user.target.wants/phosphor-certificate-manager@nslcd.service"
+ TARGET="../phosphor-certificate-manager@.service"
+ mkdir -p $D$systemd_system_unitdir/multi-user.target.wants
+ ln -s $TARGET $LINK
+}
+
+pkg_prerm_${PN}() {
+ LINK="$D$systemd_system_unitdir/multi-user.target.wants/phosphor-certificate-manager@nslcd.service"
+ rm $LINK
+}
diff --git a/recipes-phosphor/certificate/phosphor-nslcd-cert-config/obmc/cert/nslcd b/recipes-phosphor/certificate/phosphor-nslcd-cert-config/env
similarity index 100%
rename from recipes-phosphor/certificate/phosphor-nslcd-cert-config/obmc/cert/nslcd
rename to recipes-phosphor/certificate/phosphor-nslcd-cert-config/env