source: php5-lliurex-compat/fuentes/debian/postinst @ 1224

Last change on this file since 1224 was 1224, checked in by mabarracus, 4 years ago

fixes

File size: 2.6 KB
Line 
1#!/bin/sh
2# postinst script for php5-lliurex-compat
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <postinst> `configure' <most-recently-configured-version>
10#        * <old-postinst> `abort-upgrade' <new version>
11#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12#          <new-version>
13#        * <postinst> `abort-remove'
14#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15#          <failed-install-package> <version> `removing'
16#          <conflicting-package> <version>
17# for details, see https://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19NOW=$(date +'%Y%m%d')
20setup_apache(){
21    if [ ! -f /usr/share/doc/apache2/examples/setup-instance ]; then
22        echo "ERROR: setup-instance from apache2 not found !!!"
23        exit 1
24    fi
25    if [ -d /etc/apache2-lliurex ]; then
26        mv /etc/apache2-lliurex /etc/apache2-lliurex-${NOW}
27    fi
28    bash /usr/share/doc/apache2/examples/setup-instance lliurex
29}
30change_ports(){
31    if [ ! -d /etc/apache2-lliurex ]; then
32        echo "ERROR: /etc/apache2-lliurex not found !!!"
33        exit 1
34    fi
35    sed -i -r 's/80/800/g' /etc/apache2-lliurex/ports.conf
36    sed -i -r 's/443/4430/g' /etc/apache2-lliurex/ports.conf
37    for site in /etc/apache2-lliurex/sites-available/*.conf; do
38        sed -i -r 's/\*:80/\*:800/g' ${site}
39        sed -i -r 's/\*:443/\*:4430/g' ${site}
40    done;
41}
42fix_mods(){
43    /usr/sbin/a2dismod-lliurex php7.0 || true
44    /usr/sbin/a2dismod php5 || true
45    if [ -f /etc/apache2-lliurex/mods-available/php7.0.conf ]; then
46        mv /etc/apache2-lliurex/mods-available/php7.0.conf /etc/apache2-lliurex/mods-available/php7.0.conf.disabled
47    fi
48    if [ -f /etc/apache2-lliurex/mods-available/php7.0.load ]; then
49        mv /etc/apache2-lliurex/mods-available/php7.0.load /etc/apache2-lliurex/mods-available/php7.0.load.disabled
50    fi
51    if [ -f /etc/apache2/mods-available/php5.conf ]; then
52        mv /etc/apache2/mods-available/php5.conf /etc/apache2-lliurex/mods-available/php5.conf.disabled
53    fi
54    if [ -f /etc/apache2/mods-available/php5.load ]; then
55        mv /etc/apache2/mods-available/php5.load /etc/apache2-lliurex/mods-available/php5.load.disabled
56    fi
57}
58
59case "$1" in
60    configure)
61        setup_apache
62        change_ports
63        fix_mods
64        systemctl enable apache2-lliurex
65        systemctl restart apache2-lliurex
66        systemctl restart apache2
67    ;;
68
69    abort-upgrade|abort-remove|abort-deconfigure)
70    ;;
71
72    *)
73        echo "postinst called with unknown argument \`$1'" >&2
74        exit 1
75    ;;
76esac
77
78# dh_installdeb will replace this with shell code automatically
79# generated by other debhelper scripts.
80
81#DEBHELPER#
82
83exit 0
Note: See TracBrowser for help on using the repository browser.