From 4eceffc5e563f588b93ef53c7b35dfd83fad35fc Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Thu, 21 Mar 2019 19:08:15 -0400 Subject: 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. (From meta-phosphor rev: 1a4e65e5847e299348b5f28ffa2b4b1837769deb) Change-Id: Ideb12d62461b3b18ff5c92f3a76f1aa20c94a269 Tested: Built witherspoon image and verified rootfs unchanged. Signed-off-by: Brad Bishop --- .../phosphor-nslcd-authority-cert-config.bb | 23 +++++++++++++++----- .../phosphor-nslcd-authority-cert-config/env | 9 ++++++++ .../obmc/cert/authority | 9 -------- .../certificate/phosphor-nslcd-cert-config.bb | 25 ++++++++++++++++------ .../certificate/phosphor-nslcd-cert-config/env | 9 ++++++++ .../phosphor-nslcd-cert-config/obmc/cert/nslcd | 9 -------- 6 files changed, 55 insertions(+), 29 deletions(-) create mode 100644 meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/env delete mode 100644 meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/obmc/cert/authority create mode 100644 meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config/env delete mode 100644 meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config/obmc/cert/nslcd diff --git a/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config.bb b/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config.bb index 4e240ad38a..d41de2b599 100644 --- a/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config.bb +++ b/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config.bb @@ -5,11 +5,24 @@ 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/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/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/env b/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/env new file mode 100644 index 0000000000..849d695b51 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/env @@ -0,0 +1,9 @@ +#REST URI endpoint +#example: /xyz/openbmc_project/certs/authority/ldap +ENDPOINT=ldap + +#Path for the certificate file +CERTPATH=/etc/ssl/certs/Root-CA.pem + +#Type of service +TYPE=authority diff --git a/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/obmc/cert/authority b/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/obmc/cert/authority deleted file mode 100644 index 849d695b51..0000000000 --- a/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-authority-cert-config/obmc/cert/authority +++ /dev/null @@ -1,9 +0,0 @@ -#REST URI endpoint -#example: /xyz/openbmc_project/certs/authority/ldap -ENDPOINT=ldap - -#Path for the certificate file -CERTPATH=/etc/ssl/certs/Root-CA.pem - -#Type of service -TYPE=authority diff --git a/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config.bb b/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config.bb index c1dacfdcf9..d344851fc0 100644 --- a/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config.bb +++ b/meta-phosphor/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/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config/env b/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config/env new file mode 100644 index 0000000000..8ac1bf77ef --- /dev/null +++ b/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config/env @@ -0,0 +1,9 @@ +#REST URI endpoint +#example: /xyz/openbmc_project/certs/client/ldap +ENDPOINT=ldap + +#Path for the certificate file +CERTPATH=/etc/nslcd/certs/cert.pem + +#Type of the service client/server +TYPE=client diff --git a/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config/obmc/cert/nslcd b/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config/obmc/cert/nslcd deleted file mode 100644 index 8ac1bf77ef..0000000000 --- a/meta-phosphor/recipes-phosphor/certificate/phosphor-nslcd-cert-config/obmc/cert/nslcd +++ /dev/null @@ -1,9 +0,0 @@ -#REST URI endpoint -#example: /xyz/openbmc_project/certs/client/ldap -ENDPOINT=ldap - -#Path for the certificate file -CERTPATH=/etc/nslcd/certs/cert.pem - -#Type of the service client/server -TYPE=client -- cgit v1.2.3