Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Update HabitRPG
#!/bin/bash
# to install HabitRPG, follow this guide (german only):
# http://yhaupenthal.org/1422213598.htm
root="/path/to/habitrpg"
new="$root/habitrpg"
# shutdown service
systemctl stop habitrpg
# backup
old="$root/habitrpg.bak-$(date +%Y%m%d)"
mv $new $old
# git clone
git clone https://github.com/HabitRPG/habitrpg.git $new
# cp config, bash.history
cp $old/.bash_history $new/.bash_history
cp $old/config.json $new/config.json
# chown+chmod
chown -R habitrpg:habitrpg $new
chmod -R 770 $new
# checking branch
cd $new
echo "### branch (should be \"develop\")"
git branch
# diff config
echo "### config"
diff $new/config.json $new/config.json.example
# diff migrations
echo "### migrations"
diff -qr $new/migrations $old/migrations | sort
# enable habitrpg user
sed -i '/^habitrpg/s/false/bash/' /etc/passwd
cat << !
### auto stuff done, you're on your own now
### use http://yhaupenthal.org/1422213598.htm ("HabitRPG updaten")
### and:
### su habitrpg
### npm install
### migrations (for each do)
#### mongo habitrpg ./migrations/20150702_bla.js
#### if this doesn't work (something is required):
#### mongo habitrpg ./node_modules/modul/modul.js ./migrations/20150702_bla.js
#### if this also doesn't work:
#### node ./migrations/20150702_bla.js
### test: npm start
### if you're done:
### sed -i '/^habitrpg/s/bash/false/' /etc/passwd
### systemctl start habitrpg
!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.