config is in phamm 0.6.2-1.2ubuntu1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | #!/bin/sh
set -e
CONFFILE="/etc/phamm/config.php"
. /usr/share/debconf/confmodule
db_version 2.0 || [ $? -lt 30 ]
# Autoconfiguration for phamm
# Let's try to read default from slapd.conf, libnss-ldap.conf or libpam_ldap.conf
if [ -f /etc/ldap/slapd.conf ]; then
ldapserver="localhost"
if grep "^TLS" /etc/ldap/slapd.conf > /dev/null 2>&1; then
tls="true"
else
tls="false"
fi
basedn=`grep ^suffix /etc/ldap/slapd.conf | awk '{print $2}' | sed -e s/\"//g`
binddn=`grep -e "by dn=.* write" /etc/ldap/slapd.conf | cut -d"\"" -f2 | head -n1`
elif [ -f /etc/libnss-ldap.conf ]; then
if grep "^host" /etc/libnss-ldap.conf > /dev/null 2>&1; then
ldapserver=`grep ^host /etc/libnss-ldap.conf | awk '{print $2}'`
elif grep "^uri" /etc/libnss-ldap.conf > /dev/null 2>&1; then
ldapserver=`grep ^uri /etc/libnss-ldap.conf | sed -e s@/@@g | awk -F : '{print $2}'`
fi
if grep "^TLS" /etc/libnss-ldap.conf > /dev/null 2>&1; then
tls="true"
else
tls="false"
fi
basedn=`grep -e "^base" /etc/libnss-ldap.conf | awk '{print $2}' | sed -e s/\"//g`
binddn=`grep -e "^rootbinddn" /etc/libnss-ldap.conf | awk '{print $2}'`
elif [ -f /etc/pam_ldap.conf ]; then
if grep "^host" /etc/pam_ldap.conf > /dev/null 2>&1; then
ldapserver=`grep ^host /etc/pam_ldap.conf | awk '{print $2}'`
elif grep "^uri" /etc/pam_ldap.conf > /dev/null 2>&1; then
ldapserver=`grep ^uri /etc/pam_ldap.conf | sed -e s@/@@g | awk -F : '{print $2}'`
fi
if grep "^TLS" /etc/pam_ldap.conf > /dev/null 2>&1; then
tls="true"
else
tls="false"
fi
basedn=`grep -e "^base" /etc/pam_ldap.conf | awk '{print $2}' | sed -e s/\"//g`
binddn=`grep -e "^rootbinddn" /etc/pam_ldap.conf | head -n1 | awk '{print $2}'`
else
if db_get slapd/domain ; then
if [ -n "$RET" ]; then
basedn="dc=`echo $RET | sed 's/^\.//; s/\./,dc=/g'`"
fi
fi
fi
# ldapserver
if [ "$ldapserver" = "" ]; then
db_input high phamm/ldap-server || true
db_go || true
db_get phamm/ldap-server || true
ldapserver="$RET"
if [ "$ldapserver" = "" ]; then
ldapserver="localhost"
fi
else
db_set phamm/ldap-server $ldapserver || true
fi
# TLS
if [ "$tls" = "" ]; then
db_input high phamm/ldap-tls || true
db_go || true
db_get phamm/ldap-tls || true
tls="$RET"
if [ "$tls" = "" ]; then
tls="false"
fi
else
db_set phamm/ldap-tls $tls || true
fi
if [ "$tls" = "true" ]; then
ldapserver="$ldapserver"
db_set phamm/ldap-server $ldapserver || true
fi
# basedn
if [ "$basedn" = "" ]; then
db_input high phamm/ldap-basedn || true
db_go || true
db_get phamm/ldap-basedn || true
basedn="$RET"
if [ "$basedn" = "" ]; then
basedn="dc=example,dc=tld"
fi
else
db_set phamm/ldap-basedn $basedn || true
fi
# binddn
if [ "$binddn" = "" ]; then
db_set phamm/ldap-binddn "cn=admin,$basedn"
db_input high phamm/ldap-binddn || true
db_go || true
else
db_set phamm/ldap-binddn $binddn || true
fi
# Apache* autoconfiguration
db_input high phamm/reconfigure-webserver || true
db_go || true
db_get phamm/reconfigure-webserver || true
webservers="$RET"
if [ ! "$webservers" = "" ]; then
db_input high phamm/restart-webserver || true
db_go || true
fi
exit 0
|