#!/bin/bash echo "SIK WEB 2.0" echo "This script will set up the environment for this project." echo "=========================================================" echo "Dependencies: postgresql>9.5, python>3.5" read -p "Are these programs installed? [y/n]" -n 1 -r echo "" if [[ ! $REPLY =~ ^[Yy]$ ]] then echo "Please install the dependencies. Exiting." exit 0 fi read -p "Create user 'sik' in postgres (needs sudo) [y/n]?" -n 1 -r echo "" if [[ $REPLY =~ ^[Yy]$ ]] then sudo -u postgres psql < "$PWD/scripts/db/init.sql" fi read -p "Is virtualenv activated? [y/n]" -n 1 -r echo "" if [[ ! $REPLY =~ ^[Yy]$ ]] then echo "Please activate virtualenv first. Exiting." exit 0 fi read -p "Copy settings from template? [y/n]" -n 1 -r echo "" if [[ $REPLY =~ ^[Yy]$ ]] then cp "$PWD/sikweb/settings-sample.py" "$PWD/sikweb/settings.py" fi read -p "Start setup? [y/n]" -n 1 -r echo "" if [[ ! $REPLY =~ ^[Yy]$ ]] then echo "Exiting." exit 0 fi (set -x; pip install -r requirements.txt) (set -x; npm install) (set -x; python manage.py migrate) (set -x; python manage.py createdefaultadmin) echo "Done." echo "Run 'python manage.py runserver 0.0.0.0:8000' to start the development server!"