/[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 2983 by torben, Sat Mar 19 11:58:04 2016 UTC revision 3109 by torben, Wed Aug 31 09:12:33 2016 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
3    
4  # Note: this script works on debian 7 /wheezy  # Note: this script works on debian 7/wheezy and debian 8/jessie
5  # I haven't yet managed to get it to work on deb8/jessie  #
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
 BRANCH=master  
11    
12    
13  function restartxo {  function restartxo {
# Line 23  if [ "$1" == "clean" ] ; then Line 25  if [ "$1" == "clean" ] ; then
25          echo cleaning xo-web          echo cleaning xo-web
26          rm -rf xo-web          rm -rf xo-web
27    
28            echo cleaning xo-web-v4
29            rm -rf xo-web-v4
30    
31          echo cleaning xo-server          echo cleaning xo-server
32          rm -rf xo-server          rm -rf xo-server
33    
# Line 38  if [ "$1" == "clean" ] ; then Line 43  if [ "$1" == "clean" ] ; then
43          echo cleaning .forever          echo cleaning .forever
44          rm -rf .forever          rm -rf .forever
45          rm -rf forever.log          rm -rf forever.log
46            
47    
48          echo done          echo done
49          exit          exit
# Line 57  fi Line 62  fi
62    
63  if [ ! -f "/usr/include/libpng12/png.h" ] ; then  if [ ! -f "/usr/include/libpng12/png.h" ] ; then
64          echo "installing libpng"          echo "installing libpng"
65          apt-get install libpng12-dev          apt-get install libpng12-dev || exit
66  fi  fi
67    
68  if [ ! -x "/usr/bin/redis-server" ] ; then  if [ ! -x "/usr/bin/redis-server" ] ; then
# Line 67  fi Line 72  fi
72    
73  if [ ! -x "/usr/bin/git" ] ; then  if [ ! -x "/usr/bin/git" ] ; then
74          echo "installing git"          echo "installing git"
75          apt-get install git          apt-get install git || exit
76  fi  fi
77            
78    
79  if [ ! -x "/usr/local/bin/n" ] ; then  if [ ! -x "/usr/local/bin/n" ] ; then
80          echo "installing node.js bootstrap"          echo "installing node.js bootstrap"
# Line 84  fi Line 89  fi
89    
90  if [ ! -x "/usr/local/bin/gulp" ] ; then  if [ ! -x "/usr/local/bin/gulp" ] ; then
91          echo "installing gulp"          echo "installing gulp"
92          npm install -g gulp          npm install -g gulp || exit
93  fi  fi
94    
95  if [ ! -x "/usr/local/bin/forever" ] ; then  if [ ! -x "/usr/local/bin/forever" ] ; then
96          echo "installing forever"          echo "installing forever"
97          npm install -g forever          npm install -g forever || exit
98  fi  fi
99    
100  if [ ! -x "/usr/local/bin/node-gyp" ] ; then  if [ ! -x "/usr/local/bin/node-gyp" ] ; then
101          echo "installing node-gyp"          echo "installing node-gyp"
102          npm install -g node-gyp          npm install -g node-gyp || exit
103  fi  fi
104    
105  if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then  if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
106          echo "installing bcrypt"          echo "installing bcrypt"
107          npm install -g bcrypt          npm install -g bcrypt || exit
108  fi  fi
109    
110  if [ ! -d "xo-web" ] ; then  if [ ! -d "xo-web" ] ; then
# Line 110  else Line 115  else
115          cd ..          cd ..
116  fi  fi
117    
118    if [ ! -d "xo-web-v4" ] ; then
119            git clone -b $BRANCH https://github.com/vatesfr/xo-web.git xo-web-v4
120            cd xo-web-v4
121            git checkout tags/v4.16.0
122            cd ..
123    fi
124    
125  if [ ! -d "xo-server" ] ; then  if [ ! -d "xo-server" ] ; then
126          git clone -b $BRANCH https://github.com/vatesfr/xo-server.git          git clone -b $BRANCH https://github.com/vatesfr/xo-server.git
# Line 123  fi Line 134  fi
134  # xo-server  # xo-server
135  echo "building xo-server"  echo "building xo-server"
136  cd xo-server  cd xo-server
137  npm install || exit          npm install || exit
138  npm run build || exit          npm run build || exit
139    
140            #for some reasone leveldown  fails occasionally on arm/raspberry pi
141            if [ ! -d "/root/xo-server/node_modules/leveldown/build" ] ; then
142                    pushd node_modules/leveldown
143                    node-gyp configure || exit
144                    node-gyp build || exit
145                    popd
146            fi
147  cd ..  cd ..
148    
149    
150    
151  #xo-web  #xo-web
152  echo "building xo-web"  echo "building xo-web"
153  cd xo-web  cd xo-web
154  npm install --unsafe-perm || exit          #npm install --unsafe-perm || exit
155  npm run build || exit          npm install || exit
156            npm run build || exit
157    cd ..
158    
159    #xo-web-v4
160    echo "building xo-web-v4"
161    cd xo-web-v4
162            npm install || exit
163            npm run build || exit
164  cd ..  cd ..
165    
166  restartxo  
167    
168    if [ ! -f xo-web/dist/styles/main.css ] ; then
169            mkdir xo-web/dist/styles
170            mkdir xo-web/dist/images
171    
172            cp xo-web-v4/dist/styles/main.css xo-web/dist/styles/main.css
173            cp xo-web-v4/dist/images/logo_small.png xo-web/dist/images/logo_small.png
174    fi
175    
176    
177    if [ ! -f "/etc/xo-server/config.yaml" ] ; then
178            if  [ ! -d "/etc/xo-server" ] ; then
179                    mkdir /etc/xo-server
180            fi
181    
182            echo "please setup /etc/xo-server/config.yaml"
183            exit
184    fi
185    
186    #restartxo
187    
188    

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

  ViewVC Help
Powered by ViewVC 1.1.20