Debian Codegraph @

debian/krb5-kdc.postinst

raw
1 #! /bin/sh
2
3 set -e
4
5 # Failing to start should not break installs or upgrades
6 init_error() {
7 true
8 }
9
10 if [ "configure" = "$1" ] || [ "reconfigure" = "$1" ] ; then
11 . /usr/share/debconf/confmodule
12 db_version 2.0
13
14 db_get krb5-config/default_realm || true
15 KRB5LD_DEFAULT_REALM="$RET"
16 if [ -z "$KRB5LD_DEFAULT_REALM" ] ; then
17 KRB5LD_DEFAULT_REALM=EXAMPLE.COM
18 fi
19 export KRB5LD_DEFAULT_REALM
20
21 db_get krb5-kdc/debconf
22 DEBCONF="$RET"
23
24 if [ ! -f /etc/krb5kdc/kdc.conf ] && [ $DEBCONF = "true" ] ; then
25 sed -e "s/@MYREALM/$KRB5LD_DEFAULT_REALM/" \
26 /usr/share/krb5-kdc/kdc.conf.template > /etc/krb5kdc/kdc.conf
27 fi
28
29 if [ $DEBCONF = "true" ] ; then
30 if [ -f "/etc/default/krb5-kdc" ] ; then
31 . /etc/default/krb5-kdc
32 fi
33 cat <<'EOF' > /etc/default/krb5-kdc
34
35 # Automatically generated. Only the value of DAEMON_ARGS will be preserved.
36 # If you change anything in this file other than DAEMON_ARGS, first run
37 # dpkg-reconfigure krb5-kdc and disable managing the KDC configuration with
38 # debconf. Otherwise, changes will be overwritten.
39
40 EOF
41 if [ -n "$DAEMON_ARGS" ] ; then
42 echo "DAEMON_ARGS=\"$DAEMON_ARGS\"" >> /etc/default/krb5-kdc
43 fi
44 fi
45
46 db_stop
47 fi
48
49 #DEBHELPER#
50
51 exit 0