Skip to content

Instantly share code, notes, and snippets.

@tohn
Created July 2, 2015 12:15
Show Gist options
  • Save tohn/d6a1bfd91bde72570732 to your computer and use it in GitHub Desktop.
Save tohn/d6a1bfd91bde72570732 to your computer and use it in GitHub Desktop.
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