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

Last change on this file since 1223 was 1223, checked in by mabarracus, 3 years ago

Fixes postinst

File size: 2.5 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
19setup_apache(){
20    if [ ! -f /usr/share/doc/apache2/examples/setup-instance ]; then
21        echo "ERROR: setup-instance from apache2 not found !!!"
22        exit 1
23    fi
24    bash /usr/share/doc/apache2/examples/setup-instance lliurex
25}
26change_ports(){
27    if [ ! -d /etc/apache2-lliurex ]; then
28        echo "ERROR: /etc/apache2-lliurex not found !!!"
29        exit 1
30    fi
31    sed -i -r 's/80/800/g' /etc/apache2-lliurex/ports.conf
32    sed -i -r 's/443/4430/g' /etc/apache2-lliurex/ports.conf
33    for site in /etc/apache2-lliurex/sites-available/*.conf; do
34        sed -i -r 's/\*:80/\*:800/g' ${site}
35        sed -i -r 's/\*:443/\*:4430/g' ${site}
36    done;
37}
38fix_mods(){
39    /usr/sbin/a2dismod-lliurex php7.0 || true
40    /usr/sbin/a2dismod php5 || true
41    if [ -f /etc/apache2-lliurex/mods-available/php7.0.conf ]; then
42        mv /etc/apache2-lliurex/mods-available/php7.0.conf /etc/apache2-lliurex/mods-available/php7.0.conf.disabled
43    fi
44    if [ -f /etc/apache2-lliurex/mods-available/php7.0.load ]; then
45        mv /etc/apache2-lliurex/mods-available/php7.0.load /etc/apache2-lliurex/mods-available/php7.0.load.disabled
46    fi
47    if [ -f /etc/apache2/mods-available/php5.conf ]; then
48        mv /etc/apache2/mods-available/php5.conf /etc/apache2-lliurex/mods-available/php5.conf.disabled
49    fi
50    if [ -f /etc/apache2/mods-available/php5.load ]; then
51        mv /etc/apache2/mods-available/php5.load /etc/apache2-lliurex/mods-available/php5.load.disabled
52    fi
53}
54
55case "$1" in
56    configure)
57        setup_apache
58        change_ports
59        fix_mods
60        systemctl enable apache2-lliurex
61        systemctl restart apache2-lliurex
62        systemctl restart apache2
63    ;;
64
65    abort-upgrade|abort-remove|abort-deconfigure)
66    ;;
67
68    *)
69        echo "postinst called with unknown argument \`$1'" >&2
70        exit 1
71    ;;
72esac
73
74# dh_installdeb will replace this with shell code automatically
75# generated by other debhelper scripts.
76
77#DEBHELPER#
78
79exit 0
Note: See TracBrowser for help on using the repository browser.