Suppress output from checking whether Apache is running
[shibboleth/sp.git] / debian / libapache2-mod-shib2.postinst
1 #!/bin/sh
2
3 set -e
4
5 # Prior to 2.0.dfsg1-4, we named our Apache configuration files shib instead
6 # of shib2.  We therefore need to unlink the old configuration files, and if
7 # they were linked in, we should link in the new ones.
8 #
9 # We also have to work around a bug in the etch Shibboleth SP 1.x packages
10 # that caused them to remove the wrong module configuration and hence not
11 # unlink their configuration.  If the 1.x configuration is still linked in, it
12 # will break the 2.x module, so make sure it's disabled on initial install.
13 if [ "$1" = "configure" ] ; then
14     if dpkg --compare-versions "$2" lt-nl 2.0.dfsg1-4 ; then
15         if [ -f /etc/apache2/mods-enabled/shib.load ] ; then
16             a2enmod shib2
17         fi
18         a2dismod shib || true
19     fi
20
21     # Most of the time, this will produce an error message.  It only does
22     # anything if we're replacing a broken libapache2-mod-shib package.
23     # Suppress the normally useless error message to not confuse people.
24     if [ -z "$2" ] ; then
25         a2dismod shib 2>/dev/null || true
26     fi
27
28     if ! getent passwd _shibd > /dev/null ; then
29         echo 'Adding system-user for Shibboleth daemon' 1>&2
30         adduser --system --group --quiet --home /var/log/shibboleth \
31             --no-create-home --disabled-login --force-badname _shibd
32     fi
33
34     # The new shibd (which is about to be started) requires the corresponding
35     # Apache module, otherwise strange, hard to debug error messages result.
36     if [ -f /etc/apache2/mods-enabled/shib2.load ] ; then
37         if invoke-rc.d apache2 status >/dev/null 2>&1 ; then
38             invoke-rc.d apache2 restart
39         fi
40     fi
41 fi
42
43 #DEBHELPER#
44
45 exit 0