|
4 | 4 | if [ "$1" = 'start' ]; then
|
5 | 5 |
|
6 | 6 | # config
|
7 |
| - sed -i "s/^.*'R_DB_HOST'.*$/define('R_DB_HOST', '${POSTGRES_HOST}');/g" \ |
8 |
| - ${ROOT_DIR}/server/php/config.inc.php |
9 |
| - sed -i "s/^.*'R_DB_PORT'.*$/define('R_DB_PORT', '5432');/g" \ |
10 |
| - ${ROOT_DIR}/server/php/config.inc.php |
11 |
| - sed -i "s/^.*'R_DB_USER'.*$/define('R_DB_USER', '${POSTGRES_USER}');/g" \ |
12 |
| - ${ROOT_DIR}/server/php/config.inc.php |
13 |
| - sed -i "s/^.*'R_DB_PASSWORD'.*$/define('R_DB_PASSWORD', '${POSTGRES_PASSWORD}');/g" \ |
14 |
| - ${ROOT_DIR}/server/php/config.inc.php |
15 |
| - sed -i "s/^.*'R_DB_NAME'.*$/define('R_DB_NAME', '${POSTGRES_DB}');/g" \ |
16 |
| - ${ROOT_DIR}/server/php/config.inc.php |
| 7 | + sed -i \ |
| 8 | + -e "s/^.*'R_DB_HOST'.*$/define('R_DB_HOST', '${POSTGRES_HOST}');/g" \ |
| 9 | + -e "s/^.*'R_DB_PORT'.*$/define('R_DB_PORT', '5432');/g" \ |
| 10 | + -e "s/^.*'R_DB_USER'.*$/define('R_DB_USER', '${POSTGRES_USER}');/g" \ |
| 11 | + -e "s/^.*'R_DB_PASSWORD'.*$/define('R_DB_PASSWORD', '${POSTGRES_PASSWORD}');/g" \ |
| 12 | + -e "s/^.*'R_DB_NAME'.*$/define('R_DB_NAME', '${POSTGRES_DB}');/g" \ |
| 13 | + ${ROOT_DIR}/server/php/config.inc.php |
| 14 | + echo $TZ > /etc/timezone |
| 15 | + rm /etc/localtime |
| 16 | + cp /usr/share/zoneinfo/$TZ /etc/localtime |
| 17 | + sed -i "s|;date.timezone = |date.timezone = ${TZ}|" /etc/php/7.0/fpm/php.ini |
17 | 18 |
|
18 | 19 | # postfix
|
19 | 20 | echo "[${SMTP_SERVER}]:${SMTP_PORT} ${SMTP_USERNAME}:${SMTP_PASSWORD}" > /etc/postfix/sasl_passwd
|
20 | 21 | postmap /etc/postfix/sasl_passwd
|
21 | 22 | echo "www-data@${SMTP_DOMAIN} ${SMTP_USERNAME}" > /etc/postfix/sender_canonical
|
22 | 23 | postmap /etc/postfix/sender_canonical
|
23 |
| - sed -i '/mydomain.*/d' /etc/postfix/main.cf |
24 |
| - sed -i '/myhostname.*/d' /etc/postfix/main.cf |
25 |
| - sed -i '/myorigin.*/d' /etc/postfix/main.cf |
26 |
| - sed -i '/mydestination.*/d' /etc/postfix/main.cf |
27 |
| - sed -i "$ a mydomain = ${SMTP_DOMAIN}" /etc/postfix/main.cf |
28 |
| - sed -i "$ a myhostname = localhost" /etc/postfix/main.cf |
29 |
| - sed -i '$ a myorigin = $mydomain' /etc/postfix/main.cf |
30 |
| - sed -i '$ a mydestination = localhost, $myhostname, localhost.$mydomain' /etc/postfix/main.cf |
31 |
| - sed -i '$ a sender_canonical_maps = hash:/etc/postfix/sender_canonical' /etc/postfix/main.cf |
32 |
| - sed -i "s/relayhost =.*$/relayhost = [${SMTP_SERVER}]:${SMTP_PORT}/" /etc/postfix/main.cf |
33 |
| - sed -i '/smtp_.*/d' /etc/postfix/main.cf |
34 |
| - sed -i '$ a smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache' /etc/postfix/main.cf |
35 |
| - sed -i '$ a smtp_sasl_auth_enable = yes' /etc/postfix/main.cf |
36 |
| - sed -i '$ a smtp_sasl_security_options = noanonymous' /etc/postfix/main.cf |
37 |
| - sed -i '$ a smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd' /etc/postfix/main.cf |
38 |
| - sed -i '$ a smtp_use_tls = yes' /etc/postfix/main.cf |
39 |
| - sed -i '$ a smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt' /etc/postfix/main.cf |
40 |
| - sed -i '$ a smtp_tls_wrappermode = yes' /etc/postfix/main.cf |
41 |
| - sed -i '$ a smtp_tls_security_level = encrypt' /etc/postfix/main.cf |
| 24 | + sed -i \ |
| 25 | + -e '/mydomain.*/d' \ |
| 26 | + -e '/myhostname.*/d' \ |
| 27 | + -e '/myorigin.*/d' \ |
| 28 | + -e '/mydestination.*/d' \ |
| 29 | + -e "$ a mydomain = ${SMTP_DOMAIN}" \ |
| 30 | + -e "$ a myhostname = localhost" \ |
| 31 | + -e '$ a myorigin = $mydomain' \ |
| 32 | + -e '$ a mydestination = localhost, $myhostname, localhost.$mydomain' \ |
| 33 | + -e '$ a sender_canonical_maps = hash:/etc/postfix/sender_canonical' \ |
| 34 | + -e "s/#relayhost =.*$/relayhost = [${SMTP_SERVER}]:${SMTP_PORT}/" \ |
| 35 | + -e '/smtp_.*/d' \ |
| 36 | + -e '$ a smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache' \ |
| 37 | + -e '$ a smtp_sasl_auth_enable = yes' \ |
| 38 | + -e '$ a smtp_sasl_security_options = noanonymous' \ |
| 39 | + -e '$ a smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd' \ |
| 40 | + -e '$ a smtp_use_tls = yes' \ |
| 41 | + -e '$ a smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt' \ |
| 42 | + -e '$ a smtp_tls_wrappermode = yes' \ |
| 43 | + -e '$ a smtp_tls_security_level = encrypt' \ |
| 44 | + /etc/postfix/main.cf |
42 | 45 |
|
43 | 46 | # init db
|
44 | 47 | export PGHOST=${POSTGRES_HOST}
|
|
0 commit comments