/[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 3194 by torben, Mon Mar 20 21:54:00 2017 UTC revision 3226 by torben, Wed Apr 11 12:44:28 2018 UTC
# Line 10  Line 10 
10    
11  BRANCH=stable  BRANCH=stable
12    
13    #Uncomment next line if you want to trick into building enterprise version
14    #export XOA_PLAN=4
15    
16  ###################################  ###################################
17  # Exit bash if a command fails  # Exit bash if a command fails
# Line 19  set -o pipefail Line 21  set -o pipefail
21    
22    
23    
 function restartxo {  
         killall -9 node  
         rm -f /root/forever.log  
         forever start -l /root/forever.log /root/xo-server/bin/xo-server  
 }  
   
 if [ "$1" == "restart" ] ; then  
         restartxo  
         exit  
 fi  
   
24    
25  phymem=$(free -m|awk '/^Mem:/{print $2}')  phymem=$(free -m|awk '/^Mem:/{print $2}')
26  swapmem=$(free -m|awk '/^Swap:/{print $2}')  swapmem=$(free -m|awk '/^Swap:/{print $2}')
# Line 43  if [ "$1" == "clean" ] ; then Line 34  if [ "$1" == "clean" ] ; then
34          echo cleaning global npm packages          echo cleaning global npm packages
35          npm uninstall -g gulp          npm uninstall -g gulp
36          npm uninstall -g node-gyp          npm uninstall -g node-gyp
         npm uninstall -g forever  
37          npm uninstall -g bcrypt          npm uninstall -g bcrypt
38            npm uninstall -g yarn
39    
40          echo cleaning xo-web          echo cleaning xo-web
41          rm -rf xo-web          rm -rf xo-web
42    
 #       echo cleaning xo-web-v4  
 #       rm -rf xo-web-v4  
   
43          echo cleaning xo-server          echo cleaning xo-server
44          rm -rf xo-server          rm -rf xo-server
45    
# Line 64  if [ "$1" == "clean" ] ; then Line 52  if [ "$1" == "clean" ] ; then
52          echo cleaning .cache          echo cleaning .cache
53          rm -rf .cache          rm -rf .cache
54    
         echo cleaning .forever  
         rm -rf .forever  
         rm -rf forever.log  
   
   
55          echo done          echo done
56          exit          exit
57  fi  fi
# Line 111  if [ ! -x "/usr/local/bin/node" ] ; then Line 94  if [ ! -x "/usr/local/bin/node" ] ; then
94          n lts || exit          n lts || exit
95  fi  fi
96    
97  if [ ! -x "/usr/local/bin/gulp" ] ; then  #if [ ! -x "/usr/local/bin/gulp" ] ; then
98          echo "installing gulp"  #       echo "installing gulp"
99          npm install -g gulp || exit  #       npm install -g gulp || exit
100  fi  #fi
   
 if [ ! -x "/usr/local/bin/forever" ] ; then  
         echo "installing forever"  
         npm install -g forever || exit  
 fi  
101    
102  if [ ! -x "/usr/local/bin/node-gyp" ] ; then  if [ ! -x "/usr/local/bin/yarn" ] ; then
103          echo "installing node-gyp"          echo "installing yarn"
104          npm install -g node-gyp || exit          npm install -g yarn || exit
105  fi  fi
106    
 if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then  
         echo "installing bcrypt"  
         npm install -g --unsafe-perm bcrypt || exit  
 fi  
107    
108  if [ ! -d "xo-web" ] ; then  #if [ ! -x "/usr/local/bin/node-gyp" ] ; then
109          git clone -b $BRANCH https://github.com/vatesfr/xo-web.git  #       echo "installing node-gyp"
110  else  #       npm install -g node-gyp || exit
111          cd xo-web  #fi
         git pull  
         cd ..  
 fi  
112    
113  #if [ ! -d "xo-web-v4" ] ; then  #if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
114  #       git clone -b $BRANCH https://github.com/vatesfr/xo-web.git xo-web-v4  #       echo "installing bcrypt"
115  #       cd xo-web-v4  #       npm install -g --unsafe-perm bcrypt || exit
 #       git checkout tags/v4.16.0  
 #       cd ..  
116  #fi  #fi
117    
118  if [ ! -d "xo-server" ] ; then  
119          git clone -b $BRANCH https://github.com/vatesfr/xo-server.git  
120    if [ ! -d "xen-orchestra" ] ; then
121            git clone -b $BRANCH https://github.com/vatesfr/xen-orchestra.git
122  else  else
123          cd xo-server          cd xen-orchestra
124          git pull          git pull
125          cd ..          cd ..
126  fi  fi
127    
128    
 # xo-server  
 echo "building xo-server"  
 cd xo-server  
         npm install --unsafe-perm || exit  
         npm run build || exit  
   
         #for some reasone leveldown  fails occasionally on arm/raspberry pi  
         if [ ! -d "/root/xo-server/node_modules/leveldown/build" ] ; then  
                 pushd node_modules/leveldown  
                 node-gyp configure || exit  
                 node-gyp build || exit  
                 popd  
         fi  
 cd ..  
   
129    
130    
131  #xo-web  # xo-server
132  echo "building xo-web"  echo "building xen-orchestra"
133  cd xo-web  cd xen-orchestra
134          npm install --unsafe-perm || exit          yarn
135          #npm install || exit          yarn build
         npm run build || exit  
136  cd ..  cd ..
137    
 ##xo-web-v4  
 #echo "building xo-web-v4"  
 #cd xo-web-v4  
 #       npm install || exit  
 #       npm run build || exit  
 #cd ..  
138    
139    
   
 #if [ ! -f xo-web/dist/styles/main.css ] ; then  
 #       mkdir xo-web/dist/styles  
 #       mkdir xo-web/dist/images  
 #  
 #       cp xo-web-v4/dist/styles/main.css xo-web/dist/styles/main.css  
 #       cp xo-web-v4/dist/images/logo_small.png xo-web/dist/images/logo_small.png  
 #fi  
   
140  dir=`dirname $0`  dir=`dirname $0`
141    
142  if [ ! -f "/etc/xo-server/config.yaml" ] ; then  if [ ! -f "/etc/xo-server/config.yaml" ] ; then

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

  ViewVC Help
Powered by ViewVC 1.1.20