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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3176 - (show annotations) (download) (as text)
Tue Dec 20 14:28:51 2016 UTC (7 years, 4 months ago) by torben
File MIME type: application/x-sh
File size: 3814 byte(s)
exit if any error
1 #!/bin/bash
2
3
4 # Note: this script works on debian 7/wheezy and debian 8/jessie
5 #
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
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
22 function restartxo {
23 killall -9 node
24 rm -f /root/forever.log
25 forever start -l /root/forever.log /root/xo-server/bin/xo-server
26 }
27
28 if [ "$1" == "restart" ] ; then
29 restartxo
30 exit
31 fi
32
33 if [ "$1" == "clean" ] ; then
34 echo cleaning xo-web
35 rm -rf xo-web
36
37 # echo cleaning xo-web-v4
38 # rm -rf xo-web-v4
39
40 echo cleaning xo-server
41 rm -rf xo-server
42
43 echo cleaning .npm
44 rm -rf .npm
45
46 echo cleaning .node-gyp
47 rm -rf .node-gyp
48
49 echo cleaning .cache
50 rm -rf .cache
51
52 echo cleaning .forever
53 rm -rf .forever
54 rm -rf forever.log
55
56
57 echo done
58 exit
59 fi
60
61
62 if [ ! -x "/usr/bin/curl" ] ; then
63 echo "installing curl"
64 apt-get install curl || exit
65 fi
66
67 if [ ! -x "/usr/bin/gcc" ] ; then
68 echo "installing build-essential"
69 apt-get install build-essential || exit
70 fi
71
72 if [ ! -f "/usr/include/libpng12/png.h" ] ; then
73 echo "installing libpng"
74 apt-get install libpng12-dev || exit
75 fi
76
77 if [ ! -x "/usr/bin/redis-server" ] ; then
78 echo "installing redis-server"
79 apt-get install redis-server || exit
80 fi
81
82 if [ ! -x "/usr/bin/git" ] ; then
83 echo "installing git"
84 apt-get install git || exit
85 fi
86
87
88 if [ ! -x "/usr/local/bin/n" ] ; then
89 echo "installing node.js bootstrap"
90 curl -o /usr/local/bin/n https://raw.githubusercontent.com/visionmedia/n/master/bin/n || exit
91 chmod +x /usr/local/bin/n
92 fi
93
94 if [ ! -x "/usr/local/bin/node" ] ; then
95 echo "installing node.js"
96 n stable || exit
97 fi
98
99 if [ ! -x "/usr/local/bin/gulp" ] ; then
100 echo "installing gulp"
101 npm install -g gulp || exit
102 fi
103
104 if [ ! -x "/usr/local/bin/forever" ] ; then
105 echo "installing forever"
106 npm install -g forever || exit
107 fi
108
109 if [ ! -x "/usr/local/bin/node-gyp" ] ; then
110 echo "installing node-gyp"
111 npm install -g node-gyp || exit
112 fi
113
114 if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
115 echo "installing bcrypt"
116 npm install -g bcrypt || exit
117 fi
118
119 if [ ! -d "xo-web" ] ; then
120 git clone -b $BRANCH https://github.com/vatesfr/xo-web.git
121 else
122 cd xo-web
123 git pull
124 cd ..
125 fi
126
127 #if [ ! -d "xo-web-v4" ] ; then
128 # git clone -b $BRANCH https://github.com/vatesfr/xo-web.git xo-web-v4
129 # cd xo-web-v4
130 # git checkout tags/v4.16.0
131 # cd ..
132 #fi
133
134 if [ ! -d "xo-server" ] ; then
135 git clone -b $BRANCH https://github.com/vatesfr/xo-server.git
136 else
137 cd xo-server
138 git pull
139 cd ..
140 fi
141
142
143 # xo-server
144 echo "building xo-server"
145 cd xo-server
146 npm install || exit
147 npm run build || exit
148
149 #for some reasone leveldown fails occasionally on arm/raspberry pi
150 if [ ! -d "/root/xo-server/node_modules/leveldown/build" ] ; then
151 pushd node_modules/leveldown
152 node-gyp configure || exit
153 node-gyp build || exit
154 popd
155 fi
156 cd ..
157
158
159
160 #xo-web
161 echo "building xo-web"
162 cd xo-web
163 #npm install --unsafe-perm || exit
164 npm install || exit
165 npm run build || exit
166 cd ..
167
168 ##xo-web-v4
169 #echo "building xo-web-v4"
170 #cd xo-web-v4
171 # npm install || exit
172 # npm run build || exit
173 #cd ..
174
175
176
177 #if [ ! -f xo-web/dist/styles/main.css ] ; then
178 # mkdir xo-web/dist/styles
179 # mkdir xo-web/dist/images
180 #
181 # cp xo-web-v4/dist/styles/main.css xo-web/dist/styles/main.css
182 # cp xo-web-v4/dist/images/logo_small.png xo-web/dist/images/logo_small.png
183 #fi
184
185
186 if [ ! -f "/etc/xo-server/config.yaml" ] ; then
187 if [ ! -d "/etc/xo-server" ] ; then
188 mkdir /etc/xo-server
189 fi
190
191 echo "please setup /etc/xo-server/config.yaml"
192 exit
193 fi
194
195 echo Installing plugins
196 npm install --global xo-server-transport-email
197 npm install --global xo-server-transport-xmpp
198 #npm install --save xo-server-usage-report
199
200
201 #restartxo

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20