File: postinst

package info (click to toggle)
put-dns 0.0.2-7
  • links: PTS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 200 kB
  • sloc: sh: 73; perl: 34; makefile: 15
file content (43 lines) | stat: -rw-r--r-- 1,003 bytes parent folder | download
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
#!/bin/sh
set -e

CONFIG=/etc/put-dns/put-dns.conf

case "$1" in
    configure)
    . /usr/share/debconf/confmodule
    db_get put-dns/update-domain
    if [ "$RET" = "true" ]; then
        # Check if 'domain' in CONFIG is localhost and if not see if it
        # can be initailised to a sensible value
        INIDOMAIN=`crudini --get $CONFIG main domain`
        if [ "$INIDOMAIN" = "localdomain" ]; then
          # domain in the conf file is not a valid external one
          HOSTDOMAIN=`hostname -d`
          case "$HOSTDOMAIN" in
          localdomain|local|example.com|example.org|example.net)
         
          ;;
          *)
          # host domain may be correctly set already, use it
          sed -i -e "/domain = /s/$INIDOMAIN/$HOSTDOMAIN/" $CONFIG
          ;;
          esac
       fi
     fi
    
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac


#DEBHELPER#

exit 0