This file is indexed.

postinst is in cardstories 1.0.6-1.3ubuntu1.

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
#!/bin/sh -e
#
# Copyright (C) 2011 Dachary <loic@dachary.org>
#
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute and/or modify this program under the terms of
# the GNU Affero General Public License (AGPL) as published by the Free
# Software Foundation (FSF), either version 3 of the License, or (at your
# option) any later version of the AGPL published by the FSF.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program in a file in the toplevel directory called
# "AGPLv3".  If not, see <http://www.gnu.org/licenses/>.
#

nginx_install() {
    included=/usr/share/cardstories/conf/nginx.conf
    conf=/etc/nginx/sites-available/default
    if [ -f $conf ] && ! grep $included $conf > /dev/null ; then
	perl -pi -e "print \"\tinclude $included;\n\" if(m:location / {:)" $conf
    fi
}

apache2_install() {
    included=/usr/share/cardstories/conf/apache2.conf
    conf=/etc/apache2/conf.d/cardstories.conf
    if [ ! -e $conf ] ; then
        ln -s $included $conf
    fi
    a2enmod proxy proxy_http
}

. /usr/share/debconf/confmodule

if ! id -u cardstories >/dev/null 2>&1; then
    adduser --quiet --system --no-create-home --home /var/run/cardstories cardstories
fi

for d in /var/run/cardstories /var/log/cardstories /var/lib/cardstories /etc/cardstories; do
    mkdir -p $d
    chown -R cardstories:nogroup $d
    chmod 755 $d
done

if [ "$1" = "configure" ]; then

    db_version 2.0

    db_get cardstories/reconfigure-webserver

    webservers="$RET"

    for webserver in $webservers; do
        webserver=${webserver%,}
        if [ "$webserver" = "nginx" ] ; then
            nginx_install
        elif [ "$webserver" = "apache2" ] ; then
            apache2_install
        fi

	# Redirection of 3 is needed because Debconf uses it and it might 
	# be inherited by webserver. See bug #446324.
        if [ -f /etc/init.d/$webserver ] ; then
            if [ -x /usr/sbin/invoke-rc.d ]; then
                invoke-rc.d $webserver reload 3>/dev/null || true
            else
                /etc/init.d/$webserver reload 3>/dev/null || true
            fi
        fi
    done

fi


# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
	pycompile -p cardstories 
fi

if which pycompile >/dev/null 2>&1; then
	pycompile -p cardstories /usr/share/cardstories
fi

# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/cardstories" ]; then
	update-rc.d cardstories defaults >/dev/null
fi
if [ -x "/etc/init.d/cardstories" ] || [ -e "/etc/init/cardstories.conf" ]; then
	invoke-rc.d cardstories start || exit $?
fi
# End automatically added section