-
Notifications
You must be signed in to change notification settings - Fork 7
/
start
executable file
·53 lines (42 loc) · 1.61 KB
/
start
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
#!/bin/sh -e
envsubst < /etc/msmtprc.temp > /etc/msmtprc
cd /opt/bugzilla
# Substitute values into bugzilla localconfig
sed --in-place -f - localconfig <<SED
s/db_host *= *'[a-zA-Z0-9.]\+'/db_host = '${MYSQL_HOST}'/
s/db_port *= *[0-9.]\+/db_port = ${MYSQL_PORT}/
s/db_name *= *'[a-zA-Z0-9.]\+'/db_name = '${MYSQL_DATABASE}'/
s/db_user *= *'[a-zA-Z0-9.]\+'/db_user = '${MYSQL_USER}'/
s/db_pass\s*=\s*'[^']*'/db_pass = '${MYSQL_PASSWORD}'/
s/webservergroup *= *'[a-zA-Z0-9]\+'/webservergroup = 'www-data'/
SED
echo "Removing rederive_regex_groups() call"
sed -i '/_rederive_regex_groups();/d' /opt/*/Bugzilla/Install/DB.pm
mkdir -p /opt/bugzilla/data/assets
PARAMS=/opt/bugzilla/data/params.json
curl -f -o $PARAMS "${PARAMS_URL}"
if ! test -f $PARAMS
then
"${PARAMS_URL}" failed to download
exit 1
fi
jq -c . $PARAMS
chmod -R g+rwx /opt/bugzilla/data
chown -R :www-data /opt/bugzilla/data
./checksetup.pl bugzilla_admin
# Start apache2
. /etc/apache2/envvars
BZ_COMMIT=$(git --git-dir=/opt/bugzilla/.git describe --always)
echo BZ_COMMIT: $BZ_COMMIT
TEMPLATE=/opt/bugzilla/template/en/custom/index.html.tmpl
if ! grep -q "header_addl_info" $TEMPLATE
then
echo Template version replacement cannot be found, so cannot inject version into $TEMPLATE
exit 1
fi
sed -i "s/header_addl_info.*/header_addl_info = \"$BZ_COMMIT\"/g" $TEMPLATE
grep header_addl_info $TEMPLATE
# Tweak mod_perl performance to allow it 400MB of RAM
sed -i 's,Apache2::SizeLimit->set_max_unshared_size(45_000);,Apache2::SizeLimit->set_max_unshared_size(400_000);,' /opt/bugzilla/mod_perl.pl
/usr/sbin/apache2 -D FOREGROUND
#/bin/bash -c "while true; do sleep 1; done"