posaune
[projects.git] / debian / timetracker.postinst
1 #!/bin/bash
2 set -e
3
4 a2ensite timetracker.conf
5 #systemd restart apache2
6 /etc/init.d/apache2 restart
7
8 chmod 777 /usr/share/php/timetracker/WEB-INF/templates_c
9
10 # check, whether sysal user exists
11 if ! mysql -uttuser -pTtuser09 timetracker -e";"
12 then
13         echo "Installation of ttuser user ..."
14         echo "Password of mysql root:"
15         read pw
16         mysql -uroot -p$pw <<END
17 create user ttuser@localhost identified by 'Ttuser09';
18 create database timetracker CHARACTER SET = 'utf8mb4';
19 grant all on timetracker.* to ttuser@localhost;
20 END
21 fi
22
23 # Create Config File
24 pushd /usr/share/php/timetracker/WEB-INF
25         if [ ! -f config.php ]
26         then
27                 echo "copy standard config file"
28                 cp config.php.dist config.php
29         fi
30 popd
31
32 echo "Check database with http://localhost/timetracker/dbinstall.php"
33 echo "Login at http://localhost/timetracker/login.php"
34 echo "Initial password: admin/secret"
35 echo "Further information: https://www.anuko.com/time_tracker/index.htm"
36