rebuild-wekan.sh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. #NODE_VERSION=8.16.0
  7. #X64NODE="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz"
  8. function pause(){
  9. read -p "$*"
  10. }
  11. function cprec(){
  12. if [[ -d "$1" ]]; then
  13. if [[ ! -d "$2" ]]; then
  14. sudo mkdir -p "$2"
  15. fi
  16. for i in $(ls -A "$1"); do
  17. cprec "$1/$i" "$2/$i"
  18. done
  19. else
  20. sudo cp "$1" "$2"
  21. fi
  22. }
  23. # sudo npm doesn't work right, so this is a workaround
  24. function npm_call(){
  25. TMPDIR="/tmp/tmp_npm_prefix"
  26. if [[ -d "$TMPDIR" ]]; then
  27. rm -rf $TMPDIR
  28. fi
  29. mkdir $TMPDIR
  30. NPM_PREFIX="$(npm config get prefix)"
  31. npm config set prefix $TMPDIR
  32. npm "[email protected]"
  33. npm config set prefix "$NPM_PREFIX"
  34. echo "Moving files to $NPM_PREFIX"
  35. for i in $(ls -A $TMPDIR); do
  36. cprec "$TMPDIR/$i" "$NPM_PREFIX/$i"
  37. done
  38. rm -rf $TMPDIR
  39. }
  40. #function wekan_repo_check(){
  41. ## UNCOMMENTING, IT'S NOT REQUIRED THAT /HOME/USERNAME IS /HOME/WEKAN
  42. # git_remotes="$(git remote show 2>/dev/null)"
  43. # res=""
  44. # for i in $git_remotes; do
  45. # res="$(git remote get-url $i | sed 's/.*wekan\/wekan.*/wekan\/wekan/')"
  46. # if [[ "$res" == "wekan/wekan" ]]; then
  47. # break
  48. # fi
  49. # done
  50. #
  51. # if [[ "$res" != "wekan/wekan" ]]; then
  52. # echo "$PWD is not a wekan repository"
  53. # exit;
  54. # fi
  55. #}
  56. echo
  57. PS3='Please enter your choice: '
  58. options=("Install Wekan dependencies" "Build Wekan" "Quit")
  59. select opt in "${options[@]}"
  60. do
  61. case $opt in
  62. "Install Wekan dependencies")
  63. if [[ "$OSTYPE" == "linux-gnu" ]]; then
  64. echo "Linux";
  65. # Debian, Ubuntu, Mint
  66. sudo apt-get install -y build-essential gcc g++ make git curl wget
  67. curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
  68. sudo apt-get install -y nodejs
  69. elif [[ "$OSTYPE" == "darwin"* ]]; then
  70. echo "macOS";
  71. pause '1) Install XCode 2) Install Node 8.x from https://nodejs.org/en/ 3) Press [Enter] key to continue.'
  72. elif [[ "$OSTYPE" == "cygwin" ]]; then
  73. # POSIX compatibility layer and Linux environment emulation for Windows
  74. echo "TODO: Add Cygwin";
  75. exit;
  76. elif [[ "$OSTYPE" == "msys" ]]; then
  77. # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
  78. echo "TODO: Add msys on Windows";
  79. exit;
  80. elif [[ "$OSTYPE" == "win32" ]]; then
  81. # I'm not sure this can happen.
  82. echo "TODO: Add Windows";
  83. exit;
  84. elif [[ "$OSTYPE" == "freebsd"* ]]; then
  85. echo "TODO: Add FreeBSD";
  86. exit;
  87. else
  88. echo "Unknown"
  89. echo ${OSTYPE}
  90. exit;
  91. fi
  92. ## Latest npm with Meteor 1.6
  93. npm_call -g install npm
  94. npm_call -g install node-gyp
  95. # Latest fibers for Meteor 1.6
  96. npm_call -g install [email protected]
  97. # Install Meteor, if it's not yet installed
  98. curl https://install.meteor.com | bash
  99. break
  100. ;;
  101. "Build Wekan")
  102. echo "Building Wekan."
  103. #wekan_repo_check
  104. # REPOS BELOW ARE INCLUDED TO WEKAN REPO
  105. #rm -rf packages/kadira-flow-router packages/meteor-useraccounts-core packages/meteor-accounts-cas packages/wekan-ldap packages/wekan-ldap packages/wekan-scrfollbar packages/meteor-accounts-oidc packages/markdown
  106. #mkdir packages
  107. #cd packages
  108. #git clone --depth 1 -b master https://github.com/wekan/flow-router.git kadira-flow-router
  109. #git clone --depth 1 -b master https://github.com/meteor-useraccounts/core.git meteor-useraccounts-core
  110. #git clone --depth 1 -b master https://github.com/wekan/meteor-accounts-cas.git
  111. #git clone --depth 1 -b master https://github.com/wekan/wekan-ldap.git
  112. #git clone --depth 1 -b master https://github.com/wekan/wekan-scrollbar.git
  113. #git clone --depth 1 -b master https://github.com/wekan/meteor-accounts-oidc.git
  114. #git clone --depth 1 -b master --recurse-submodules https://github.com/wekan/markdown.git
  115. #mv meteor-accounts-oidc/packages/switch_accounts-oidc wekan_accounts-oidc
  116. #mv meteor-accounts-oidc/packages/switch_oidc wekan_oidc
  117. #rm -rf meteor-accounts-oidc
  118. #if [[ "$OSTYPE" == "darwin"* ]]; then
  119. # echo "sed at macOS";
  120. # sed -i '' 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  121. #else
  122. # echo "sed at ${OSTYPE}"
  123. # sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js
  124. #fi
  125. #cd ..
  126. rm -rf node_modules
  127. meteor npm install
  128. rm -rf .build
  129. meteor build .build --directory
  130. cp -f fix-download-unicode/cfs_access-point.txt .build/bundle/programs/server/packages/cfs_access-point.js
  131. #Removed binary version of bcrypt because of security vulnerability that is not fixed yet.
  132. #https://github.com/wekan/wekan/commit/4b2010213907c61b0e0482ab55abb06f6a668eac
  133. #https://github.com/wekan/wekan/commit/7eeabf14be3c63fae2226e561ef8a0c1390c8d3c
  134. #cd ~/repos/wekan/.build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt
  135. #rm -rf node_modules/bcrypt
  136. #meteor npm install bcrypt
  137. cd .build/bundle/programs/server
  138. rm -rf node_modules
  139. meteor npm install
  140. #meteor npm install bcrypt
  141. cd ../../../..
  142. echo Done.
  143. break
  144. ;;
  145. "Quit")
  146. break
  147. ;;
  148. *) echo invalid option;;
  149. esac
  150. done