#!/bin/sh set -e # source debconf library. . /usr/share/debconf/confmodule db_version 2.0 # # This is the fist part of the script. In this part an attempt # is made to get or guess the current configuration. This information # is used later on to prompt the user and to provide a sensible # default. # # find the names of services that are configured to use LDAP # Note: this function is in libnss-ldapd.config and libnss-ldapd.postrm nss_list_configured() { sed -n \ 's/^[[:space:]]*\([a-z]*\)[[:space:]]*:.*[[:space:]]ldap\([[:space:]].*\)\?/\1/p' \ /etc/nsswitch.conf } # parse /etc/nsswitch.conf and see which services have ldap specified db_get libnss-ldapd/nsswitch # find name services that currently use LDAP configured=`nss_list_configured` # separate by commas configured=`echo $configured | sed 's/ /, /g'` # store configured services either on first config or when ldap is already # configured if [ -z "$RET" ] || [ -n "$configured" ] then db_set libnss-ldapd/nsswitch "$configured" fi # # This is the second part of the script. In this part the configurable # settings will be presented to the user for approval. The postinst # will finaly perform the actual modifications. # # ask for which nsswitch options to configure db_capb multiselect db_input high libnss-ldapd/nsswitch || true db_go || true exit 0