2020-05-20 15:10:55 +02:00
|
|
|
#!/bin/bash
|
2020-05-20 13:42:38 +02:00
|
|
|
|
|
|
|
ROOT_DIR=$(dirname $(readlink -f "$0"))/..
|
|
|
|
|
|
|
|
. ${ROOT_DIR}/.env
|
|
|
|
|
|
|
|
if [ -f ${ROOT_DIR}/installed ]; then
|
2020-05-24 15:42:29 +02:00
|
|
|
echo "MapGuesser is already installed! To force reinstall, delete file 'installed' from the root directory!"
|
2020-05-20 13:42:38 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-06-01 20:42:37 +02:00
|
|
|
echo "Installing Yarn packages..."
|
|
|
|
(cd ${ROOT_DIR}/public/static && yarn install)
|
2020-05-20 13:42:38 +02:00
|
|
|
|
2020-06-01 20:42:37 +02:00
|
|
|
echo "Installing MapGuesser DB..."
|
2020-05-20 13:42:38 +02:00
|
|
|
mysql --host=${DB_HOST} --user=${DB_USER} --password=${DB_PASSWORD} ${DB_NAME} < ${ROOT_DIR}/db/mapguesser.sql
|
|
|
|
|
2020-06-02 23:42:18 +02:00
|
|
|
echo "Migrating DB..."
|
|
|
|
(cd ${ROOT_DIR} && ./mapg migrate)
|
|
|
|
|
2020-05-20 13:42:38 +02:00
|
|
|
if [ -z "${DEV}" ] || [ "${DEV}" -eq "0" ]; then
|
2020-05-24 15:42:29 +02:00
|
|
|
echo "Minifying JS, CSS and SVG files..."
|
|
|
|
${ROOT_DIR}/scripts/minify.sh
|
2020-05-20 13:42:38 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
touch ${ROOT_DIR}/installed
|