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
|
|
|
|
|
2021-03-20 10:36:40 +01:00
|
|
|
echo "Installing NPM packages..."
|
|
|
|
(cd ${ROOT_DIR}/multi && npm install)
|
|
|
|
|
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..."
|
2021-04-26 20:21:21 +02:00
|
|
|
mysql --host=${DB_HOST} --user=${DB_USER} --password=${DB_PASSWORD} ${DB_NAME} < ${ROOT_DIR}/database/mapguesser.sql
|
2020-05-20 13:42:38 +02:00
|
|
|
|
2020-06-02 23:42:18 +02:00
|
|
|
echo "Migrating DB..."
|
2020-07-05 16:45:38 +02:00
|
|
|
(cd ${ROOT_DIR} && ./mapg db:migrate)
|
2020-06-02 23:42:18 +02:00
|
|
|
|
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-06-27 00:22:42 +02:00
|
|
|
|
|
|
|
echo "Linking view files..."
|
|
|
|
(cd ${ROOT_DIR} && ./mapg view:link)
|
2021-04-29 20:02:00 +02:00
|
|
|
else
|
|
|
|
echo "Creating the first user..."
|
|
|
|
(cd ${ROOT_DIR} && ./mapg user:add mapg@mapg.dev 123456 admin)
|
2020-05-20 13:42:38 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
touch ${ROOT_DIR}/installed
|