rebuild-wekan.sh 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. X64NODE="https://releases.wekan.team/node-v8.11.3-linux-x64.tar.gz"
  6. function pause(){
  7. read -p "$*"
  8. }
  9. echo
  10. PS3='Please enter your choice: '
  11. options=("Install Wekan dependencies" "Build Wekan" "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. if [ "$(grep -Ei 'buntu|mint' /etc/*release)" ]; then
  19. sudo apt install -y build-essential git curl wget
  20. sudo apt -y install nodejs npm
  21. sudo npm -g install n
  22. sudo n 8.11.3
  23. fi
  24. if [ "$(grep -Ei 'debian' /etc/*release)" ]; then
  25. sudo apt install -y build-essential git curl wget
  26. echo "Debian, or Debian on Windows Subsystem for Linux"
  27. curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
  28. sudo apt install -y nodejs
  29. fi
  30. # TODO: Add Sandstorm for version of Node.js install
  31. #MACHINE_TYPE=`uname -m`
  32. #if [ ${MACHINE_TYPE} == 'x86_64' ]; then
  33. # # 64-bit stuff here
  34. # wget ${X64NODE}
  35. # sudo tar -C /usr/local --strip-components 1 -xzf ${X64NODE}
  36. #elif [ ${MACHINE_TYPE} == '32bit' ]; then
  37. # echo "TODO: 32-bit Linux install here"
  38. # exit
  39. #fi
  40. elif [[ "$OSTYPE" == "darwin"* ]]; then
  41. echo "macOS";
  42. pause '1) Install XCode 2) Install Node 8.x from https://nodejs.org/en/ 3) Press [Enter] key to continue.'
  43. elif [[ "$OSTYPE" == "cygwin" ]]; then
  44. # POSIX compatibility layer and Linux environment emulation for Windows
  45. echo "TODO: Add Cygwin";
  46. exit;
  47. elif [[ "$OSTYPE" == "msys" ]]; then
  48. # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
  49. echo "TODO: Add msys on Windows";
  50. exit;
  51. elif [[ "$OSTYPE" == "win32" ]]; then
  52. # I'm not sure this can happen.
  53. echo "TODO: Add Windows";
  54. exit;
  55. elif [[ "$OSTYPE" == "freebsd"* ]]; then
  56. echo "TODO: Add FreeBSD";
  57. exit;
  58. else
  59. echo "Unknown"
  60. echo ${OSTYPE}
  61. exit;
  62. fi
  63. ## Latest npm with Meteor 1.6
  64. sudo npm -g install npm
  65. sudo npm -g install node-gyp
  66. # Latest fibers for Meteor 1.6
  67. sudo npm -g install fibers@2.0.0
  68. # Install Meteor, if it's not yet installed
  69. curl https://install.meteor.com | bash
  70. mkdir ~/repos
  71. cd ~/repos
  72. git clone https://github.com/wekan/wekan.git
  73. cd wekan
  74. git checkout devel
  75. break
  76. ;;
  77. "Build Wekan")
  78. echo "Building Wekan."
  79. cd ~/repos/wekan
  80. mkdir -p ~/repos/wekan/packages
  81. cd ~/repos/wekan/packages
  82. git clone https://github.com/wekan/flow-router.git kadira-flow-router
  83. git clone https://github.com/meteor-useraccounts/core.git meteor-useraccounts-core
  84. if [[ "$OSTYPE" == "darwin"* ]]; then
  85. echo "sed at macOS";
  86. sed -i '' 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  87. else
  88. echo "sed at ${OSTYPE}"
  89. sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  90. fi
  91. cd ~/repos/wekan
  92. rm -rf node_modules
  93. meteor npm install
  94. rm -rf .build
  95. meteor build .build --directory
  96. cp -f fix-download-unicode/cfs_access-point.txt .build/bundle/programs/server/packages/cfs_access-point.js
  97. #Removed binary version of bcrypt because of security vulnerability that is not fixed yet.
  98. #https://github.com/wekan/wekan/commit/4b2010213907c61b0e0482ab55abb06f6a668eac
  99. #https://github.com/wekan/wekan/commit/7eeabf14be3c63fae2226e561ef8a0c1390c8d3c
  100. #cd ~/repos/wekan/.build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt
  101. #rm -rf node_modules/bcrypt
  102. #meteor npm install bcrypt
  103. cd ~/repos/wekan/.build/bundle/programs/server
  104. rm -rf node_modules
  105. meteor npm install
  106. #meteor npm install bcrypt
  107. cd ~/repos
  108. echo Done.
  109. break
  110. ;;
  111. "Quit")
  112. break
  113. ;;
  114. *) echo invalid option;;
  115. esac
  116. done