/[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 3109 by torben, Wed Aug 31 09:12:33 2016 UTC revision 3194 by torben, Mon Mar 20 21:54:00 2017 UTC
# Line 5  Line 5 
5  #  #
6  # If running on a raspberry 1(A/B) raspian/wheezy - downgrade node.js to 5.4.0  # 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  # Please note that raspian/wheezy for arm defaults to gcc 4.6
8  # gcc 4.7 is needed for compiling node-js modules  # <strike>gcc 4.7</strike> is needed for compiling node-js modules
9    # 2017-01-03 gcc 4.8 is required
10    
11  BRANCH=stable  BRANCH=stable
12    
13    
14    ###################################
15    # Exit bash if a command fails
16    set -e
17    # also exit if a part of a pipe fails
18    set -o pipefail
19    
20    
21    
22  function restartxo {  function restartxo {
23          killall -9 node          killall -9 node
24          rm -f /root/forever.log          rm -f /root/forever.log
# Line 21  if [ "$1" == "restart" ] ; then Line 30  if [ "$1" == "restart" ] ; then
30          exit          exit
31  fi  fi
32    
33    
34    phymem=$(free -m|awk '/^Mem:/{print $2}')
35    swapmem=$(free -m|awk '/^Swap:/{print $2}')
36    total=$(expr $phymem + $swapmem)
37    if [ $total -le 1536 ] ; then
38            echo not enough memory: $total
39            exit
40    fi
41    
42  if [ "$1" == "clean" ] ; then  if [ "$1" == "clean" ] ; then
43            echo cleaning global npm packages
44            npm uninstall -g gulp
45            npm uninstall -g node-gyp
46            npm uninstall -g forever
47            npm uninstall -g bcrypt
48    
49          echo cleaning xo-web          echo cleaning xo-web
50          rm -rf xo-web          rm -rf xo-web
51    
52          echo cleaning xo-web-v4  #       echo cleaning xo-web-v4
53          rm -rf xo-web-v4  #       rm -rf xo-web-v4
54    
55          echo cleaning xo-server          echo cleaning xo-server
56          rm -rf xo-server          rm -rf xo-server
# Line 84  fi Line 108  fi
108    
109  if [ ! -x "/usr/local/bin/node" ] ; then  if [ ! -x "/usr/local/bin/node" ] ; then
110          echo "installing node.js"          echo "installing node.js"
111          n stable || exit          n lts || exit
112  fi  fi
113    
114  if [ ! -x "/usr/local/bin/gulp" ] ; then  if [ ! -x "/usr/local/bin/gulp" ] ; then
# Line 104  fi Line 128  fi
128    
129  if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then  if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
130          echo "installing bcrypt"          echo "installing bcrypt"
131          npm install -g bcrypt || exit          npm install -g --unsafe-perm bcrypt || exit
132  fi  fi
133    
134  if [ ! -d "xo-web" ] ; then  if [ ! -d "xo-web" ] ; then
# Line 115  else Line 139  else
139          cd ..          cd ..
140  fi  fi
141    
142  if [ ! -d "xo-web-v4" ] ; then  #if [ ! -d "xo-web-v4" ] ; then
143          git clone -b $BRANCH https://github.com/vatesfr/xo-web.git xo-web-v4  #       git clone -b $BRANCH https://github.com/vatesfr/xo-web.git xo-web-v4
144          cd xo-web-v4  #       cd xo-web-v4
145          git checkout tags/v4.16.0  #       git checkout tags/v4.16.0
146          cd ..  #       cd ..
147  fi  #fi
148    
149  if [ ! -d "xo-server" ] ; then  if [ ! -d "xo-server" ] ; then
150          git clone -b $BRANCH https://github.com/vatesfr/xo-server.git          git clone -b $BRANCH https://github.com/vatesfr/xo-server.git
# Line 134  fi Line 158  fi
158  # xo-server  # xo-server
159  echo "building xo-server"  echo "building xo-server"
160  cd xo-server  cd xo-server
161          npm install || exit          npm install --unsafe-perm || exit
162          npm run build || exit          npm run build || exit
163    
164          #for some reasone leveldown  fails occasionally on arm/raspberry pi          #for some reasone leveldown  fails occasionally on arm/raspberry pi
# Line 151  cd .. Line 175  cd ..
175  #xo-web  #xo-web
176  echo "building xo-web"  echo "building xo-web"
177  cd xo-web  cd xo-web
178          #npm install --unsafe-perm || exit          npm install --unsafe-perm || exit
179          npm install || exit          #npm install || exit
         npm run build || exit  
 cd ..  
   
 #xo-web-v4  
 echo "building xo-web-v4"  
 cd xo-web-v4  
         npm install || exit  
180          npm run build || exit          npm run build || exit
181  cd ..  cd ..
182    
183    ##xo-web-v4
184    #echo "building xo-web-v4"
185    #cd xo-web-v4
186    #       npm install || exit
187    #       npm run build || exit
188    #cd ..
189    
190    
 if [ ! -f xo-web/dist/styles/main.css ] ; then  
         mkdir xo-web/dist/styles  
         mkdir xo-web/dist/images  
191    
192          cp xo-web-v4/dist/styles/main.css xo-web/dist/styles/main.css  #if [ ! -f xo-web/dist/styles/main.css ] ; then
193          cp xo-web-v4/dist/images/logo_small.png xo-web/dist/images/logo_small.png  #       mkdir xo-web/dist/styles
194  fi  #       mkdir xo-web/dist/images
195    #
196    #       cp xo-web-v4/dist/styles/main.css xo-web/dist/styles/main.css
197    #       cp xo-web-v4/dist/images/logo_small.png xo-web/dist/images/logo_small.png
198    #fi
199    
200    dir=`dirname $0`
201    
202  if [ ! -f "/etc/xo-server/config.yaml" ] ; then  if [ ! -f "/etc/xo-server/config.yaml" ] ; then
203          if  [ ! -d "/etc/xo-server" ] ; then          if  [ ! -d "/etc/xo-server" ] ; then
204                  mkdir /etc/xo-server                  mkdir /etc/xo-server
205          fi          fi
206            copy $dir/config.yaml /etc/xo-server/config.yaml
         echo "please setup /etc/xo-server/config.yaml"  
         exit  
207  fi  fi
208    
209    echo Installing plugins
210    npm install --global xo-server-transport-email
211    npm install --global xo-server-transport-xmpp
212    npm install --global xo-server-backup-reports
213    
214    #npm install --save xo-server-usage-report
215    
216    
217  #restartxo  #restartxo
218    
219    

Legend:
Removed from v.3109  
changed lines
  Added in v.3194

  ViewVC Help
Powered by ViewVC 1.1.20