-
Notifications
You must be signed in to change notification settings - Fork 26
/
startup-piwik.sh
330 lines (252 loc) · 17.6 KB
/
startup-piwik.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
#/bin/bash
if [ ! -z ${PIWIK_NOT_BEHIND_PROXY+x} ]
then
echo ">> disable reverse proxy settings - connect to piwik directly"
sed -i '4,5d' /piwik/config/config.ini.php
else
echo ">> piwik is configured to listen behind a reverse proxy now"
if [ ! -z ${PIWIK_PROXY_HEADER+x} ]
then
echo ">> using $PIWIK_PROXY_HEADER header to determine client address"
sed -i "s/HTTP_X_FORWARDED_FOR/$PIWIK_PROXY_HEADER/g" /piwik/config/config.ini.php
fi
fi
if [ ! -z ${PIWIK_HSTS_HEADERS_ENABLE+x} ]
then
echo ">> HSTS Headers enabled"
sed -i 's/#add_header Strict-Transport-Security/add_header Strict-Transport-Security/g' /etc/nginx/conf.d/nginx-piwik.conf
if [ ! -z ${PIWIK_HSTS_HEADERS_ENABLE_NO_SUBDOMAINS+x} ]
then
echo ">> HSTS Headers configured without includeSubdomains"
sed -i 's/; includeSubdomains//g' /etc/nginx/conf.d/nginx-piwik.conf
fi
else
echo ">> HSTS Headers disabled"
fi
if [ -z ${PIWIK_MYSQL_HOST+x} ]
then
PIWIK_MYSQL_HOST=mysql
fi
if [ -z ${PIWIK_MYSQL_PORT+x} ]
then
PIWIK_MYSQL_PORT=3306
fi
if [ -z ${PIWIK_MYSQL_DBNAME+x} ]
then
PIWIK_MYSQL_DBNAME=piwik
fi
if [ -z ${PIWIK_MYSQL_PREFIX+x} ]
then
PIWIK_MYSQL_PREFIX="piwik_"
fi
echo ">> set MYSQL Host: $PIWIK_MYSQL_HOST"
sed -i "s/PIWIK_MYSQL_HOST/$PIWIK_MYSQL_HOST/g" /piwik/config/config.ini.php
echo ">> set MYSQL Port: $PIWIK_MYSQL_PORT"
sed -i "s/PIWIK_MYSQL_PORT/$PIWIK_MYSQL_PORT/g" /piwik/config/config.ini.php
echo ">> set MYSQL User: <hidden>"
sed -i "s/PIWIK_MYSQL_USER/$PIWIK_MYSQL_USER/g" /piwik/config/config.ini.php
echo ">> set MYSQL Password: <hidden>"
sed -i "s/PIWIK_MYSQL_PASSWORD/$PIWIK_MYSQL_PASSWORD/g" /piwik/config/config.ini.php
echo ">> set MYSQL DB Name: $PIWIK_MYSQL_DBNAME"
sed -i "s/PIWIK_MYSQL_DBNAME/$PIWIK_MYSQL_DBNAME/g" /piwik/config/config.ini.php
echo ">> set MYSQL Prefix: $PIWIK_MYSQL_PREFIX"
sed -i "s/PIWIK_MYSQL_PREFIX/$PIWIK_MYSQL_PREFIX/g" /piwik/config/config.ini.php
if [ -z ${PIWIK_RELATIVE_URL_ROOT+x} ]
then
PIWIK_RELATIVE_URL_ROOT="/piwik/"
fi
echo ">> making piwik available beneath: $PIWIK_RELATIVE_URL_ROOT"
# adding softlink for nginx connection
echo ">> adding softlink from /piwik to $PIWIK_RELATIVE_URL_ROOT"
mkdir -p "/usr/share/nginx/html$PIWIK_RELATIVE_URL_ROOT"
PIWIK_RELATIVE_URL_ROOT_WITHOUT_SLASH=$(echo "$PIWIK_RELATIVE_URL_ROOT" | sed 's/\/$//')
echo ">> checking softlink /usr/share/nginx/html$PIWIK_RELATIVE_URL_ROOT_WITHOUT_SLASH"
if [ ! -h "/usr/share/nginx/html$PIWIK_RELATIVE_URL_ROOT_WITHOUT_SLASH" ]
then
echo ">> creating softlink"
rm -rf "/usr/share/nginx/html$PIWIK_RELATIVE_URL_ROOT_WITHOUT_SLASH"
ln -s /piwik "/usr/share/nginx/html$PIWIK_RELATIVE_URL_ROOT_WITHOUT_SLASH"
else
echo ">> doesn't create softlink - it already exists"
fi
chown -R www-data:www-data "/usr/share/nginx/html$PIWIK_RELATIVE_URL_ROOT"
chmod -R 0755 /usr/share/nginx/html$PIWIK_RELATIVE_URL_ROOT\tmp
if [ -z ${PIWIK_MYSQL_PASSWORD+x} ] || [ -z ${PIWIK_MYSQL_USER+x} ]
then
echo ">> piwik started, initial setup needs to be done in browser!"
echo ">> be fast! - anyone with access to your server can configure it!"
exit 0
fi
echo
echo ">> #####################"
echo ">> init piwik"
echo ">> #####################"
echo
nginx 2> /dev/null > /dev/null &
sleep 4
if [ `echo "SHOW TABLES FROM $PIWIK_MYSQL_DBNAME;" | mysql -h $PIWIK_MYSQL_HOST -P $PIWIK_MYSQL_PORT -u $PIWIK_MYSQL_USER -p$PIWIK_MYSQL_PASSWORD | grep "$PIWIK_MYSQL_PREFIX" | wc -l` -lt 1 ]
then
echo ">> no DB installed, MYSQL User or Password specified - seems like the first start"
rm /usr/share/nginx/html$PIWIK_RELATIVE_URL_ROOT\config/config.ini.php
echo ">> init Piwik"
if [ -z ${PIWIK_ADMIN+x} ]
then
PIWIK_ADMIN="admin"
echo ">> piwik admin user: $PIWIK_ADMIN"
fi
if [ -z ${PIWIK_ADMIN_PASSWORD+x} ]
then
PIWIK_ADMIN_PASSWORD=`perl -e 'my @chars = ("A".."Z", "a".."z"); my $string; $string .= $chars[rand @chars] for 1..10; print $string;'`
echo ">> generated piwik admin password: $PIWIK_ADMIN_PASSWORD"
fi
if [ -z ${PIWIK_SUBSCRIBE_NEWSLETTER+x} ]
then
PIWIK_SUBSCRIBE_NEWSLETTER=0
fi
if [ -z ${PIWIK_SUBSCRIBE_PRO_NEWSLETTER+x} ]
then
PIWIK_SUBSCRIBE_PRO_NEWSLETTER=0
fi
if [ -z ${PIWIK_ADMIN_MAIL+x} ]
then
PIWIK_ADMIN_MAIL="[email protected]"
PIWIK_SUBSCRIBE_NEWSLETTER=0
PIWIK_SUBSCRIBE_PRO_NEWSLETTER=0
fi
if [ -z ${PIWIK_ENABLE_TRUSTED_HOST_CHECK+x} ]
then
PIWIK_ENABLE_TRUSTED_HOST_CHECK=0
fi
if [ -z ${SITE_NAME+x} ]
then
SITE_NAME="My local Website"
fi
if [ -z ${SITE_URL+x} ]
then
SITE_URL="http://localhost"
fi
if [ -z ${SITE_TIMEZONE+x} ]
then
SITE_TIMEZONE="Europe/Berlin"
fi
if [ -z ${SITE_ECOMMERCE+x} ]
then
SITE_ECOMMERCE=0
fi
if [ -z ${ANONYMISE_IP+x} ]
then
ANONYMISE_IP=1
fi
if [ -z ${DO_NOT_TRACK+x} ]
then
DO_NOT_TRACK=1
fi
echo ">> piwik wizard: #1 open installer"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT \
-H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \
2> /dev/null | grep " % Done"
sleep 5
echo ">> piwik wizard: #2 open system check"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=systemCheck&trackerStatus=0" \
-H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://localhost/piwik/' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \
2> /dev/null | grep " % Done"
sleep 5
echo ">> piwik wizard: #3 open database settings"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=databaseSetup&trackerStatus=0&clientProtocol=https" \
-H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://localhost/piwik/index.php?action=systemCheck&trackerStatus=0' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \
2> /dev/null | grep " % Done"
sleep 5
echo ">> piwik wizard: #4 store database settings"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=databaseSetup&trackerStatus=0&clientProtocol=https" \
-H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Origin: https://localhost' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: https://localhost/piwik/index.php?action=databaseSetup&trackerStatus=0&clientProtocol=https' -H 'Connection: keep-alive' --compressed \
--data-urlencode host="$PIWIK_MYSQL_HOST:$PIWIK_MYSQL_PORT" \
--data-urlencode username="$PIWIK_MYSQL_USER" \
--data-urlencode password="$PIWIK_MYSQL_PASSWORD" \
--data-urlencode dbname="$PIWIK_MYSQL_DBNAME" \
--data-urlencode tables_prefix="$PIWIK_MYSQL_PREFIX" \
--data 'adapter=PDO%5CMYSQL&submit=Next+%C2%BB' \
2> /dev/null | grep " % Done"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=tablesCreation&trackerStatus=0&clientProtocol=https&module=Installation" \
-H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://localhost/piwik/index.php?action=databaseSetup&trackerStatus=0&clientProtocol=https' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' --compressed \
2> /dev/null | grep " % Done"
sleep 5
echo ">> piwik wizard: #5 open piwik settings"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=setupSuperUser&trackerStatus=0&clientProtocol=https&module=Installation" \
-H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://localhost/piwik/index.php?action=tablesCreation&trackerStatus=0&clientProtocol=https&module=Installation' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \
2> /dev/null | grep " % Done"
sleep 5
echo ">> piwik wizard: #6 store piwik settings"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=setupSuperUser&trackerStatus=0&clientProtocol=https&module=Installation" \
-H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Origin: https://localhost' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: https://localhost/piwik/index.php?action=setupSuperUser&trackerStatus=0&clientProtocol=https&module=Installation' -H 'Connection: keep-alive' --compressed \
--data-urlencode login="$PIWIK_ADMIN" \
--data-urlencode password="$PIWIK_ADMIN_PASSWORD" \
--data-urlencode password_bis="$PIWIK_ADMIN_PASSWORD" \
--data-urlencode email="$PIWIK_ADMIN_MAIL" \
--data-urlencode subscribe_newsletter_piwikorg="$PIWIK_SUBSCRIBE_NEWSLETTER" \
--data-urlencode subscribe_newsletter_piwikpro="$PIWIK_SUBSCRIBE_PRO_NEWSLETTER" \
--data 'submit=Next+%C2%BB' \
2> /dev/null | grep " % Done"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=firstWebsiteSetup&trackerStatus=0&clientProtocol=https&module=Installation" \
-H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://localhost/piwik/index.php?action=setupSuperUser&trackerStatus=0&clientProtocol=https&module=Installation' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' --compressed \
2> /dev/null | grep " % Done"
sleep 5
echo ">> piwik wizard: #7 store piwik site settings"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=firstWebsiteSetup&trackerStatus=0&clientProtocol=https&module=Installation" \
-H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Origin: https://localhost' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: https://localhost/piwik/index.php?action=firstWebsiteSetup&trackerStatus=0&clientProtocol=https&module=Installation' -H 'Connection: keep-alive' --compressed \
--data-urlencode siteName="$SITE_NAME" \
--data-urlencode url="$SITE_URL" \
--data-urlencode timezone="$SITE_TIMEZONE" \
--data-urlencode ecommerce="$SITE_ECOMMERCE" \
--data 'submit=Next+%C2%BB' \
2> /dev/null | grep " % Done"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=trackingCode&trackerStatus=0&clientProtocol=https&module=Installation&site_idSite=1&site_name=default" \
-H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://localhost/piwik/index.php?action=firstWebsiteSetup&trackerStatus=0&clientProtocol=https&module=Installation' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' --compressed \
2> /dev/null | grep " % Done"
sleep 5
echo ">> piwik wizard: #8 skip js page"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=finished&trackerStatus=0&clientProtocol=https&module=Installation&site_idSite=1&site_name=default" -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://localhost/piwik/index.php?action=trackingCode&trackerStatus=0&clientProtocol=https&module=Installation&site_idSite=1&site_name=justabot' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' --compressed \
2> /dev/null | grep " % Done"
sleep 5
echo ">> piwik wizard: #9 final settings"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php?action=finished&trackerStatus=0&clientProtocol=https&module=Installation&site_idSite=1&site_name=default" \
-H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Origin: https://localhost' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: https://localhost/piwik/index.php?action=finished&trackerStatus=0&clientProtocol=https&module=Installation&site_idSite=1&site_name=justabot' -H 'Connection: keep-alive' --compressed \
--data-urlencode do_not_track="$DO_NOT_TRACK" \
--data-urlencode anonymise_ip="$ANONYMISE_IP" \
--data 'submit=Continue+to+Piwik+%C2%BB' \
2> /dev/null | grep " % Done"
curl --insecure https://localhost$PIWIK_RELATIVE_URL_ROOT"index.php" \
-H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: https://localhost/piwik/index.php?action=finished&trackerStatus=0&clientProtocol=https&module=Installation&site_idSite=1&site_name=justabot' -H 'Cookie: pma_lang=en; pma_collation_connection=utf8_general_ci; pma_mcrypt_iv=n%2Bxpbn2a%2Btg%3D; pmaUser-1=L60fYDVIaz0%3D' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' --compressed \
2> /dev/null | grep " % Done"
sleep 5
eval "/piwik/console config:set 'General.enable_trusted_host_check=$PIWIK_ENABLE_TRUSTED_HOST_CHECK'"
fi
echo ">> update CorePlugins"
curl http://localhost$PIWIK_RELATIVE_URL_ROOT\index.php?updateCorePlugins=1 \
2> /dev/null | grep " % Done"
sleep 2
killall nginx
cat <<EOF
Add the following JS-Code to your Site -> don't forget to change the URLs ;)
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//!!!YOUR-URL!!!/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//!!!YOUR-URL!!!/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
EOF
if [ ! -z ${PIWIK_PLUGINS_ACTIVATE+x} ]
then
for plugin in ${PIWIK_PLUGINS_ACTIVATE}
do
/piwik/console plugin:activate $plugin
done
fi