fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.5 KiB

  1. #!/bin/bash
  2. ETHERPAD_LITE_USER=${ETHERPAD_LITE_USER:-etherpad}
  3. ETHERPAD_LITE_GROUP=${ETHERPAD_LITE_GROUP:-etherpad}
  4. set -eux # -x for verbose logging to juju debug-log
  5. apt-get -y install git-core sqlite3 python-software-properties
  6. sudo add-apt-repository -y ppa:chris-lea/node.js
  7. sudo apt-get update
  8. sudo apt-get install -y nodejs
  9. mkdir /opt/apps -p
  10. (
  11. cd /opt/apps &&
  12. git clone git://github.com/ether/etherpad-lite.git &&
  13. cd etherpad-lite &&
  14. adduser --system --home=/home/"$ETHERPAD_LITE_USER" --group "$ETHERPAD_LITE_GROUP" &&
  15. chown "$ETHERPAD_LITE_USER":"$ETHERPAD_LITE_GROUP" /opt/apps/etherpad-lite -R &&
  16. ## -H is to force HOME environment variable to change to etherpad one.
  17. sudo -u "$ETHERPAD_LITE_USER" -H bin/installDeps.sh
  18. )
  19. ##
  20. ## Config file
  21. ##
  22. config_file="/etc/etherpad-lite/settings.json"
  23. [ -e "$config_file" ] || cp "src/etc/etherpad-lite/settings.json" "$config_file"
  24. ln -sf "$config_file" /opt/apps/etherpad-lite/settings.json
  25. ##
  26. ## Storage
  27. ##
  28. # is set from config file and by lxc-scripts as its declared as a data-dir
  29. ##
  30. ## Startup file
  31. ##
  32. cp src/etc/init/etherpad-lite.conf /etc/init/etherpad-lite.conf
  33. ##
  34. ## Logrotate
  35. ##
  36. cp src/etc/logrotate.d/etherpad-lite /etc/logrotate.d/etherpad-lite
  37. ##
  38. ## sqlite3 module
  39. ##
  40. apt-get install -y build-essential
  41. (
  42. ## XXXvlab: not very sure why you need to go in this directory
  43. cd /opt/apps/etherpad-lite &&
  44. sudo -u "$ETHERPAD_LITE_USER" -H npm install sqlite3
  45. )
  46. chown "$ETHERPAD_LITE_USER" /var/lib/etherpad-lite