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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20