File kivitendo-erp-install.sh of Package kivitendo-erp

#!/bin/bash
# Copyright (c) 2007 oc2pus
# Copyright (c) 2016 - 2023 Scorpio IT, Deidesheim, Germany
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments to toni@links2linux.de
# Please submit bugfixes or comments to rpm@scorpio-it.net

# - start PostgreSQL if not running
# - add kivitendo user
# - add some functions to PostgreSQL

# start PostgreSQL if necessary
if [[ "$(systemctl is-active postgresql.service)" != active ]]; then
    echo "Starting PostgreSQL ..."
    systemctl start postgresql
fi

# create kivitendo user
#echo "Creating kivitendo user ..."
#su - postgres -c "createuser -s -d kivitendo 2> /dev/null || :"
# add function
#echo "Adding needed functions to template1 ..."
#su - postgres -c"psql template1 -f /usr/share/doc/packages/kivitendo-erp/kivitendo-erp-create-function.sql 2> /dev/null || :"

### Configure Client Authentification Configuration File 
if ! grep 'kivitendo' /var/lib/pgsql/data/pg_hba.conf ; then
echo '85c85
< local   all             all                                     peer
---
> local   all             all                                     trust
87c87
< host    all             all             127.0.0.1/32            ident
---
> host    all             all             127.0.0.1/32            trust
89c89
< host    all             all             ::1/128                 ident
---
> host    all             all             ::1/128                 trust
92,94c92,99
< local   replication     all                                     peer
< host    replication     all             127.0.0.1/32            ident
< host    replication     all             ::1/128                 ident
---
> #local   replication     all                                     peer
> #host    replication     all             127.0.0.1/32            ident
> #host    replication     all             ::1/128                 ident
> 
> # kivitendo-erp
> local   kivitendo       kivitendo                               password
> host    kivitendo       kivitendo       127.0.0.1/32            password
> host    kivitendo       kivitendo       ::1/128                 password' \
  | patch /var/lib/pgsql/data/pg_hba.conf >/dev/null
fi

### configure PostgreSQL
# CLIENT CONNECTION DEFAULTS
# set locale
echo '711c711
< lc_messages = 'C'                     # locale for system error message
---
> lc_messages = 'de_DE.UTF-8'                   # locale for system error message
713,715c713,715
< lc_monetary = 'C'                     # locale for monetary formatting
< lc_numeric = 'C'                      # locale for number formatting
< lc_time = 'C'                         # locale for time formatting
---
> lc_monetary = 'de_DE.UTF-8'                   # locale for monetary formatting
> lc_numeric = 'de_DE.UTF-8'                    # locale for number formatting
> lc_time = 'de_DE.UTF-8'                               # locale for time formatting' \
  | patch /var/lib/pgsql/data/postgresql.conf >/dev/null

# restart apache ?
#rcapache2 restart
echo ""
echo " Now, start your apache webserver and open page"
echo "  http://localhost/kivitendo-erp/admin.pl"
echo "  to configure your kivitendo-erp"

openSUSE Build Service is sponsored by