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.

52 lines
1.4 KiB

4 years ago
  1. #!/bin/sh
  2. # Move to the folder where ep-lite is installed
  3. cd "$(dirname "$0")"/..
  4. # Source constants and usefull functions
  5. . bin/functions.sh
  6. # Is node installed?
  7. # Not checking io.js, default installation creates a symbolic link to node
  8. is_cmd node || fatal "Please install node.js ( https://nodejs.org )"
  9. # Is npm installed?
  10. is_cmd npm || fatal "Please install npm ( https://npmjs.org )"
  11. # Check npm version
  12. require_minimal_version "npm" $(get_program_version "npm") "$REQUIRED_NPM_MAJOR" "$REQUIRED_NPM_MINOR"
  13. # Check node version
  14. require_minimal_version "nodejs" $(get_program_version "node") "$REQUIRED_NODE_MAJOR" "$REQUIRED_NODE_MINOR"
  15. # Get the name of the settings file
  16. settings="settings.json"
  17. a='';
  18. for arg in "$@"; do
  19. if [ "$a" = "--settings" ] || [ "$a" = "-s" ]; then settings=$arg; fi
  20. a=$arg
  21. done
  22. # Does a $settings exist? if not copy the template
  23. if [ ! -f "$settings" ]; then
  24. log "Copy the settings template to $settings..."
  25. cp settings.json.template "$settings" || exit 1
  26. fi
  27. log "Ensure that all dependencies are up to date... If this is the first time you have run Etherpad please be patient."
  28. (
  29. mkdir -p node_modules
  30. cd node_modules
  31. [ -e ep_etherpad-lite ] || ln -s ../src ep_etherpad-lite
  32. cd ep_etherpad-lite
  33. npm ci
  34. ) || {
  35. rm -rf src/node_modules
  36. exit 1
  37. }
  38. # Remove all minified data to force node creating it new
  39. log "Clearing minified cache..."
  40. rm -f var/minified*
  41. exit 0