rebuild-wekan.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.16.2
  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. rm -rf packages
  81. mkdir -p ~/repos/wekan/packages
  82. cd ~/repos/wekan/packages
  83. git clone --depth 1 -b master https://github.com/wekan/flow-router.git kadira-flow-router
  84. git clone --depth 1 -b master https://github.com/meteor-useraccounts/core.git meteor-useraccounts-core
  85. git clone --depth 1 -b master https://github.com/wekan/meteor-accounts-cas.git
  86. git clone --depth 1 -b master https://github.com/wekan/wekan-ldap.git
  87. git clone --depth 1 -b master https://github.com/wekan/wekan-scrollbar.git
  88. git clone --depth 1 -b master https://github.com/wekan/meteor-accounts-oidc.git
  89. git clone --depth 1 -b master --recurse-submodules https://github.com/wekan/markdown.git
  90. mv meteor-accounts-oidc/packages/switch_accounts-oidc wekan_accounts-oidc
  91. mv meteor-accounts-oidc/packages/switch_oidc wekan_oidc
  92. rm -rf meteor-accounts-oidc
  93. if [[ "$OSTYPE" == "darwin"* ]]; then
  94. echo "sed at macOS";
  95. sed -i '' 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  96. else
  97. echo "sed at ${OSTYPE}"
  98. sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  99. fi
  100. cd ~/repos/wekan
  101. rm -rf node_modules
  102. meteor npm install
  103. rm -rf .build
  104. meteor build .build --directory
  105. cp -f fix-download-unicode/cfs_access-point.txt .build/bundle/programs/server/packages/cfs_access-point.js
  106. #Removed binary version of bcrypt because of security vulnerability that is not fixed yet.
  107. #https://github.com/wekan/wekan/commit/4b2010213907c61b0e0482ab55abb06f6a668eac
  108. #https://github.com/wekan/wekan/commit/7eeabf14be3c63fae2226e561ef8a0c1390c8d3c
  109. #cd ~/repos/wekan/.build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt
  110. #rm -rf node_modules/bcrypt
  111. #meteor npm install bcrypt
  112. cd ~/repos/wekan/.build/bundle/programs/server
  113. rm -rf node_modules
  114. meteor npm install
  115. #meteor npm install bcrypt
  116. cd ~/repos
  117. echo Done.
  118. break
  119. ;;
  120. "Quit")
  121. break
  122. ;;
  123. *) echo invalid option;;
  124. esac
  125. done