[new-type] __openldap_server: sudo make nico.happy.

This commit is contained in:
evilham 2019-12-09 19:59:15 +01:00
parent 1ad605a509
commit 42914d26c5

View file

@ -9,11 +9,10 @@ slapd_modules=$(cat "${__object}/parameter/module" || true)
schemas=$(cat "${__object}/parameter/schema") schemas=$(cat "${__object}/parameter/schema")
OS="$(cat "${__global}/explorer/os")" os="$(cat "${__global}/explorer/os")"
# Setup OS-dependent vars # Setup OS-dependent vars
# TODO: treat other OS better, defaulting to Debian-like case "${os}" in
case "${OS}" in
freebsd) freebsd)
PKGS="openldap-server" PKGS="openldap-server"
ETC="/usr/local/etc" ETC="/usr/local/etc"
@ -26,7 +25,7 @@ case "${OS}" in
slapd_modules="back_mdb back_monitor" slapd_modules="back_mdb back_monitor"
fi fi
;; ;;
*) debian|ubuntu|devuan)
PKGS="slapd ldap-utils" PKGS="slapd ldap-utils"
ETC="/etc" ETC="/etc"
SLAPD_DIR="/etc/ldap" SLAPD_DIR="/etc/ldap"
@ -37,6 +36,10 @@ case "${OS}" in
slapd_modules="back_mdb ppolicy syncprov back_monitor" slapd_modules="back_mdb ppolicy syncprov back_monitor"
fi fi
;; ;;
*)
echo "Don't know the openldap defaults for: $os" >&2
exit 1
;;
esac esac
@ -106,28 +109,32 @@ done
# TODO: Implement __start_on_boot for BSD # TODO: Implement __start_on_boot for BSD
require="__package/slapd" __start_on_boot slapd require="__package/slapd" __start_on_boot slapd
# TODO: treat other OS better. Defaulting to Debian-like. case "${os}" in
if [ "${OS}" != "freebsd" ]; then debian|ubuntu|devuan)
require="__package/slapd" __line rm_slapd_conf \ require="__package/slapd" __line rm_slapd_conf \
--file ${ETC}/default/slapd \ --file ${ETC}/default/slapd \
--regex 'SLAPD_CONF=.*' \ --regex 'SLAPD_CONF=.*' \
--state absent --state absent
require="__package/slapd" __line rm_slapd_services \ require="__package/slapd" __line rm_slapd_services \
--file ${ETC}/default/slapd \ --file ${ETC}/default/slapd \
--regex 'SLAPD_SERVICES=.*' \ --regex 'SLAPD_SERVICES=.*' \
--state absent --state absent
require="__line/rm_slapd_conf" __line add_slapd_conf \ require="__line/rm_slapd_conf" __line add_slapd_conf \
--file ${ETC}/default/slapd \ --file ${ETC}/default/slapd \
--line 'SLAPD_CONF=${SLAPD_DIR}/slapd.conf' \ --line 'SLAPD_CONF=${SLAPD_DIR}/slapd.conf' \
--state present --state present
require="__line/rm_slapd_services" __line add_slapd_services \ require="__line/rm_slapd_services" __line add_slapd_services \
--file ${ETC}/default/slapd \ --file ${ETC}/default/slapd \
--line "SLAPD_SERVICES=\"ldap://localhost/ ldap://${name}/\"" \ --line "SLAPD_SERVICES=\"ldap://localhost/ ldap://${name}/\"" \
--state present --state present
fi ;;
*)
# Nothing to do here, move on.
;;
esac
if [ -z "${_skip_letsencrypt_cert}" ]; then if [ -z "${_skip_letsencrypt_cert}" ]; then