aboutsummaryrefslogtreecommitdiffhomepage
path: root/main/build/before_install.sh
diff options
context:
space:
mode:
authormarvin-borner@live.com2018-04-16 21:09:05 +0200
committermarvin-borner@live.com2018-04-16 21:09:05 +0200
commitcf14306c2b3f82a81f8d56669a71633b4d4b5fce (patch)
tree86700651aa180026e89a66064b0364b1e4346f3f /main/build/before_install.sh
parent619b01b3615458c4ed78bfaeabb6b1a47cc8ad8b (diff)
Main merge to user management system - files are now at /main/public/
Diffstat (limited to 'main/build/before_install.sh')
-rwxr-xr-xmain/build/before_install.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/main/build/before_install.sh b/main/build/before_install.sh
new file mode 100755
index 0000000..37d7524
--- /dev/null
+++ b/main/build/before_install.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Inspired by ownCloud´s before_install.sh script <3
+#
+
+WORKDIR=$PWD
+DB=$1
+
+echo "Work directory: $WORKDIR"
+echo "Database: $DB"
+
+#
+# set up mysql
+#
+if [ "$DB" == "mysql" ] ; then
+ echo "Setting up mysql ..."
+ mysql -u root -e "CREATE DATABASE userfrosting;"
+ mysql -u root -e "GRANT ALL ON userfrosting.* TO 'travis'@'localhost';"
+ printf "UF_MODE=\"dev\"\nDB_DRIVER=\"mysql\"\nDB_HOST=\"localhost\"\nDB_PORT=\"3306\"\nDB_NAME=\"userfrosting\"\nDB_USER=\"travis\"\nDB_PASSWORD=\"\"\n" > app/.env
+fi
+
+#
+# set up pgsql
+#
+if [ "$DB" == "pgsql" ] ; then
+ echo "Setting up pgsql ..."
+ psql -c "CREATE DATABASE userfrosting;" -U postgres
+ psql -c "GRANT ALL PRIVILEGES ON DATABASE userfrosting TO postgres;" -U postgres
+ printf "UF_MODE=\"dev\"\nDB_DRIVER=\"pgsql\"\nDB_HOST=\"localhost\"\nDB_PORT=\"5432\"\nDB_NAME=\"userfrosting\"\nDB_USER=\"postgres\"\nDB_PASSWORD=\"\"\n" > app/.env
+fi
+
+#
+# set up sqlite
+#
+if [ "$DB" == "sqlite" ] ; then
+ echo "Setting up sqlite ..."
+ touch userfrosting.db
+ printf "UF_MODE=\"dev\"\nDB_DRIVER=\"sqlite\"\nDB_NAME=\"userfrosting.db\"\n" > app/.env
+fi