diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2020-01-22 18:02:40 +0000 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2020-01-22 18:02:40 +0000 |
| commit | 1d174d4e851b1dc74c4c4778cf7d0c52d1f38142 (patch) | |
| tree | b02bc6399a9bb5dfabd6dff33da1a1c41a6b3e0a /meta-openstack/recipes-support/openldap | |
| parent | a401a1c3d86eb00bab8bfccba83c12cc67ce06a1 (diff) | |
| download | meta-cloud-services-1d174d4e851b1dc74c4c4778cf7d0c52d1f38142.tar.gz | |
bbappends: make distro feature safe
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'meta-openstack/recipes-support/openldap')
| -rw-r--r-- | meta-openstack/recipes-support/openldap/openldap_2.4.39.bbappend | 74 | ||||
| -rw-r--r-- | meta-openstack/recipes-support/openldap/openldap_openstack.inc | 73 |
2 files changed, 74 insertions, 73 deletions
diff --git a/meta-openstack/recipes-support/openldap/openldap_2.4.39.bbappend b/meta-openstack/recipes-support/openldap/openldap_2.4.39.bbappend index 63f6064..025ee4e 100644 --- a/meta-openstack/recipes-support/openldap/openldap_2.4.39.bbappend +++ b/meta-openstack/recipes-support/openldap/openldap_2.4.39.bbappend | |||
| @@ -1,73 +1 @@ | |||
| 1 | DEPEND_${PN} += "cyrus-sasl" | require ${@bb.utils.contains('DISTRO_FEATURES', 'openstack', '${BPN}_openstack.inc', '', d)} | |
| 2 | RDEPEND_${PN} += "libsasl2-modules" | ||
| 3 | |||
| 4 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
| 5 | SRC_URI += "file://initscript" | ||
| 6 | SRC_URI += "file://ops-base.ldif" | ||
| 7 | |||
| 8 | LDAP_DN ?= "dc=my-domain,dc=com" | ||
| 9 | LDAP_DATADIR ?= "/etc/openldap-data/" | ||
| 10 | |||
| 11 | OPENLDAP_LIBEXECDIR = "${libexecdir}" | ||
| 12 | |||
| 13 | EXTRA_OECONF += "--libexecdir=${OPENLDAP_LIBEXECDIR}" | ||
| 14 | |||
| 15 | do_install_append() { | ||
| 16 | install -D -m 0755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/openldap | ||
| 17 | sed -i -e 's/%DEFAULT_DN%/${LDAP_DN}/g' ${D}${sysconfdir}/init.d/openldap | ||
| 18 | sed -i -e 's#%LDAP_DATADIR%#${LDAP_DATADIR}#g' ${D}${sysconfdir}/init.d/openldap | ||
| 19 | # Base openldat bb installs slapd under ${sbin} | ||
| 20 | sed -i -e 's#%LIBEXEC%#${sbindir}#g' ${D}${sysconfdir}/init.d/openldap | ||
| 21 | |||
| 22 | # This is duplicated in /etc/openldap and is for slapd | ||
| 23 | rm -f ${D}${localstatedir}/openldap-data/DB_CONFIG.example | ||
| 24 | rm -rf "${D}${localstatedir}/run" | ||
| 25 | rmdir --ignore-fail-on-non-empty "${D}${localstatedir}" | ||
| 26 | |||
| 27 | # remove symlinks for backends, recreating in postinstall | ||
| 28 | rm -f ${D}/${OPENLDAP_LIBEXECDIR}/openldap/*.so | ||
| 29 | |||
| 30 | sed -i -e '/^include\s*/a \ | ||
| 31 | include /etc/openldap/schema/cosine.schema \ | ||
| 32 | include /etc/openldap/schema/nis.schema \ | ||
| 33 | include /etc/openldap/schema/inetorgperson.schema \ | ||
| 34 | include /etc/openldap/schema/misc.schema' \ | ||
| 35 | ${D}/etc/openldap/slapd.conf | ||
| 36 | |||
| 37 | sed -i -e '/^# Load dynamic backend modules:/a \ | ||
| 38 | modulepath ${OPENLDAP_LIBEXECDIR}/openldap \ | ||
| 39 | moduleload back_bdb.la' \ | ||
| 40 | ${D}/etc/openldap/slapd.conf | ||
| 41 | |||
| 42 | sed -i -e 's#^pidfile\s*.*$#pidfile ${LDAP_DATADIR}/slapd.pid#' ${D}/etc/openldap/slapd.conf | ||
| 43 | sed -i -e 's#^argsfile\s*.*$#argsfile ${LDAP_DATADIR}/slapd.args#' ${D}/etc/openldap/slapd.conf | ||
| 44 | sed -i -e 's#^directory\s*.*$#directory ${LDAP_DATADIR}/#' ${D}/etc/openldap/slapd.conf | ||
| 45 | |||
| 46 | sed -i -e 's/dc=my-domain,dc=com/${LDAP_DN}/g' ${D}/etc/openldap/slapd.conf | ||
| 47 | |||
| 48 | # modify access perms for ldap/authentication | ||
| 49 | sed -i -e '$a\ | ||
| 50 | \ | ||
| 51 | access to attrs=userPassword \ | ||
| 52 | by self write \ | ||
| 53 | by anonymous auth \ | ||
| 54 | by * none \ | ||
| 55 | \ | ||
| 56 | access to * \ | ||
| 57 | by self write \ | ||
| 58 | by * read' \ | ||
| 59 | ${D}/etc/openldap/slapd.conf | ||
| 60 | |||
| 61 | install -D -m 0644 ${WORKDIR}/ops-base.ldif ${D}/etc/openldap/ops-base.ldif | ||
| 62 | sed -i -e 's/dc=my-domain,dc=com/${LDAP_DN}/g' ${D}/etc/openldap/ops-base.ldif | ||
| 63 | |||
| 64 | mkdir ${D}/${LDAP_DATADIR} | ||
| 65 | } | ||
| 66 | |||
| 67 | inherit update-rc.d | ||
| 68 | |||
| 69 | INITSCRIPT_NAME = "openldap" | ||
| 70 | INITSCRIPT_PARAMS = "defaults" | ||
| 71 | |||
| 72 | FILES_${PN} += "${OPENLDAP_LIBEXECDIR}/* ${sysconfdir}/openldap/ops-base.ldif" | ||
| 73 | FILES_${PN}-dbg += "${OPENLDAP_LIBEXECDIR}/openldap/.debug ${OPENLDAP_LIBEXECDIR}/.debug" | ||
diff --git a/meta-openstack/recipes-support/openldap/openldap_openstack.inc b/meta-openstack/recipes-support/openldap/openldap_openstack.inc new file mode 100644 index 0000000..63f6064 --- /dev/null +++ b/meta-openstack/recipes-support/openldap/openldap_openstack.inc | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | DEPEND_${PN} += "cyrus-sasl" | ||
| 2 | RDEPEND_${PN} += "libsasl2-modules" | ||
| 3 | |||
| 4 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
| 5 | SRC_URI += "file://initscript" | ||
| 6 | SRC_URI += "file://ops-base.ldif" | ||
| 7 | |||
| 8 | LDAP_DN ?= "dc=my-domain,dc=com" | ||
| 9 | LDAP_DATADIR ?= "/etc/openldap-data/" | ||
| 10 | |||
| 11 | OPENLDAP_LIBEXECDIR = "${libexecdir}" | ||
| 12 | |||
| 13 | EXTRA_OECONF += "--libexecdir=${OPENLDAP_LIBEXECDIR}" | ||
| 14 | |||
| 15 | do_install_append() { | ||
| 16 | install -D -m 0755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/openldap | ||
| 17 | sed -i -e 's/%DEFAULT_DN%/${LDAP_DN}/g' ${D}${sysconfdir}/init.d/openldap | ||
| 18 | sed -i -e 's#%LDAP_DATADIR%#${LDAP_DATADIR}#g' ${D}${sysconfdir}/init.d/openldap | ||
| 19 | # Base openldat bb installs slapd under ${sbin} | ||
| 20 | sed -i -e 's#%LIBEXEC%#${sbindir}#g' ${D}${sysconfdir}/init.d/openldap | ||
| 21 | |||
| 22 | # This is duplicated in /etc/openldap and is for slapd | ||
| 23 | rm -f ${D}${localstatedir}/openldap-data/DB_CONFIG.example | ||
| 24 | rm -rf "${D}${localstatedir}/run" | ||
| 25 | rmdir --ignore-fail-on-non-empty "${D}${localstatedir}" | ||
| 26 | |||
| 27 | # remove symlinks for backends, recreating in postinstall | ||
| 28 | rm -f ${D}/${OPENLDAP_LIBEXECDIR}/openldap/*.so | ||
| 29 | |||
| 30 | sed -i -e '/^include\s*/a \ | ||
| 31 | include /etc/openldap/schema/cosine.schema \ | ||
| 32 | include /etc/openldap/schema/nis.schema \ | ||
| 33 | include /etc/openldap/schema/inetorgperson.schema \ | ||
| 34 | include /etc/openldap/schema/misc.schema' \ | ||
| 35 | ${D}/etc/openldap/slapd.conf | ||
| 36 | |||
| 37 | sed -i -e '/^# Load dynamic backend modules:/a \ | ||
| 38 | modulepath ${OPENLDAP_LIBEXECDIR}/openldap \ | ||
| 39 | moduleload back_bdb.la' \ | ||
| 40 | ${D}/etc/openldap/slapd.conf | ||
| 41 | |||
| 42 | sed -i -e 's#^pidfile\s*.*$#pidfile ${LDAP_DATADIR}/slapd.pid#' ${D}/etc/openldap/slapd.conf | ||
| 43 | sed -i -e 's#^argsfile\s*.*$#argsfile ${LDAP_DATADIR}/slapd.args#' ${D}/etc/openldap/slapd.conf | ||
| 44 | sed -i -e 's#^directory\s*.*$#directory ${LDAP_DATADIR}/#' ${D}/etc/openldap/slapd.conf | ||
| 45 | |||
| 46 | sed -i -e 's/dc=my-domain,dc=com/${LDAP_DN}/g' ${D}/etc/openldap/slapd.conf | ||
| 47 | |||
| 48 | # modify access perms for ldap/authentication | ||
| 49 | sed -i -e '$a\ | ||
| 50 | \ | ||
| 51 | access to attrs=userPassword \ | ||
| 52 | by self write \ | ||
| 53 | by anonymous auth \ | ||
| 54 | by * none \ | ||
| 55 | \ | ||
| 56 | access to * \ | ||
| 57 | by self write \ | ||
| 58 | by * read' \ | ||
| 59 | ${D}/etc/openldap/slapd.conf | ||
| 60 | |||
| 61 | install -D -m 0644 ${WORKDIR}/ops-base.ldif ${D}/etc/openldap/ops-base.ldif | ||
| 62 | sed -i -e 's/dc=my-domain,dc=com/${LDAP_DN}/g' ${D}/etc/openldap/ops-base.ldif | ||
| 63 | |||
| 64 | mkdir ${D}/${LDAP_DATADIR} | ||
| 65 | } | ||
| 66 | |||
| 67 | inherit update-rc.d | ||
| 68 | |||
| 69 | INITSCRIPT_NAME = "openldap" | ||
| 70 | INITSCRIPT_PARAMS = "defaults" | ||
| 71 | |||
| 72 | FILES_${PN} += "${OPENLDAP_LIBEXECDIR}/* ${sysconfdir}/openldap/ops-base.ldif" | ||
| 73 | FILES_${PN}-dbg += "${OPENLDAP_LIBEXECDIR}/openldap/.debug ${OPENLDAP_LIBEXECDIR}/.debug" | ||
