This file is indexed.

postinst is in spotweb 20111002+dfsg-4.

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
#!/bin/sh
# postinst script for #PACKAGE#
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

# source debconf stuff
. /usr/share/debconf/confmodule
# source dbconfig-common stuff
. /usr/share/dbconfig-common/dpkg/postinst 

generate_nntpconfig() {
        db_get spotweb/nntpserver
        spotweb_nntp_server="$RET"
        db_get spotweb/nntpuser
        spotweb_nntp_user="$RET"
        db_get spotweb/nntppass
        spotweb_nntp_pass="$RET"
        db_get spotweb/nntpenc
        spotweb_nntp_enc="$RET"
        db_get spotweb/nntpport
        spotweb_nntp_port="$RET"


        db_get spotweb/headerserver
        spotweb_header_server="$RET"
        db_get spotweb/headeruser
        spotweb_header_user="$RET"
        db_get spotweb/headerpass
        spotweb_header_pass="$RET"
        db_get spotweb/headerenc
        spotweb_header_enc="$RET"
        db_get spotweb/headerport
        spotweb_header_port="$RET"

        db_get spotweb/postserver
        spotweb_post_server="$RET"
        db_get spotweb/postuser
        spotweb_post_user="$RET"
        db_get spotweb/postpass
        spotweb_post_pass="$RET"
        db_get spotweb/postenc
        spotweb_post_enc="$RET"
        db_get spotweb/postport
        spotweb_post_port="$RET"

        TMPFILE=$( mktemp /tmp/spotweb-postinst.XXXXXX )
        cat << EOF >$TMPFILE
<?php
# News server settings managed by debconf
# Use 'dpkg-reconfigure spotweb' as root to change
\$settings['nntp_nzb']['host'] = '${spotweb_nntp_server}';
\$settings['nntp_nzb']['user'] = '${spotweb_nntp_user}';
\$settings['nntp_nzb']['pass'] = '${spotweb_nntp_pass}';
\$settings['nntp_nzb']['enc'] = ${spotweb_nntp_enc};
\$settings['nntp_nzb']['port'] = ${spotweb_nntp_port};

\$settings['nntp_hdr']['host'] = '${spotweb_header_server}';
\$settings['nntp_hdr']['user'] = '${spotweb_header_user}';
\$settings['nntp_hdr']['pass'] = '${spotweb_header_pass}';
\$settings['nntp_hdr']['enc'] = ${spotweb_header_enc};
\$settings['nntp_hdr']['port'] = ${spotweb_header_port};

\$settings['nntp_post']['host'] = '${spotweb_post_server}';
\$settings['nntp_post']['user'] = '${spotweb_post_user}';
\$settings['nntp_post']['pass'] = '${spotweb_post_pass}';
\$settings['nntp_post']['enc'] = ${spotweb_post_enc};
\$settings['nntp_post']['port'] = ${spotweb_post_port};
EOF
        chown www-data:www-data $TMPFILE
        ucf --debconf-ok $TMPFILE /etc/spotweb/nntpconfig.php
        rm $TMPFILE
        # Needed to prevent the postinst script to hang after the Apache restart
        db_stop
}

dbc_generate_include="php:/etc/spotweb/dbconfig.php"
dbc_generate_include_owner="www-data:www-data"
dbc_go spotweb $@

case "$1" in
    configure)
        generate_nntpconfig
        /usr/share/spotweb/scripts/upgrade-db.sh
        if [ -x /usr/sbin/invoke-rc.d ]; then
            invoke-rc.d apache2 restart
        fi
    ;;

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

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0