diff options
author | Lauri Ojansivu <x@xet7.org> | 2018-11-16 21:54:16 +0200 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2018-11-16 21:54:16 +0200 |
commit | 75c1dff1f8b422951413454fb998ce5234f94882 (patch) | |
tree | 01f400562367e87d95b7eccf8dee099049ac55ab /rebuild-wekan.sh | |
parent | cb24b8519154b13685af58f67b492d850abbf3c2 (diff) | |
parent | 22a9e783c99b56db688793ad3736bd1e3fc20f40 (diff) | |
download | wekan-75c1dff1f8b422951413454fb998ce5234f94882.tar.gz wekan-75c1dff1f8b422951413454fb998ce5234f94882.tar.bz2 wekan-75c1dff1f8b422951413454fb998ce5234f94882.zip |
Merge branch 'devel' of https://github.com/warnerjon12/wekan into warnerjon12-devel
Diffstat (limited to 'rebuild-wekan.sh')
-rwxr-xr-x | rebuild-wekan.sh | 69 |
1 files changed, 59 insertions, 10 deletions
diff --git a/rebuild-wekan.sh b/rebuild-wekan.sh index c1f9f4a0..42364515 100755 --- a/rebuild-wekan.sh +++ b/rebuild-wekan.sh @@ -10,6 +10,55 @@ function pause(){ read -p "$*" } +function cprec(){ + if [[ -d "$1" ]]; then + if [[ ! -d "$2" ]]; then + sudo mkdir -p "$2" + fi + + for i in $(ls -A "$1"); do + cprec "$1/$i" "$2/$i" + done + else + sudo cp "$1" "$2" + fi +} + +# sudo npm doesn't work right, so this is a workaround +function npm_call(){ + TMPDIR="/tmp/tmp_npm_prefix" + if [[ -d "$TMPDIR" ]]; then + rm -rf $TMPDIR + fi + mkdir $TMPDIR + NPM_PREFIX="$(npm config get prefix)" + npm config set prefix $TMPDIR + npm "$@" + npm config set prefix "$NPM_PREFIX" + + echo "Moving files to $NPM_PREFIX" + for i in $(ls -A $TMPDIR); do + cprec "$TMPDIR/$i" "$NPM_PREFIX/$i" + done + rm -rf $TMPDIR +} + +function wekan_repo_check(){ + git_remotes="$(git remote show 2>/dev/null)" + res="" + for i in $git_remotes; do + res="$(git remote get-url $i | sed 's/.*wekan\/wekan.*/wekan\/wekan/')" + if [[ "$res" == "wekan/wekan" ]]; then + break + fi + done + + if [[ "$res" != "wekan/wekan" ]]; then + echo "$PWD is not a wekan repository" + exit; + fi +} + echo PS3='Please enter your choice: ' options=("Install Wekan dependencies" "Build Wekan" "Quit") @@ -24,7 +73,7 @@ do if [ "$(grep -Ei 'buntu|mint' /etc/*release)" ]; then sudo apt install -y build-essential git curl wget # sudo apt -y install nodejs npm -# sudo npm -g install n +# npm_call -g install n # sudo n 8.12.0 fi @@ -70,10 +119,10 @@ do fi ## Latest npm with Meteor 1.6 - sudo npm -g install npm - sudo npm -g install node-gyp + npm_call -g install npm + npm_call -g install node-gyp # Latest fibers for Meteor 1.6 - sudo npm -g install fibers@2.0.0 + npm_call -g install fibers@2.0.0 # Install Meteor, if it's not yet installed curl https://install.meteor.com | bash # mkdir ~/repos @@ -85,10 +134,10 @@ do ;; "Build Wekan") echo "Building Wekan." - cd ~/repos/wekan + wekan_repo_check rm -rf packages - mkdir -p ~/repos/wekan/packages - cd ~/repos/wekan/packages + mkdir packages + cd packages git clone --depth 1 -b master https://github.com/wekan/flow-router.git kadira-flow-router git clone --depth 1 -b master https://github.com/meteor-useraccounts/core.git meteor-useraccounts-core git clone --depth 1 -b master https://github.com/wekan/meteor-accounts-cas.git @@ -101,7 +150,7 @@ do sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' ~/repos/wekan/packages/meteor-useraccounts-core/package.js fi - cd ~/repos/wekan + cd .. rm -rf node_modules meteor npm install rm -rf .build @@ -113,11 +162,11 @@ do #cd ~/repos/wekan/.build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt #rm -rf node_modules/bcrypt #meteor npm install bcrypt - cd ~/repos/wekan/.build/bundle/programs/server + cd .build/bundle/programs/server rm -rf node_modules meteor npm install #meteor npm install bcrypt - cd ~/repos + cd ../../../.. echo Done. break ;; |