|
@@ -1,25 +1,30 @@
|
1
|
|
-#!/bin/bash
|
|
1
|
+#! /usr/bin/env bash
|
|
2
|
+
|
|
3
|
+replace_var()
|
|
4
|
+{
|
|
5
|
+ file="${1}"
|
|
6
|
+ var="${2}"
|
|
7
|
+ sed -e "s?${var}?${!var}?g" -i "${file}"
|
|
8
|
+}
|
|
9
|
+
|
2
|
10
|
replace_vars()
|
3
|
11
|
{
|
4
|
12
|
file="${1}"
|
5
|
|
- sed -e "s/POSTGRES_HOST/${POSTGRES_HOST}/" -i "${file}"
|
6
|
|
- sed -e "s/POSTGRES_USER/${POSTGRES_USER}/" -i "${file}"
|
7
|
|
- sed -e "s/POSTGRES_PASSWORD/${POSTGRES_PASSWORD}/" -i "${file}"
|
8
|
|
- sed -e "s/POSTGRES_DB/${POSTGRES_DB}/" -i "${file}"
|
9
|
|
- sed -e "s/MAIL_USER_DB_HOST/${MAIL_USER_DB_HOST}/" -i "${file}"
|
10
|
|
- sed -e "s/MAIL_USER_DB_USER/${MAIL_USER_DB_USER}/" -i "${file}"
|
11
|
|
- sed -e "s/MAIL_USER_DB_PASSWORD/${MAIL_USER_DB_PASSWORD}/" -i "${file}"
|
12
|
|
- sed -e "s/MAIL_USER_DB_DB/${MAIL_USER_DB_DB}/" -i "${file}"
|
13
|
|
- sed -e "s/MAIL_USER_DB_PORT/${MAIL_USER_DB_PORT}/" -i "${file}"
|
14
|
|
- sed -e "s!IMAP_HOST!${IMAP_HOST}!" -i "${file}"
|
15
|
|
- sed -e "s!SMTP_HOST!${SMTP_HOST}!" -i "${file}"
|
16
|
|
- sed -e "s/SIEVE_HOST/${SIEVE_HOST}/" -i "${file}"
|
17
|
|
- sed -e "s/DES_KEY/${DES_KEY}/" -i "${file}"
|
|
13
|
+ for var in $(cat /etc/vars-vars)
|
|
14
|
+ do
|
|
15
|
+ replace_var "${file}" "${var}"
|
|
16
|
+ done
|
|
17
|
+}
|
|
18
|
+
|
|
19
|
+replace_files()
|
|
20
|
+{
|
|
21
|
+ for file in $(cat /etc/vars-files)
|
|
22
|
+ do
|
|
23
|
+ replace_vars "${file}"
|
|
24
|
+ done
|
18
|
25
|
}
|
19
|
26
|
|
20
|
|
-replace_vars /var/www/html/config/config.inc.php
|
21
|
|
-replace_vars /var/www/html/plugins/password/config.inc.php
|
22
|
|
-replace_vars /var/www/html/plugins/vacation_sieve/config.inc.php
|
|
27
|
+replace_files
|
23
|
28
|
|
24
|
29
|
rm -f /run/apache2/apache2.pid
|
25
|
30
|
exec /usr/sbin/apache2ctl -D FOREGROUND
|