/[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 2991 - (show annotations) (download) (as text)
Mon Mar 28 21:28:47 2016 UTC (8 years, 1 month ago) by torben
File MIME type: application/x-sh
File size: 2935 byte(s)
add scotion to enforce leveldown
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=master
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-server
29 rm -rf xo-server
30
31 echo cleaning .npm
32 rm -rf .npm
33
34 echo cleaning .node-gyp
35 rm -rf .node-gyp
36
37 echo cleaning .cache
38 rm -rf .cache
39
40 echo cleaning .forever
41 rm -rf .forever
42 rm -rf forever.log
43
44
45 echo done
46 exit
47 fi
48
49
50 if [ ! -x "/usr/bin/curl" ] ; then
51 echo "installing curl"
52 apt-get install curl || exit
53 fi
54
55 if [ ! -x "/usr/bin/gcc" ] ; then
56 echo "installing build-essential"
57 apt-get install build-essential || exit
58 fi
59
60 if [ ! -f "/usr/include/libpng12/png.h" ] ; then
61 echo "installing libpng"
62 apt-get install libpng12-dev || exit
63 fi
64
65 if [ ! -x "/usr/bin/redis-server" ] ; then
66 echo "installing redis-server"
67 apt-get install redis-server || exit
68 fi
69
70 if [ ! -x "/usr/bin/git" ] ; then
71 echo "installing git"
72 apt-get install git || exit
73 fi
74
75
76 if [ ! -x "/usr/local/bin/n" ] ; then
77 echo "installing node.js bootstrap"
78 curl -o /usr/local/bin/n https://raw.githubusercontent.com/visionmedia/n/master/bin/n || exit
79 chmod +x /usr/local/bin/n
80 fi
81
82 if [ ! -x "/usr/local/bin/node" ] ; then
83 echo "installing node.js"
84 n stable || exit
85 fi
86
87 if [ ! -x "/usr/local/bin/gulp" ] ; then
88 echo "installing gulp"
89 npm install -g gulp || exit
90 fi
91
92 if [ ! -x "/usr/local/bin/forever" ] ; then
93 echo "installing forever"
94 npm install -g forever || exit
95 fi
96
97 if [ ! -x "/usr/local/bin/node-gyp" ] ; then
98 echo "installing node-gyp"
99 npm install -g node-gyp || exit
100 fi
101
102 if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
103 echo "installing bcrypt"
104 npm install -g bcrypt || exit
105 fi
106
107 if [ ! -d "xo-web" ] ; then
108 git clone -b $BRANCH https://github.com/vatesfr/xo-web.git
109 else
110 cd xo-web
111 git pull
112 cd ..
113 fi
114
115
116 if [ ! -d "xo-server" ] ; then
117 git clone -b $BRANCH https://github.com/vatesfr/xo-server.git
118 else
119 cd xo-server
120 git pull
121 cd ..
122 fi
123
124
125 # xo-server
126 echo "building xo-server"
127 cd xo-server
128 npm install || exit
129 npm run build || exit
130
131 #for some reasone leveldown fails occasionally on arm/raspberry pi
132 if [ ! -d "/root/xo-server/node_modules/leveldown/build" ] ; then
133 pushd node_modules/leveldown
134 node-gyp configure || exit
135 node-gyp build || exit
136 popd
137 fi
138 cd ..
139
140
141
142 #xo-web
143 echo "building xo-web"
144 cd xo-web
145 npm install --unsafe-perm || exit
146 npm run build || exit
147 cd ..
148
149
150 if [ ! -f "/etc/xo-server/config.yaml" ] ; then
151 if [ ! -d "/etc/xo-server" ] ; then
152 mkdir /etc/xo-server
153 fi
154
155 echo "please setup /etc/xo-server/config.yaml"
156 exit
157 fi
158
159 restartxo

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20