/[projects]/misc/xoa-installer/xoa-installer.sh
ViewVC logotype

Diff of /misc/xoa-installer/xoa-installer.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2959 by torben, Mon Feb 29 09:49:28 2016 UTC revision 3176 by torben, Tue Dec 20 14:28:51 2016 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
3    
4  # npm install -g npm@next  # Note: this script works on debian 7/wheezy and debian 8/jessie
5    #
6    # If running on a raspberry 1(A/B) raspian/wheezy - downgrade node.js to 5.4.0
7    # Please note that raspian/wheezy for arm defaults to gcc 4.6
8    # gcc 4.7 is needed for compiling node-js modules
9    
10    BRANCH=stable
11    
12    
13    ###################################
14    # Exit bash if a command fails
15    set -e
16    # also exit if a part of a pipe fails
17    set -o pipefail
18    
19    
 #BRANCH=next-release  
 BRANCH=master  
20    
21    
22  function restartxo {  function restartxo {
# Line 22  if [ "$1" == "clean" ] ; then Line 34  if [ "$1" == "clean" ] ; then
34          echo cleaning xo-web          echo cleaning xo-web
35          rm -rf xo-web          rm -rf xo-web
36    
37    #       echo cleaning xo-web-v4
38    #       rm -rf xo-web-v4
39    
40          echo cleaning xo-server          echo cleaning xo-server
41          rm -rf xo-server          rm -rf xo-server
42    
# Line 37  if [ "$1" == "clean" ] ; then Line 52  if [ "$1" == "clean" ] ; then
52          echo cleaning .forever          echo cleaning .forever
53          rm -rf .forever          rm -rf .forever
54          rm -rf forever.log          rm -rf forever.log
55            
56    
57          echo done          echo done
58          exit          exit
# Line 49  if [ ! -x "/usr/bin/curl" ] ; then Line 64  if [ ! -x "/usr/bin/curl" ] ; then
64          apt-get install curl || exit          apt-get install curl || exit
65  fi  fi
66    
67    if [ ! -x "/usr/bin/gcc" ] ; then
68            echo "installing build-essential"
69            apt-get install  build-essential || exit
70    fi
71    
72    if [ ! -f "/usr/include/libpng12/png.h" ] ; then
73            echo "installing libpng"
74            apt-get install libpng12-dev || exit
75    fi
76    
77    if [ ! -x "/usr/bin/redis-server" ] ; then
78            echo "installing redis-server"
79            apt-get install  redis-server || exit
80    fi
81    
82    if [ ! -x "/usr/bin/git" ] ; then
83            echo "installing git"
84            apt-get install git || exit
85    fi
86    
87    
88  if [ ! -x "/usr/local/bin/n" ] ; then  if [ ! -x "/usr/local/bin/n" ] ; then
89          echo "installing node.js bootstrap"          echo "installing node.js bootstrap"
90          curl -o /usr/local/bin/n https://raw.githubusercontent.com/visionmedia/n/master/bin/n || exit          curl -o /usr/local/bin/n https://raw.githubusercontent.com/visionmedia/n/master/bin/n || exit
# Line 62  fi Line 98  fi
98    
99  if [ ! -x "/usr/local/bin/gulp" ] ; then  if [ ! -x "/usr/local/bin/gulp" ] ; then
100          echo "installing gulp"          echo "installing gulp"
101          npm install -x gulp          npm install -g gulp || exit
102  fi  fi
103    
104    if [ ! -x "/usr/local/bin/forever" ] ; then
105            echo "installing forever"
106            npm install -g forever || exit
107    fi
108    
109    if [ ! -x "/usr/local/bin/node-gyp" ] ; then
110            echo "installing node-gyp"
111            npm install -g node-gyp || exit
112    fi
113    
114    if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
115            echo "installing bcrypt"
116            npm install -g bcrypt || exit
117    fi
118    
119  if [ ! -d "xo-web" ] ; then  if [ ! -d "xo-web" ] ; then
120          git clone -b $BRANCH https://github.com/vatesfr/xo-web.git          git clone -b $BRANCH https://github.com/vatesfr/xo-web.git
# Line 75  else Line 124  else
124          cd ..          cd ..
125  fi  fi
126    
127    #if [ ! -d "xo-web-v4" ] ; then
128    #       git clone -b $BRANCH https://github.com/vatesfr/xo-web.git xo-web-v4
129    #       cd xo-web-v4
130    #       git checkout tags/v4.16.0
131    #       cd ..
132    #fi
133    
134  if [ ! -d "xo-server" ] ; then  if [ ! -d "xo-server" ] ; then
135          git clone -b $BRANCH https://github.com/vatesfr/xo-server.git          git clone -b $BRANCH https://github.com/vatesfr/xo-server.git
# Line 88  fi Line 143  fi
143  # xo-server  # xo-server
144  echo "building xo-server"  echo "building xo-server"
145  cd xo-server  cd xo-server
146  npm install || exit          npm install || exit
147  npm run build || exit          npm run build || exit
148    
149            #for some reasone leveldown  fails occasionally on arm/raspberry pi
150            if [ ! -d "/root/xo-server/node_modules/leveldown/build" ] ; then
151                    pushd node_modules/leveldown
152                    node-gyp configure || exit
153                    node-gyp build || exit
154                    popd
155            fi
156  cd ..  cd ..
157    
158    
159    
160  #xo-web  #xo-web
161  echo "building xo-web"  echo "building xo-web"
162  cd xo-web  cd xo-web
163  npm install --unsafe-perm || exit          #npm install --unsafe-perm || exit
164  npm run build || exit          npm install || exit
165            npm run build || exit
166  cd ..  cd ..
167    
168  restartxo  ##xo-web-v4
169    #echo "building xo-web-v4"
170    #cd xo-web-v4
171    #       npm install || exit
172    #       npm run build || exit
173    #cd ..
174    
175    
176    
177    #if [ ! -f xo-web/dist/styles/main.css ] ; then
178    #       mkdir xo-web/dist/styles
179    #       mkdir xo-web/dist/images
180    #
181    #       cp xo-web-v4/dist/styles/main.css xo-web/dist/styles/main.css
182    #       cp xo-web-v4/dist/images/logo_small.png xo-web/dist/images/logo_small.png
183    #fi
184    
185    
186    if [ ! -f "/etc/xo-server/config.yaml" ] ; then
187            if  [ ! -d "/etc/xo-server" ] ; then
188                    mkdir /etc/xo-server
189            fi
190    
191            echo "please setup /etc/xo-server/config.yaml"
192            exit
193    fi
194    
195    echo Installing plugins
196    npm install --global xo-server-transport-email
197    npm install --global xo-server-transport-xmpp
198    #npm install --save xo-server-usage-report
199    
200    
201    #restartxo
202    
203    

Legend:
Removed from v.2959  
changed lines
  Added in v.3176

  ViewVC Help
Powered by ViewVC 1.1.20