/[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 3120 - (show annotations) (download) (as text)
Thu Sep 29 12:41:32 2016 UTC (7 years, 7 months ago) by torben
File MIME type: application/x-sh
File size: 3520 byte(s)
it's no longer needed to use login logo and css from old v4
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 function restartxo {
14 killall -9 node
15 rm -f /root/forever.log
16 forever start -l /root/forever.log /root/xo-server/bin/xo-server
17 }
18
19 if [ "$1" == "restart" ] ; then
20 restartxo
21 exit
22 fi
23
24 if [ "$1" == "clean" ] ; then
25 echo cleaning xo-web
26 rm -rf xo-web
27
28 # echo cleaning xo-web-v4
29 # rm -rf xo-web-v4
30
31 echo cleaning xo-server
32 rm -rf xo-server
33
34 echo cleaning .npm
35 rm -rf .npm
36
37 echo cleaning .node-gyp
38 rm -rf .node-gyp
39
40 echo cleaning .cache
41 rm -rf .cache
42
43 echo cleaning .forever
44 rm -rf .forever
45 rm -rf forever.log
46
47
48 echo done
49 exit
50 fi
51
52
53 if [ ! -x "/usr/bin/curl" ] ; then
54 echo "installing curl"
55 apt-get install curl || exit
56 fi
57
58 if [ ! -x "/usr/bin/gcc" ] ; then
59 echo "installing build-essential"
60 apt-get install build-essential || exit
61 fi
62
63 if [ ! -f "/usr/include/libpng12/png.h" ] ; then
64 echo "installing libpng"
65 apt-get install libpng12-dev || exit
66 fi
67
68 if [ ! -x "/usr/bin/redis-server" ] ; then
69 echo "installing redis-server"
70 apt-get install redis-server || exit
71 fi
72
73 if [ ! -x "/usr/bin/git" ] ; then
74 echo "installing git"
75 apt-get install git || exit
76 fi
77
78
79 if [ ! -x "/usr/local/bin/n" ] ; then
80 echo "installing node.js bootstrap"
81 curl -o /usr/local/bin/n https://raw.githubusercontent.com/visionmedia/n/master/bin/n || exit
82 chmod +x /usr/local/bin/n
83 fi
84
85 if [ ! -x "/usr/local/bin/node" ] ; then
86 echo "installing node.js"
87 n stable || exit
88 fi
89
90 if [ ! -x "/usr/local/bin/gulp" ] ; then
91 echo "installing gulp"
92 npm install -g gulp || exit
93 fi
94
95 if [ ! -x "/usr/local/bin/forever" ] ; then
96 echo "installing forever"
97 npm install -g forever || exit
98 fi
99
100 if [ ! -x "/usr/local/bin/node-gyp" ] ; then
101 echo "installing node-gyp"
102 npm install -g node-gyp || exit
103 fi
104
105 if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
106 echo "installing bcrypt"
107 npm install -g bcrypt || exit
108 fi
109
110 if [ ! -d "xo-web" ] ; then
111 git clone -b $BRANCH https://github.com/vatesfr/xo-web.git
112 else
113 cd xo-web
114 git pull
115 cd ..
116 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
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 echo "building xo-server"
136 cd xo-server
137 npm install || exit
138 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 ..
148
149
150
151 #xo-web
152 echo "building xo-web"
153 cd xo-web
154 #npm install --unsafe-perm || exit
155 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 ..
165
166
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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20