2014-03-10 00:25:00 +00:00
#!/usr/bin/env bash
2014-04-09 15:00:42 +00:00
#
2015-07-31 07:55:16 +00:00
# Habitica provisioning script
2014-03-10 00:25:00 +00:00
2014-04-09 15:00:42 +00:00
# function for autostart
function autostart_habitrpg {
update_config = $'Please update config.json with your values\nfor ADMIN_EMAIL, SMTP_USER, SMTP_PASS and SMTP_SERVICE,\nthen run "vagrant reload --provision"'
2014-03-10 00:25:00 +00:00
2014-04-09 15:00:42 +00:00
# check if config.json exists, then check if the defaults are still in place
if [ -e config.json ] ;
2014-03-10 00:25:00 +00:00
then
2014-04-09 15:00:42 +00:00
if grep -Fq 'ADMIN_EMAIL": "you@yours.com' config.json;
then
echo " $update_config " ;
exit;
else
npm start
fi
else
cp config.json.example config.json;
2014-03-10 00:25:00 +00:00
echo " $update_config " ;
exit;
fi
2014-04-09 15:00:42 +00:00
}
# Main provisioning
2015-07-31 07:55:16 +00:00
echo Setting up Habitica...
2014-04-09 15:00:42 +00:00
echo cd /vagrant >> /home/vagrant/.bashrc
2015-12-22 19:46:10 +00:00
# Needed for running e2e tests
echo export DISPLAY = :99 >> /home/vagrant/.bashrc
2014-04-09 15:00:42 +00:00
2014-07-24 08:34:27 +00:00
# Prevent warnings: "dpkg-preconfigure: unable to re-open stdin ..."
export DEBIAN_FRONTEND = noninteractive
2014-04-27 06:03:05 +00:00
echo Updating repositories...
2014-04-09 15:00:42 +00:00
apt-get update -qq
2014-07-24 08:34:27 +00:00
echo Installing Unix build tools - needed for node-gyp to use make...
apt-get install -qq build-essential
2016-04-19 07:28:17 +00:00
echo Installing python software properties...
2016-01-10 10:50:52 +00:00
apt-get install -qq python-software-properties
2016-01-18 16:08:49 +00:00
echo Installing sprite dependencies...
/vagrant/vagrant_scripts/install_sprite_dependencies.sh
2015-03-27 19:25:41 +00:00
2014-04-09 15:00:42 +00:00
echo Installing Mongodb...
2016-01-18 16:08:49 +00:00
/vagrant/vagrant_scripts/install_mongo.sh
2016-01-10 10:50:52 +00:00
2016-01-18 16:08:49 +00:00
echo Installing gcc...
/vagrant/vagrant_scripts/install_gcc.sh
2016-01-10 10:50:52 +00:00
2014-04-09 15:00:42 +00:00
echo Installing Git...
apt-get install -qq git
2016-01-10 10:50:52 +00:00
echo Installing curl...
apt-get install -qq curl
2016-01-18 16:08:49 +00:00
echo Installing test dependencies...
2016-04-19 07:28:17 +00:00
/vagrant/vagrant_scripts/install_test_dependencies.sh
2014-04-09 15:00:42 +00:00
2016-01-10 10:50:52 +00:00
echo Installing ntp...
apt-get install -qq ntp
2014-04-09 15:00:42 +00:00
2016-01-18 16:08:49 +00:00
echo Installing nvm, node and global node modules...
/vagrant/vagrant_scripts/install_node.sh
2016-01-18 14:47:57 +00:00
2016-04-19 23:23:50 +00:00
echo "'vagrant up' is finished. Continue with the instructions at http://habitica.wikia.com/wiki/Setting_up_Habitica_Locally"
2014-04-09 15:00:42 +00:00
2015-07-31 07:55:16 +00:00
# Uncomment both lines to autostart the habitica server when provisioning
# echo Starting Habitica server...
2014-04-09 15:00:42 +00:00
# autostart_habitrpg