/[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 3195 - (show annotations) (download) (as text)
Tue Mar 21 13:45:27 2017 UTC (7 years, 1 month ago) by torben
File MIME type: application/x-sh
File size: 3097 byte(s)
use yarn for building - and cleanup old/unused code
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
14 ###################################
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
23 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 if [ "$1" == "clean" ] ; then
32 echo cleaning global npm packages
33 npm uninstall -g gulp
34 npm uninstall -g node-gyp
35 npm uninstall -g bcrypt
36 npm uninstall -g yarn
37
38 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
58 if [ ! -x "/usr/bin/curl" ] ; then
59 echo "installing curl"
60 apt-get install curl || exit
61 fi
62
63 if [ ! -x "/usr/bin/gcc" ] ; then
64 echo "installing build-essential"
65 apt-get install build-essential || exit
66 fi
67
68 if [ ! -f "/usr/include/libpng12/png.h" ] ; then
69 echo "installing libpng"
70 apt-get install libpng12-dev || exit
71 fi
72
73 if [ ! -x "/usr/bin/redis-server" ] ; then
74 echo "installing redis-server"
75 apt-get install redis-server || exit
76 fi
77
78 if [ ! -x "/usr/bin/git" ] ; then
79 echo "installing git"
80 apt-get install git || exit
81 fi
82
83
84 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 n lts || exit
93 fi
94
95 if [ ! -x "/usr/local/bin/gulp" ] ; then
96 echo "installing gulp"
97 npm install -g gulp || exit
98 fi
99
100 if [ ! -x "/usr/local/bin/yarn" ] ; then
101 echo "installing yarn"
102 npm install -g yarn || exit
103 fi
104
105
106 if [ ! -x "/usr/local/bin/node-gyp" ] ; then
107 echo "installing node-gyp"
108 npm install -g node-gyp || exit
109 fi
110
111 if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then
112 echo "installing bcrypt"
113 npm install -g --unsafe-perm bcrypt || exit
114 fi
115
116 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 echo "building xo-server"
136 cd xo-server
137 yarn
138 cd ..
139
140
141
142 #xo-web
143 echo "building xo-web"
144 cd xo-web
145 yarn
146 cd ..
147
148
149 dir=`dirname $0`
150
151 if [ ! -f "/etc/xo-server/config.yaml" ] ; then
152 if [ ! -d "/etc/xo-server" ] ; then
153 mkdir /etc/xo-server
154 fi
155 copy $dir/config.yaml /etc/xo-server/config.yaml
156 fi
157
158 echo Installing plugins
159 npm install --global xo-server-transport-email
160 npm install --global xo-server-transport-xmpp
161 npm install --global xo-server-backup-reports
162
163 #npm install --save xo-server-usage-report
164
165
166 #restartxo

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20