rebuild-wekan.sh 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 install -y build-essential gcc g++ make git curl wget p7zip-full zip unzip unp npm p7zip-full
  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.20.1
  36. sudo npm -g install npm
  37. #sudo npm -g install npm
  38. ## Latest npm with Meteor 2.2
  39. sudo npm -g uninstall node-pre-gyp
  40. sudo npm -g install @mapbox/node-pre-gyp
  41. # Latest fibers for Meteor 2.2
  42. #sudo mkdir -p /usr/local/lib/node_modules/fibers/.node-gyp
  43. #sudo npm -g install fibers
  44. # Install Meteor, if it's not yet installed
  45. sudo npm -g install meteor --unsafe-perm
  46. #sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor
  47. elif [[ "$OSTYPE" == "darwin"* ]]; then
  48. echo "macOS";
  49. pause '1) Install XCode 2) Install Node 14.x from https://nodejs.org/en/ 3) Press [Enter] key to continue.'
  50. elif [[ "$OSTYPE" == "cygwin" ]]; then
  51. # POSIX compatibility layer and Linux environment emulation for Windows
  52. echo "TODO: Add Cygwin";
  53. exit;
  54. elif [[ "$OSTYPE" == "msys" ]]; then
  55. # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
  56. echo "TODO: Add msys on Windows";
  57. exit;
  58. elif [[ "$OSTYPE" == "win32" ]]; then
  59. # I'm not sure this can happen.
  60. echo "TODO: Add Windows";
  61. exit;
  62. elif [[ "$OSTYPE" == "freebsd"* ]]; then
  63. echo "TODO: Add FreeBSD";
  64. exit;
  65. else
  66. echo "Unknown"
  67. echo ${OSTYPE}
  68. exit;
  69. fi
  70. break
  71. ;;
  72. "Build Wekan")
  73. echo "Building Wekan."
  74. #if [[ "$OSTYPE" == "darwin"* ]]; then
  75. # echo "sed at macOS";
  76. # sed -i '' 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  77. #else
  78. # echo "sed at ${OSTYPE}"
  79. # sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  80. #fi
  81. #cd ..
  82. #sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor
  83. rm -rf .build/bundle node_modules .meteor/local .build
  84. meteor npm install
  85. meteor build .build --directory
  86. rm -rf .build/bundle/programs/web.browser.legacy
  87. (cd .build/bundle/programs/server && rm -rf node_modules && chmod u+w *.json && meteor npm install)
  88. (cd .build/bundle/programs/server/node_modules/fibers && node build.js)
  89. (cd .build/bundle/programs/server/npm/node_modules/meteor/accounts-password && meteor npm remove bcrypt && meteor npm install bcrypt)
  90. # Cleanup
  91. cd .build/bundle
  92. find . -type d -name '*-garbage*' | xargs rm -rf
  93. find . -name '*phantom*' | xargs rm -rf
  94. find . -name '.*.swp' | xargs rm -f
  95. find . -name '*.swp' | xargs rm -f
  96. cd ../..
  97. # Add fibers multi arch
  98. #cd .build/bundle/programs/server/node_modules/fibers/bin
  99. #curl https://releases.wekan.team/fibers-multi.7z -o fibers-multi.7z
  100. #7z x fibers-multi.7z
  101. #rm fibers-multi.7z
  102. #cd ../../../../../../..
  103. echo Done.
  104. break
  105. ;;
  106. "Run Meteor for dev on http://localhost:4000")
  107. WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096 --trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://localhost:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  108. break
  109. ;;
  110. "Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000")
  111. if [[ "$OSTYPE" == "darwin"* ]]; then
  112. IPADDRESS=$(ifconfig | grep broadcast | grep 'inet ' | cut -d: -f2 | awk '{ print $2}' | cut -d '/' -f 1)
  113. else
  114. IPADDRESS=$(ip a | grep 'noprefixroute' | grep 'inet ' | cut -d: -f2 | awk '{ print $2}' | cut -d '/' -f 1)
  115. fi
  116. echo "Your IP address is $IPADDRESS"
  117. WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096 --trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  118. break
  119. ;;
  120. "Run Meteor for dev on http://CUSTOM-IP-ADDRESS:PORT")
  121. ip address
  122. echo "From above list, what is your IP address?"
  123. read IPADDRESS
  124. echo "On what port you would like to run Wekan?"
  125. read PORT
  126. echo "ROOT_URL=http://$IPADDRESS:$PORT"
  127. WRITABLE_PATH=.. NODE_OPTIONS="--max_old_space_size=4096 --trace-warnings" WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:$PORT meteor run --exclude-archs web.browser.legacy,web.cordova --port $PORT
  128. break
  129. ;;
  130. "Quit")
  131. break
  132. ;;
  133. *) echo invalid option;;
  134. esac
  135. done