File: libapache2-mod-wsgi.postinst

package info (click to toggle)
mod-wsgi 3.3-2%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 688 kB
  • ctags: 544
  • sloc: ansic: 9,859; makefile: 67; sh: 66
file content (39 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

set -e

apache_force_reload() {
    if apache2ctl configtest 2>/dev/null; then
        #invoke-rc.d apache2 force-reload || true
        # use "restart" as a workaround for bug #558608
        invoke-rc.d apache2 restart || true
    else
        echo "Your apache2 configuration is broken, please fix it and restart apache2 manually."
    fi
}

update_symlink() {
    wsgi_py=`readlink /usr/lib/apache2/modules/mod_wsgi.so | sed 's,.*-,,'`
    py_default=`dpkg -s python | grep '^Version' | sed 's,Version: \([^.]*.[^.]*\).*,\1,'`
    if [ ! "${wsgi_py}" = "${py_default}" ]; then
        ln -sf mod_wsgi.so-${py_default} /usr/lib/apache2/modules/mod_wsgi.so
    fi
}

if [ -z "$2" ]; then
    update_symlink
    if [ -e /etc/apache2/apache2.conf ]; then
        a2enmod wsgi >/dev/null || true
        apache_force_reload
    fi
else
    #we're upgrading
    update_symlink
    if [ -e /etc/apache2/mods-enabled/wsgi.load ]; then
        apache_force_reload
    fi
fi

#DEBHELPER#

exit 0