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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3195 - (hide annotations) (download) (as text)
Tue Mar 21 13:45:27 2017 UTC (7 years, 2 months ago) by torben
File MIME type: application/x-sh
File size: 3097 byte(s)
use yarn for building - and cleanup old/unused code
1 torben 2956 #!/bin/bash
2    
3    
4 torben 2990 # Note: this script works on debian 7/wheezy and debian 8/jessie
5 torben 2989 #
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 torben 3183 # <strike>gcc 4.7</strike> is needed for compiling node-js modules
9     # 2017-01-03 gcc 4.8 is required
10 torben 2956
11 torben 3062 BRANCH=stable
12 torben 2956
13    
14 torben 3176 ###################################
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 torben 2956
23 torben 3180 phymem=$(free -m|awk '/^Mem:/{print $2}')
24     swapmem=$(free -m|awk '/^Swap:/{print $2}')
25     total=$(expr $phymem + $swapmem)
26     if [ $total -le 1536 ] ; then
27     echo not enough memory: $total
28     exit
29     fi
30    
31 torben 2956 if [ "$1" == "clean" ] ; then
32 torben 3194 echo cleaning global npm packages
33     npm uninstall -g gulp
34     npm uninstall -g node-gyp
35     npm uninstall -g bcrypt
36 torben 3195 npm uninstall -g yarn
37 torben 3194
38 torben 2956 echo cleaning xo-web
39     rm -rf xo-web
40    
41     echo cleaning xo-server
42     rm -rf xo-server
43    
44     echo cleaning .npm
45     rm -rf .npm
46    
47     echo cleaning .node-gyp
48     rm -rf .node-gyp
49    
50     echo cleaning .cache
51     rm -rf .cache
52    
53     echo done
54     exit
55     fi
56    
57 torben 2957
58 torben 2958 if [ ! -x "/usr/bin/curl" ] ; then
59     echo "installing curl"
60     apt-get install curl || exit
61     fi
62    
63 torben 2961 if [ ! -x "/usr/bin/gcc" ] ; then
64     echo "installing build-essential"
65     apt-get install build-essential || exit
66     fi
67 torben 2962
68 torben 2983 if [ ! -f "/usr/include/libpng12/png.h" ] ; then
69     echo "installing libpng"
70 torben 2986 apt-get install libpng12-dev || exit
71 torben 2983 fi
72    
73 torben 2962 if [ ! -x "/usr/bin/redis-server" ] ; then
74     echo "installing redis-server"
75     apt-get install redis-server || exit
76     fi
77 torben 2980
78     if [ ! -x "/usr/bin/git" ] ; then
79     echo "installing git"
80 torben 2986 apt-get install git || exit
81 torben 2980 fi
82 torben 2961
83 torben 2990
84 torben 2957 if [ ! -x "/usr/local/bin/n" ] ; then
85     echo "installing node.js bootstrap"
86     curl -o /usr/local/bin/n https://raw.githubusercontent.com/visionmedia/n/master/bin/n || exit
87     chmod +x /usr/local/bin/n
88     fi
89    
90     if [ ! -x "/usr/local/bin/node" ] ; then
91     echo "installing node.js"
92 torben 3182 n lts || exit
93 torben 2957 fi
94    
95 torben 2959 if [ ! -x "/usr/local/bin/gulp" ] ; then
96     echo "installing gulp"
97 torben 2986 npm install -g gulp || exit
98 torben 2959 fi
99 torben 2957
100 torben 3195 if [ ! -x "/usr/local/bin/yarn" ] ; then
101     echo "installing yarn"
102     npm install -g yarn || exit
103 torben 2963 fi
104 torben 2957
105 torben 3195
106 torben 2979 if [ ! -x "/usr/local/bin/node-gyp" ] ; then
107     echo "installing node-gyp"
108 torben 2986 npm install -g node-gyp || exit
109 torben 2979 fi
110    
111 torben 2982 if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
112 torben 2981 echo "installing bcrypt"
113 torben 3180 npm install -g --unsafe-perm bcrypt || exit
114 torben 2981 fi
115 torben 2959
116 torben 2956 if [ ! -d "xo-web" ] ; then
117     git clone -b $BRANCH https://github.com/vatesfr/xo-web.git
118     else
119     cd xo-web
120     git pull
121     cd ..
122     fi
123    
124    
125     if [ ! -d "xo-server" ] ; then
126     git clone -b $BRANCH https://github.com/vatesfr/xo-server.git
127     else
128     cd xo-server
129     git pull
130     cd ..
131     fi
132    
133    
134     # xo-server
135 torben 2959 echo "building xo-server"
136 torben 2956 cd xo-server
137 torben 3195 yarn
138 torben 2956 cd ..
139    
140    
141 torben 2991
142 torben 2956 #xo-web
143 torben 2959 echo "building xo-web"
144 torben 2956 cd xo-web
145 torben 3195 yarn
146 torben 2956 cd ..
147    
148 torben 2991
149 torben 3186 dir=`dirname $0`
150 torben 3109
151 torben 2990 if [ ! -f "/etc/xo-server/config.yaml" ] ; then
152     if [ ! -d "/etc/xo-server" ] ; then
153     mkdir /etc/xo-server
154     fi
155 torben 3186 copy $dir/config.yaml /etc/xo-server/config.yaml
156 torben 2984 fi
157    
158 torben 3176 echo Installing plugins
159     npm install --global xo-server-transport-email
160     npm install --global xo-server-transport-xmpp
161 torben 3177 npm install --global xo-server-backup-reports
162    
163 torben 3176 #npm install --save xo-server-usage-report
164    
165    
166 torben 3109 #restartxo

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20