mebil
[kivitendo-erp.git] / etc / kivitendo.postinst
1 #!/bin/sh
2 set -e
3
4 # kivitendo postinst
5
6 # add sysal site to apache configuration
7 cd /etc/apache2/sites-available
8 if ! grep "#kivitendo#" default >/dev/null
9 then
10         awk '/<.Virtual/ { print ""; \
11                      print "#kivitendo#"; \
12                      print "# Configuration for kivitendo"; \
13                      print "# Kivitendo-Installattion mit FCGI"; \
14                      print "AddHandler fcgid-script .fpl"; \
15                      print "AliasMatch ^/kivitendo/[^/]+\.pl /opt/kivitendo/dispatcher.fpl"; \
16                      print "Alias /kivitendo/ /opt/kivitendo/"; \
17                      print "FcgidMaxRequestLen 10485760"; \
18
19                      print "<Directory /opt/kivitendo>"; \
20                      print "  AllowOverride All"; \
21                      print "  Options ExecCGI Includes FollowSymlinks"; \
22                      print "  Order Allow,Deny"; \
23                      print "  Allow from All"; \
24                      print "</Directory>"; \
25
26                      print "<DirectoryMatch /opt/kivitendo/users>"; \
27                      print "  Order Deny,Allow"; \
28                      print "  Deny from All"; \
29                      print "</DirectoryMatch>"; \
30                                  print "#kivitendo_end#";  } \
31                                {print $0;}' default >xxx
32
33         mv xxx default
34         echo "/etc/apache2/sites-available/default changed"
35         /etc/init.d/apache2 restart
36 fi
37
38 # check configuration file
39 if [ ! -e /opt/kivitendo/config/kivitendo.conf ]
40 then
41         echo "Type new kivitendo admin password:"
42         read a
43         sed "s/admin123/$a/" /opt/kivitendo/config/kivitendo.conf.default >/opt/kivitendo/config/kivitendo.conf
44 fi
45
46 # allow write access to some directories
47 chown www-data /opt/kivitendo/users /opt/kivitendo/templates
48 chgrp www-data /opt/kivitendo/users /opt/kivitendo/templates
49