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