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

Last change on this file since 1229 was 1229, 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    DISMOD_LLIUREX=$(type -fp a2dismod-lliurex)
44    DISMOD=$(type -fp a2dismod)
45    ${DISMOD_LLIUREX} php7.0 || true
46    ${DISMOD} php5 || true
47    if [ -f /etc/apache2-lliurex/mods-available/php7.0.conf ]; then
48        mv /etc/apache2-lliurex/mods-available/php7.0.conf /etc/apache2-lliurex/mods-available/php7.0.conf.disabled
49    fi
50    if [ -f /etc/apache2-lliurex/mods-available/php7.0.load ]; then
51        mv /etc/apache2-lliurex/mods-available/php7.0.load /etc/apache2-lliurex/mods-available/php7.0.load.disabled
52    fi
53    if [ -f /etc/apache2/mods-available/php5.conf ]; then
54        mv /etc/apache2/mods-available/php5.conf /etc/apache2-lliurex/mods-available/php5.conf.disabled
55    fi
56    if [ -f /etc/apache2/mods-available/php5.load ]; then
57        mv /etc/apache2/mods-available/php5.load /etc/apache2-lliurex/mods-available/php5.load.disabled
58    fi
59}
60
61case "$1" in
62    configure)
63        setup_apache
64        change_ports
65        fix_mods
66        systemctl enable apache2-lliurex
67        systemctl restart apache2-lliurex
68        systemctl restart apache2
69    ;;
70
71    abort-upgrade|abort-remove|abort-deconfigure)
72    ;;
73
74    *)
75        echo "postinst called with unknown argument \`$1'" >&2
76        exit 1
77    ;;
78esac
79
80# dh_installdeb will replace this with shell code automatically
81# generated by other debhelper scripts.
82
83#DEBHELPER#
84
85exit 0
Note: See TracBrowser for help on using the repository browser.