rebuild-wekan.sh 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 npm
  20. # npm nodejs
  21. #sudo npm -g install npm
  22. #curl -0 -L https://npmjs.org/install.sh | sudo sh
  23. #sudo chown -R $(id -u):$(id -g) $HOME/.npm
  24. sudo npm -g install n
  25. sudo n 12.20.0
  26. #curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
  27. #sudo apt-get install -y nodejs
  28. elif [[ "$OSTYPE" == "darwin"* ]]; then
  29. echo "macOS";
  30. pause '1) Install XCode 2) Install Node 8.x from https://nodejs.org/en/ 3) Press [Enter] key to continue.'
  31. elif [[ "$OSTYPE" == "cygwin" ]]; then
  32. # POSIX compatibility layer and Linux environment emulation for Windows
  33. echo "TODO: Add Cygwin";
  34. exit;
  35. elif [[ "$OSTYPE" == "msys" ]]; then
  36. # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
  37. echo "TODO: Add msys on Windows";
  38. exit;
  39. elif [[ "$OSTYPE" == "win32" ]]; then
  40. # I'm not sure this can happen.
  41. echo "TODO: Add Windows";
  42. exit;
  43. elif [[ "$OSTYPE" == "freebsd"* ]]; then
  44. echo "TODO: Add FreeBSD";
  45. exit;
  46. else
  47. echo "Unknown"
  48. echo ${OSTYPE}
  49. exit;
  50. fi
  51. ## Latest npm with Meteor 1.8.x
  52. sudo npm -g install npm
  53. sudo npm -g install node-gyp
  54. # Latest fibers for Meteor 1.8.x
  55. sudo mkdir -p /usr/local/lib/node_modules/fibers/.node-gyp
  56. sudo npm -g install fibers
  57. # Install Meteor, if it's not yet installed
  58. curl https://install.meteor.com | bash
  59. #sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor
  60. break
  61. ;;
  62. "Build Wekan")
  63. echo "Building Wekan."
  64. #if [[ "$OSTYPE" == "darwin"* ]]; then
  65. # echo "sed at macOS";
  66. # sed -i '' 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  67. #else
  68. # echo "sed at ${OSTYPE}"
  69. # sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  70. #fi
  71. #cd ..
  72. #sudo chown -R $(id -u):$(id -g) $HOME/.npm $HOME/.meteor
  73. rm -rf node_modules .meteor/local
  74. npm install
  75. rm -rf .build
  76. meteor build .build --directory
  77. #cp -f fix-download-unicode/cfs_access-point.txt .build/bundle/programs/server/packages/cfs_access-point.js
  78. # Remove legacy webbroser bundle, so that Wekan works also at Android Firefox, iOS Safari, etc.
  79. rm -rf .build/bundle/programs/web.browser.legacy
  80. #Removed binary version of bcrypt because of security vulnerability that is not fixed yet.
  81. #https://github.com/wekan/wekan/commit/4b2010213907c61b0e0482ab55abb06f6a668eac
  82. #https://github.com/wekan/wekan/commit/7eeabf14be3c63fae2226e561ef8a0c1390c8d3c
  83. #cd ~/repos/wekan/.build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt
  84. #rm -rf node_modules/bcrypt
  85. #meteor npm install bcrypt
  86. cd .build/bundle/programs/server
  87. rm -rf node_modules
  88. npm install
  89. #meteor npm install bcrypt
  90. cd ../../../..
  91. echo Done.
  92. break
  93. ;;
  94. "Run Meteor for dev on http://localhost:4000")
  95. WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://localhost:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  96. break
  97. ;;
  98. "Run Meteor for dev on http://CURRENT-IP-ADDRESS:4000")
  99. IPADDRESS=$(ip a | grep 'noprefixroute' | grep 'inet ' | cut -d: -f2 | awk '{ print $2}' | cut -d '/' -f 1)
  100. echo "Your IP address is $IPADDRESS"
  101. WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:4000 meteor run --exclude-archs web.browser.legacy,web.cordova --port 4000
  102. break
  103. ;;
  104. "Run Meteor for dev on http://CUSTOM-IP-ADDRESS:PORT")
  105. ip address
  106. echo "From above list, what is your IP address?"
  107. read IPADDRESS
  108. echo "On what port you would like to run Wekan?"
  109. read PORT
  110. echo "ROOT_URL=http://$IPADDRESS:$PORT"
  111. WITH_API=true RICHER_CARD_COMMENT_EDITOR=false ROOT_URL=http://$IPADDRESS:$PORT meteor run --exclude-archs web.browser.legacy,web.cordova --port $PORT
  112. break
  113. ;;
  114. "Quit")
  115. break
  116. ;;
  117. *) echo invalid option;;
  118. esac
  119. done