phpide
[timetracker.git] / debian / timetracker.postinst
diff --git a/debian/timetracker.postinst b/debian/timetracker.postinst
new file mode 100755 (executable)
index 0000000..f208db7
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+a2ensite timetracker.conf
+#systemd restart apache2
+/etc/init.d/apache2 restart
+
+chmod 777 /usr/share/php/timetracker/WEB-INF/templates_c
+
+# check, whether sysal user exists
+if ! mysql -uttuser -pTtuser09 timetracker -e";"
+then
+       echo "Installation of ttuser user ..."
+       echo "Password of mysql root:"
+       read pw
+       mysql -uroot -p$pw <<END
+create user ttuser@localhost identified by 'Ttuser09';
+create database timetracker CHARACTER SET = 'utf8mb4';
+grant all on timetracker.* to ttuser@localhost;
+END
+fi
+
+# Create Config File
+pushd /usr/share/php/timetracker/WEB-INF
+       if [ ! -f config.php ]
+       then
+               echo "copy standard config file"
+               cp config.php.dist config.php
+       fi
+popd
+
+echo "Check database with http://localhost/timetracker/dbinstall.php"
+echo "Login at http://localhost/timetracker/login.php"
+echo "Initial password: admin/secret"
+echo "Further information: https://www.anuko.com/time_tracker/index.htm"
+