Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# postinst script for dolibarr
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see /usr/share/doc/packaging-manual/
. /usr/share/debconf/confmodule
db_version 2.0
#
# Description: Verifies that the env module is loaded in the apache config file.
# Needs: $server the apache server to use,
# anything that matches /etc/$server/*.conf
#
env_enable()
{
envverm="env_module"
if grep -e "^[[:space:]]*#[[:space:]]*LoadModule[[:space:]]\+$envverm" /etc/$server/httpd.conf > /dev/null 2>&1; then
# Uncommenting
sed -e "s#\([[:space:]]*\)\#[[:space:]]\+\(LoadModule $envverm\)#\1\2#" /etc/$server/httpd.conf > /etc/$server/httpd.conf.tmp
status=uncomment
if grep -e "^[[:space:]]*LoadModule[[:space:]]\+$envverm" /etc/$server/httpd.conf.tmp >/dev/null 2>&1; then
# Uncomment successful.
cp /etc/$server/httpd.conf /etc/$server/httpd.conf.back >/dev/null 2>&1
mv /etc/$server/httpd.conf.tmp /etc/$server/httpd.conf
else
# Uncomment unsuccessful.
status=error
rm /etc/$server/httpd.conf.tmp
fi
fi
}
echo Run the postinst script
case "$1" in
configure)
# Copy include for apache.conf
fileorig="/usr/share/dolibarr/build/deb/apache.conf"
cp -p $fileorig $config
# Copy install.forced.php
fileorig="/usr/share/dolibarr/build/deb/install.forced.php"
config="/usr/share/dolibarr/htdocs/install/install.forced.php"
cp -p $fileorig $config
# Create conf.php
if [ ! -f /usr/share/dolibarr/htdocs/conf/conf.php ]
then
touch /usr/share/dolibarr/htdocs/conf/conf.php
chown -R www-data.www-data /usr/share/dolibarr/htdocs/conf/conf.php;
chmod -R 750 /usr/share/dolibarr/htdocs/conf/conf.php;
fi
#db_reset "dolibarr/webserver"
# Get the web server type.
db_get "dolibarr/webserver" # Read value for webserver.
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# webserver="$RET"
webserver="Both"
case $webserver in
Apache) webservers="apache2" ;;
Apache-SSL) webservers="apache2-ssl" ;;
Both) webservers="apache2 apache2-ssl" ;;
*) webservers="" ;;
esac
. /usr/share/wwwconfig-common/php.get
# Set up web server.
for server in $webservers ; do
echo Complete config of server $server
env_enable
typestr='application/x-httpd-php'
extension='.php'
. /usr/share/wwwconfig-common/apache-addtype_all.sh
. /usr/share/wwwconfig-common/apache-php.sh
. /usr/share/wwwconfig-common/apache-run.get
trustuser=$webuser
#
# That may lead to problems if apache & apache-ssl do
# not have the same user/group.
#
chown -R $webuser.$webgroup /usr/share/dolibarr
includefile="/etc/dolibarr/apache.conf"
#echo "$includefile $server"
. /usr/share/wwwconfig-common/apache-include_all.sh
test "$status" = "uncomment" -o "$status" = "include" && restart="$server $restart"
for index in index.php; do
. /usr/share/wwwconfig-common/apache-index_all.sh
test "$status" = "added" && restart="$server $restart"
done
done
echo "Go on page http://localhost/dolibarr/ to complete the installation and use Dolibarr."
# TODO Create the file to force parameters in Web installer
#if grep DBHOST /usr/share/dolibarr/htdocs/conf/conf.php > /dev/null
#then
# perl -pi -e "s/DBHOST/$dbserver/" /usr/share/dolibarr/htdocs/conf/conf.php
# perl -pi -e "s/DBNAME/$dbname/" /usr/share/dolibarr/htdocs/conf/conf.php
# perl -pi -e "s/DBUSER/$dbuser/" /usr/share/dolibarr/htdocs/conf/conf.php
# perl -pi -e "s/DBPASS/$dbpass/" /usr/share/dolibarr/htdocs/conf/conf.php
#fi
servers="apache2-ssl apache2 mysql"
. /usr/share/wwwconfig-common/restart.sh
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
db_stop
#DEBHELPER#