Happy new year
[pazpar2-moved-to-github.git] / debian / pazpar2-apache2.postinst
1 #!/bin/sh
2 set -e
3
4 if [ "$1" != "configure" ]; then
5     exit 0
6 fi
7
8 reload_apache()
9 {
10     if apache2ctl configtest 2>/dev/null; then
11         invoke-rc.d apache2 force-reload || true
12     else
13         echo "Your apache2 configuration is broken, so we're not restarting it for you."
14     fi
15 }
16
17 if [ -e /etc/apache2/apache2.conf ]; then
18     if [ -d /etc/apache2/conf.d ]; then
19         ln -sf /etc/pazpar2/ap2pazpar2-js.cfg /etc/apache2/conf.d/pazpar2-js
20     fi
21
22     if [ ! -f /etc/apache2/mods-enabled/proxy_http.load ]; then
23         a2enmod proxy_http || true
24     fi
25
26     if [ -d /etc/apache2/conf.d ]; then
27         ln -sf /etc/pazpar2/ap2pazpar2.cfg /etc/apache2/conf.d/pazpar2
28         
29         if [ -f /etc/apache2/conf.d/ap2pazpar2.cfg ]; then
30             rm /etc/apache2/conf.d/ap2pazpar2.cfg
31         fi
32     fi
33     
34     reload_apache
35 fi
36 exit 0