/[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 3062 by torben, Thu Jul 7 10:24:05 2016 UTC revision 3182 by torben, Thu Dec 22 13:12:14 2016 UTC
# Line 10  Line 10 
10  BRANCH=stable  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    
20    
21  function restartxo {  function restartxo {
22          killall -9 node          killall -9 node
23          rm -f /root/forever.log          rm -f /root/forever.log
# Line 21  if [ "$1" == "restart" ] ; then Line 29  if [ "$1" == "restart" ] ; then
29          exit          exit
30  fi  fi
31    
32    
33    phymem=$(free -m|awk '/^Mem:/{print $2}')
34    swapmem=$(free -m|awk '/^Swap:/{print $2}')
35    total=$(expr $phymem + $swapmem)
36    if [ $total -le 1536 ] ; then
37            echo not enough memory: $total
38            exit
39    fi
40    
41  if [ "$1" == "clean" ] ; then  if [ "$1" == "clean" ] ; then
42          echo cleaning xo-web          echo cleaning xo-web
43          rm -rf xo-web          rm -rf xo-web
44    
45    #       echo cleaning xo-web-v4
46    #       rm -rf xo-web-v4
47    
48          echo cleaning xo-server          echo cleaning xo-server
49          rm -rf xo-server          rm -rf xo-server
50    
# Line 81  fi Line 101  fi
101    
102  if [ ! -x "/usr/local/bin/node" ] ; then  if [ ! -x "/usr/local/bin/node" ] ; then
103          echo "installing node.js"          echo "installing node.js"
104          n stable || exit          n lts || exit
105  fi  fi
106    
107  if [ ! -x "/usr/local/bin/gulp" ] ; then  if [ ! -x "/usr/local/bin/gulp" ] ; then
# Line 101  fi Line 121  fi
121    
122  if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then  if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
123          echo "installing bcrypt"          echo "installing bcrypt"
124          npm install -g bcrypt || exit          npm install -g --unsafe-perm bcrypt || exit
125  fi  fi
126    
127  if [ ! -d "xo-web" ] ; then  if [ ! -d "xo-web" ] ; then
# Line 112  else Line 132  else
132          cd ..          cd ..
133  fi  fi
134    
135    #if [ ! -d "xo-web-v4" ] ; then
136    #       git clone -b $BRANCH https://github.com/vatesfr/xo-web.git xo-web-v4
137    #       cd xo-web-v4
138    #       git checkout tags/v4.16.0
139    #       cd ..
140    #fi
141    
142  if [ ! -d "xo-server" ] ; then  if [ ! -d "xo-server" ] ; then
143          git clone -b $BRANCH https://github.com/vatesfr/xo-server.git          git clone -b $BRANCH https://github.com/vatesfr/xo-server.git
# Line 125  fi Line 151  fi
151  # xo-server  # xo-server
152  echo "building xo-server"  echo "building xo-server"
153  cd xo-server  cd xo-server
154          npm install || exit          npm install --unsafe-perm || exit
155          npm run build || exit          npm run build || exit
156    
157          #for some reasone leveldown  fails occasionally on arm/raspberry pi          #for some reasone leveldown  fails occasionally on arm/raspberry pi
# Line 142  cd .. Line 168  cd ..
168  #xo-web  #xo-web
169  echo "building xo-web"  echo "building xo-web"
170  cd xo-web  cd xo-web
171          npm install --unsafe-perm || exit          #npm install --unsafe-perm || exit
172            npm install || exit
173          npm run build || exit          npm run build || exit
174  cd ..  cd ..
175    
176    ##xo-web-v4
177    #echo "building xo-web-v4"
178    #cd xo-web-v4
179    #       npm install || exit
180    #       npm run build || exit
181    #cd ..
182    
183    
184    
185    #if [ ! -f xo-web/dist/styles/main.css ] ; then
186    #       mkdir xo-web/dist/styles
187    #       mkdir xo-web/dist/images
188    #
189    #       cp xo-web-v4/dist/styles/main.css xo-web/dist/styles/main.css
190    #       cp xo-web-v4/dist/images/logo_small.png xo-web/dist/images/logo_small.png
191    #fi
192    
193    
194  if [ ! -f "/etc/xo-server/config.yaml" ] ; then  if [ ! -f "/etc/xo-server/config.yaml" ] ; then
195          if  [ ! -d "/etc/xo-server" ] ; then          if  [ ! -d "/etc/xo-server" ] ; then
# Line 156  if [ ! -f "/etc/xo-server/config.yaml" ] Line 200  if [ ! -f "/etc/xo-server/config.yaml" ]
200          exit          exit
201  fi  fi
202    
203  restartxo  echo Installing plugins
204    npm install --global xo-server-transport-email
205    npm install --global xo-server-transport-xmpp
206    npm install --global xo-server-backup-reports
207    
208    #npm install --save xo-server-usage-report
209    
210    
211    #restartxo
212    
213    

Legend:
Removed from v.3062  
changed lines
  Added in v.3182

  ViewVC Help
Powered by ViewVC 1.1.20