6 # check configuration file
7 if [ ! -e /opt/kivitendo-erp/config/kivitendo.conf ]
9 echo "Type new kivitendo admin and DB password:"
11 sed "s/admin123/$a/" /opt/kivitendo-erp/config/kivitendo.conf.default >/opt/kivitendo-erp/config/kivitendo.conf
15 if ! su postgres -c "psql -c '\du'" | grep kivitendo >/dev/null
17 echo "No user named 'kivitendo' found. It is now created."
21 su postgres -c "createuser -ds kivitendo ; psql -c \"ALTER USER kivitendo WITH PASSWORD '$a';\""
23 su postgres -c "createuser -dPs kivitendo"
26 main=$(ls -d /etc/postgresql/*/main/)
27 if ! grep kivitendo $main/pg_hba.conf >/dev/null
29 echo "adding kivitendo user access to $main/pg_hba.conf"
35 print "local all kivitendo md5";
41 print "local all kivitendo md5";
48 print "local all kivitendo md5";
54 ' $main/pg_hba.conf > /tmp/pg_hba.conf
55 mv /tmp/pg_hba.conf $main/pg_hba.conf
56 chown postgres:postgres $main/pg_hba.conf
57 systemctl reload postgresql
60 # allow write access to some directories
61 chown www-data /opt/kivitendo-erp/users /opt/kivitendo-erp/templates
62 chgrp www-data /opt/kivitendo-erp/users /opt/kivitendo-erp/templates
64 systemctl restart apache2
66 # call installation check
67 /opt/kivitendo-erp/scripts/installation_check.pl
69 if [ ! -d /opt/kivitendo-erp/webdav ]
71 mkdir /opt/kivitendo-erp/webdav
72 chown www-data:www-data /opt/kivitendo-erp/webdav