25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.8 KiB

3 년 전
  1. #!/bin/sh
  2. pecho() { printf %s\\n "$*"; }
  3. log() { pecho "$@"; }
  4. error() { log "ERROR: $@" >&2; }
  5. fatal() { error "$@"; exit 1; }
  6. is_cmd() { command -v "$@" >/dev/null 2>&1; }
  7. # Move to the folder where ep-lite is installed
  8. cd "$(dirname "$0")"/..
  9. # Is wget installed?
  10. is_cmd wget || fatal "Please install wget"
  11. # Is zip installed?
  12. is_cmd zip || fatal "Please install zip"
  13. # Is zip installed?
  14. is_cmd unzip || fatal "Please install unzip"
  15. START_FOLDER=$(pwd);
  16. TMP_FOLDER=$(mktemp -d)
  17. log "create a clean environment in $TMP_FOLDER..."
  18. cp -ar . "$TMP_FOLDER"
  19. cd "$TMP_FOLDER"
  20. rm -rf node_modules
  21. rm -f etherpad-lite-win.zip
  22. # setting NODE_ENV=production ensures that dev dependencies are not installed,
  23. # making the windows package smaller
  24. export NODE_ENV=production
  25. log "do a normal unix install first..."
  26. bin/installDeps.sh || exit 1
  27. log "copy the windows settings template..."
  28. cp settings.json.template settings.json
  29. log "resolve symbolic links..."
  30. cp -rL node_modules node_modules_resolved
  31. rm -rf node_modules
  32. mv node_modules_resolved node_modules
  33. log "download windows node..."
  34. cd bin
  35. wget "https://nodejs.org/dist/latest-erbium/win-x86/node.exe" -O ../node.exe
  36. log "remove git history to reduce folder size"
  37. rm -rf .git/objects
  38. log "remove windows jsdom-nocontextify/test folder"
  39. rm -rf "$TMP_FOLDER"/src/node_modules/wd/node_modules/request/node_modules/form-data/node_modules/combined-stream/test
  40. rm -rf "$TMP_FOLDER"/src/node_modules/nodemailer/node_modules/mailcomposer/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/encodings/tables
  41. log "create the zip..."
  42. cd "$TMP_FOLDER"
  43. zip -9 -r "$START_FOLDER"/etherpad-lite-win.zip ./*
  44. log "clean up..."
  45. rm -rf "$TMP_FOLDER"
  46. log "Finished. You can find the zip in the Etherpad root folder, it's called etherpad-lite-win.zip"