52 lines
969 B

  1. #!/bin/bash
  2. RSTED_USER=${RSTED_USER:-rsted}
  3. RSTED_GROUP=${RSTED_GROUP:-rsted}
  4. ##
  5. ## Installation code
  6. ##
  7. source /srv/virtualenv/default/bin/activate
  8. set -eux # -x for verbose logging to juju debug-log
  9. mkdir -p /opt/apps
  10. (
  11. cd /opt/apps &&
  12. git clone https://github.com/vaab/rsted &&
  13. adduser --system --home=/home/"$RSTED_USER" --group "$RSTED_GROUP" &&
  14. #chown "$RSTED_USER":"$RSTED_GROUP" /opt/apps/rsted -R &&
  15. ## -H is to force HOME environment variable to change to etherpad one.
  16. mkdir /var/run/rsted && chown "$RSTED_USER" /var/run/rsted &&
  17. cd rsted &&
  18. pip install -r pip-requirements.txt
  19. )
  20. ##
  21. ## Config file
  22. ##
  23. config_file="/etc/rsted/settings.py"
  24. [ -e "$config_file" ] || cp "src/etc/rsted/settings.py" "$config_file"
  25. ln -sf "$config_file" /opt/apps/rsted/settings_local.py
  26. ##
  27. ## Startup file
  28. ##
  29. cp src/etc/init/rsted.conf /etc/init/rsted.conf
  30. ##
  31. ## Logrotate
  32. ##
  33. cp src/etc/logrotate.d/rsted /etc/logrotate.d/rsted