rebuild-wekan.sh 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #!/bin/bash
  2. echo "Recommended for development: Ubuntu 22.04 amd64 Jammy Jellyfish daily iso, directly to SSD disk or dual boot, not VM. Works fast."
  3. echo "Note: If you use other locale than en_US.UTF-8 , you need to additionally install en_US.UTF-8"
  4. echo " with 'sudo dpkg-reconfigure locales' , so that MongoDB works correctly."
  5. echo " You can still use any other locale as your main locale."
  6. #Below script installs newest node 8.x for Debian/Ubuntu/Mint.
  7. function pause(){
  8. read -p "$*"
  9. }
  10. echo
  11. PS3='Please enter your choice: '
  12. options=("Install Wekan dependencies" "Build Wekan" "Run Meteor for dev on http://localhost:4000" "Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000" "Run Meteor for dev on http://CUSTOM-IP-ADDRESS:PORT" "Quit")
  13. select opt in "${options[@]}"
  14. do
  15. case $opt in
  16. "Install Wekan dependencies")
  17. if [[ "$OSTYPE" == "linux-gnu" ]]; then
  18. echo "Linux";
  19. # Debian, Ubuntu, Mint
  20. sudo apt-get install -y build-essential gcc g++ make git curl wget p7zip-full zip unzip unp npm
  21. #curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
  22. #sudo apt-get install -y nodejs
  23. #sudo apt-get install -y npm
  24. # Volta Node and NPM install manager, made with Rust https://volta.sh
  25. # Volta uses home directory also with "npm -g install", no sudo needed.
  26. # Volta install script is broken, so using n.
  27. #curl https://get.volta.sh | bash
  28. #export VOLTA_HOME="$HOME/.volta"
  29. #export PATH="$VOLTA_HOME/bin:$PATH"
  30. #volta install node@14
  31. # npm nodejs
  32. #curl -0 -L https://npmjs.org/install.sh | sudo sh
  33. #sudo chown -R $(id -u):$(id -g) $HOME/.npm
  34. sudo npm -g install n
  35. sudo n 14.19.1
  36. #sudo npm -g install npm
  37. ## Latest npm with Meteor 2.2
  38. sudo npm -g install node-gyp
  39. # Latest fibers for Meteor 2.2
  40. #sudo mkdir -p /usr/local/lib/node_modules/fibers/.node-gyp
  41. sudo npm -g install fibers
  42. # Install Meteor, if it's not yet installed
  43. sudo npm install -g meteor --unsafe-perm
  44. #sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor
  45. elif [[ "$OSTYPE" == "darwin"* ]]; then
  46. echo "macOS";
  47. pause '1) Install XCode 2) Install Node 14.x from https://nodejs.org/en/ 3) Press [Enter] key to continue.'
  48. elif [[ "$OSTYPE" == "cygwin" ]]; then
  49. # POSIX compatibility layer and Linux environment emulation for Windows
  50. echo "TODO: Add Cygwin";
  51. exit;
  52. elif [[ "$OSTYPE" == "msys" ]]; then
  53. # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
  54. echo "TODO: Add msys on Windows";
  55. exit;
  56. elif [[ "$OSTYPE" == "win32" ]]; then
  57. # I'm not sure this can happen.
  58. echo "TODO: Add Windows";
  59. exit;
  60. elif [[ "$OSTYPE" == "freebsd"* ]]; then
  61. echo "TODO: Add FreeBSD";
  62. exit;
  63. else
  64. echo "Unknown"
  65. echo ${OSTYPE}
  66. exit;
  67. fi
  68. break
  69. ;;
  70. "Build Wekan")
  71. echo "Building Wekan."
  72. #if [[ "$OSTYPE" == "darwin"* ]]; then
  73. # echo "sed at macOS";
  74. # sed -i '' 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  75. #else
  76. # echo "sed at ${OSTYPE}"
  77. # sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  78. #fi
  79. #cd ..
  80. #sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor
  81. rm -rf node_modules .meteor/local .build
  82. chmod u+w *.json
  83. meteor npm install
  84. meteor build .build --directory
  85. rm -rf .build/bundle/programs/web.browser.legacy
  86. (cd .build/bundle/programs/server && rm -rf node_modules && chmod u+w *.json && meteor npm install)
  87. (cd .build/bundle/programs/server/node_modules/fibers && node build.js)
  88. # Cleanup
  89. find . -type d -name '*-garbage*' | xargs rm -rf
  90. find . -name '*phantom*' | xargs rm -rf
  91. find . -name '.*.swp' | xargs rm -f
  92. find . -name '*.swp' | xargs rm -f
  93. # Add fibers multi arch
  94. #cd .build/bundle/programs/server/node_modules/fibers/bin
  95. #curl https://releases.wekan.team/fibers-multi.7z -o fibers-multi.7z
  96. #7z x fibers-multi.7z
  97. #rm fibers-multi.7z
  98. #cd ../../../../../../..
  99. echo Done.
  100. break
  101. ;;
  102. "Run Meteor for dev on http://localhost:4000")
  103. WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://localhost:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  104. break
  105. ;;
  106. "Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000")
  107. IPADDRESS=$(ip a | grep 'noprefixroute' | grep 'inet ' | cut -d: -f2 | awk '{ print $2}' | cut -d '/' -f 1)
  108. echo "Your IP address is $IPADDRESS"
  109. WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  110. break
  111. ;;
  112. "Run Meteor for dev on http://CUSTOM-IP-ADDRESS:PORT")
  113. ip address
  114. echo "From above list, what is your IP address?"
  115. read IPADDRESS
  116. echo "On what port you would like to run Wekan?"
  117. read PORT
  118. echo "ROOT_URL=http://$IPADDRESS:$PORT"
  119. WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:$PORT meteor run --exclude-archs web.browser.legacy,web.cordova --port $PORT
  120. break
  121. ;;
  122. "Quit")
  123. break
  124. ;;
  125. *) echo invalid option;;
  126. esac
  127. done