forked from Enalean/docker-tuleap-aio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot-install.sh
executable file
·89 lines (74 loc) · 2.57 KB
/
boot-install.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
#!/bin/bash
set -e
function generate_passwd {
cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w 15 | head -1
}
mkdir -p /data/etc/httpd/
mkdir -p /data/etc/ssh/
mkdir -p /data/home
mkdir -p /data/lib
mkdir -p /data/etc/logrotate.d
mkdir -p /data/root && chmod 700 /data/root
pushd . > /dev/null
cd /var/lib
mv /var/lib/mysql /data/lib && ln -s /data/lib/mysql mysql
[ -d /var/lib/gitolite ] && mv /var/lib/gitolite /data/lib && ln -s /data/lib/gitolite gitolite
popd > /dev/null
# Apply tuleap patches (should be temporary until integrated upstream)
pushd . > /dev/null
cd /usr/share/tuleap
/bin/ls /root/app/patches/*.patch | while read patch; do
patch -p1 -i $patch
done
popd > /dev/null
# Install Tuleap
# if DB_HOST is defined (non zero)
if [ -n "$DB_HOST" ]
then
bash ./setup.sh --disable-selinux --sys-default-domain=$VIRTUAL_HOST \
--sys-org-name=Tuleap --sys-long-org-name=Tuleap \
--mysql-host=$DB_HOST --mysql-root-password=$DB_PASS --mysql-httpd-host='%'
cp /etc/supervisord-nodb.conf /etc/supervisord.conf
else
bash ./setup.sh --disable-selinux --sys-default-domain=$VIRTUAL_HOST \
--sys-org-name=Tuleap --sys-long-org-name=Tuleap
fi
# Setting root password
root_passwd=$(generate_passwd)
echo "root:$root_passwd" |chpasswd
echo "root: $root_passwd" >> /root/.tuleap_passwd
# Place for post install stuff
./boot-postinstall.sh
# Create fake file to avoid error below when moving
touch /etc/aliases.codendi
# Ensure system will be synchronized ASAP
/usr/share/tuleap/src/utils/php-launcher.sh /usr/share/tuleap/src/utils/launch_system_check.php
service mysqld stop
service httpd stop
service crond stop
### Move all generated files to persistant storage ###
# Conf
mv /etc/httpd/conf /data/etc/httpd
mv /etc/httpd/conf.d /data/etc/httpd
mv /etc/tuleap /data/etc
mv /etc/aliases /data/etc
mv /etc/aliases.codendi /data/etc
mv /etc/logrotate.d/httpd /data/etc/logrotate.d
mv /etc/libnss-mysql.cfg /data/etc
mv /etc/libnss-mysql-root.cfg /data/etc
mv /etc/my.cnf /data/etc
mv /etc/nsswitch.conf /data/etc
mv /etc/crontab /data/etc
mv /etc/passwd /data/etc
mv /etc/shadow /data/etc
mv /etc/group /data/etc
mv /root/.tuleap_passwd /data/root
mv /etc/ssh/ssh_host_* /data/etc/ssh
# Data
mv /home/codendiadm /data/home
mv /home/groups /data/home
mv /home/users /data/home
mv /var/lib/tuleap /data/lib
# Will be restored by boot-fixpath.sh later
[ -h /var/lib/mysql ] && rm /var/lib/mysql
[ -h /var/lib/gitolite ] && rm /var/lib/gitolite