rebuild-wekan.sh 5.0 KB

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