#!/bin/sh set -e confhandler () { conffile=$1 template=$2 if [ -r $conffile ] ; then pwd=`grep '^rootpw ' $conffile | head -1 | sed 's/rootpw *//'` fi if [ -z "$pwd" -o "$pwd" = "secret" ] ; then pwd=`mkpasswd -s 0 | tr '/' 'x'` fi tempfile=`mktemp` sed "s/\(rootpw *\)secret/\1$pwd/" $template > $tempfile ucf $tempfile $conffile rm $tempfile chown openldap:openldap $conffile } if [ "$1" = "configure" ] ; then confhandler /etc/bdii/bdii-slapd.conf /usr/share/bdii/bdii-slapd.conf confhandler /etc/bdii/bdii-top-slapd.conf /usr/share/bdii/bdii-top-slapd.conf chown openldap:openldap /var/lib/bdii chown openldap:openldap /var/lib/bdii/gip chown openldap:openldap /var/lib/bdii/gip/ldif chown openldap:openldap /var/lib/bdii/gip/provider chown openldap:openldap /var/lib/bdii/gip/plugin chown openldap:openldap /var/log/bdii fi if [ "$1" = "configure" ] ; then APP_PROFILE=/etc/apparmor.d/usr.sbin.slapd LOCAL_APP_PROFILE=/etc/apparmor.d/local/usr.sbin.slapd if [ ! -r "$LOCAL_APP_PROFILE" ] ; then # Create the local profile if it does not yet exist tmp=`mktemp` cat < "$tmp" # Site-specific additions and overrides for usr.sbin.slapd. # For more details, please see /etc/apparmor.d/local/README. EOM mkdir -p `dirname $LOCAL_APP_PROFILE` 2>/dev/null || true mv -f "$tmp" "$LOCAL_APP_PROFILE" chmod 644 "$LOCAL_APP_PROFILE" fi grep -q "AppArmor profile for bdii" "$LOCAL_APP_PROFILE" || \ cat <> "$LOCAL_APP_PROFILE" # AppArmor profile for bdii START #include /etc/bdii/* r, /var/lib/bdii/db/** rwk, /run/bdii/db/* w, # AppArmor profile for bdii END EOM if [ -r "$APP_PROFILE" ] ; then # Reload the profile if aa-status --enabled 2>/dev/null ; then apparmor_parser -r -T -W "$APP_PROFILE" || true fi fi fi # Automatically added by dh_installinit/13.16 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/bdii" ]; then update-rc.d bdii defaults-disabled >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native bdii $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.16 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if deb-systemd-helper debian-installed 'bdii.service'; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'bdii.service' >/dev/null || true if deb-systemd-helper --quiet was-enabled 'bdii.service'; then # Create new symlinks, if any. deb-systemd-helper enable 'bdii.service' >/dev/null || true fi fi # Update the statefile to add new symlinks (if any), which need to be cleaned # up on purge. Also remove old symlinks. deb-systemd-helper update-state 'bdii.service' >/dev/null || true fi # End automatically added section # Automatically added by dh_installsystemd/13.16 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'bdii.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.16 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'bdii-slapd.service' >/dev/null || true fi fi # End automatically added section