mirror of
https://github.com/friendica/docker
synced 2024-11-05 22:51:52 +01:00
Merge pull request #121 from nupplaphil/bug/msmtp_cron
Use MSMTP settings in cron
This commit is contained in:
commit
87e5dc1cf0
|
@ -7,6 +7,7 @@ done
|
|||
|
||||
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||
if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then
|
||||
sh /setup_msmtp.sh
|
||||
exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start
|
||||
else
|
||||
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||
|
|
|
@ -16,44 +16,7 @@ version_greater() {
|
|||
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
setup_msmtp() {
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from $smtp_from@$SMTP_DOMAIN"
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_msmtp
|
||||
sh /setup_msmtp.sh
|
||||
|
||||
# just check if we execute apache or php-fpm
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
|
37
2020.07/apache/setup_msmtp.sh
Normal file
37
2020.07/apache/setup_msmtp.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from \"$smtp_from@$SMTP_DOMAIN\""
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user \"$SMTP_AUTH_USER\""; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password \"$SMTP_AUTH_PASS\""; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
|
@ -7,6 +7,7 @@ done
|
|||
|
||||
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||
if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then
|
||||
sh /setup_msmtp.sh
|
||||
exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start
|
||||
else
|
||||
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||
|
|
|
@ -16,44 +16,7 @@ version_greater() {
|
|||
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
setup_msmtp() {
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from $smtp_from@$SMTP_DOMAIN"
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_msmtp
|
||||
sh /setup_msmtp.sh
|
||||
|
||||
# just check if we execute apache or php-fpm
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
|
37
2020.07/fpm-alpine/setup_msmtp.sh
Normal file
37
2020.07/fpm-alpine/setup_msmtp.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from \"$smtp_from@$SMTP_DOMAIN\""
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user \"$SMTP_AUTH_USER\""; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password \"$SMTP_AUTH_PASS\""; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
|
@ -7,6 +7,7 @@ done
|
|||
|
||||
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||
if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then
|
||||
sh /setup_msmtp.sh
|
||||
exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start
|
||||
else
|
||||
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||
|
|
|
@ -16,44 +16,7 @@ version_greater() {
|
|||
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
setup_msmtp() {
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from $smtp_from@$SMTP_DOMAIN"
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_msmtp
|
||||
sh /setup_msmtp.sh
|
||||
|
||||
# just check if we execute apache or php-fpm
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
|
37
2020.07/fpm/setup_msmtp.sh
Normal file
37
2020.07/fpm/setup_msmtp.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from \"$smtp_from@$SMTP_DOMAIN\""
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user \"$SMTP_AUTH_USER\""; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password \"$SMTP_AUTH_PASS\""; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
|
@ -7,6 +7,7 @@ done
|
|||
|
||||
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||
if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then
|
||||
sh /setup_msmtp.sh
|
||||
exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start
|
||||
else
|
||||
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||
|
|
|
@ -16,44 +16,7 @@ version_greater() {
|
|||
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
setup_msmtp() {
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from $smtp_from@$SMTP_DOMAIN"
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_msmtp
|
||||
sh /setup_msmtp.sh
|
||||
|
||||
# just check if we execute apache or php-fpm
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
|
37
2020.09-dev/apache/setup_msmtp.sh
Normal file
37
2020.09-dev/apache/setup_msmtp.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from \"$smtp_from@$SMTP_DOMAIN\""
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user \"$SMTP_AUTH_USER\""; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password \"$SMTP_AUTH_PASS\""; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
|
@ -7,6 +7,7 @@ done
|
|||
|
||||
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||
if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then
|
||||
sh /setup_msmtp.sh
|
||||
exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start
|
||||
else
|
||||
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||
|
|
|
@ -16,44 +16,7 @@ version_greater() {
|
|||
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
setup_msmtp() {
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from $smtp_from@$SMTP_DOMAIN"
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_msmtp
|
||||
sh /setup_msmtp.sh
|
||||
|
||||
# just check if we execute apache or php-fpm
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
|
37
2020.09-dev/fpm-alpine/setup_msmtp.sh
Normal file
37
2020.09-dev/fpm-alpine/setup_msmtp.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from \"$smtp_from@$SMTP_DOMAIN\""
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user \"$SMTP_AUTH_USER\""; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password \"$SMTP_AUTH_PASS\""; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
|
@ -7,6 +7,7 @@ done
|
|||
|
||||
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||
if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then
|
||||
sh /setup_msmtp.sh
|
||||
exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start
|
||||
else
|
||||
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||
|
|
|
@ -16,44 +16,7 @@ version_greater() {
|
|||
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
setup_msmtp() {
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from $smtp_from@$SMTP_DOMAIN"
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_msmtp
|
||||
sh /setup_msmtp.sh
|
||||
|
||||
# just check if we execute apache or php-fpm
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
|
37
2020.09-dev/fpm/setup_msmtp.sh
Normal file
37
2020.09-dev/fpm/setup_msmtp.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from \"$smtp_from@$SMTP_DOMAIN\""
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user \"$SMTP_AUTH_USER\""; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password \"$SMTP_AUTH_PASS\""; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
|
@ -7,6 +7,7 @@ done
|
|||
|
||||
echo "Waiting for MySQL $MYSQL_HOST initialization..."
|
||||
if php /var/www/html/bin/wait-for-connection "$MYSQL_HOST" "${MYSQL_PORT:-3306}" 300; then
|
||||
sh /setup_msmtp.sh
|
||||
exec /sbin/tini -- php /var/www/html/bin/daemon.php -f start
|
||||
else
|
||||
echo "[ERROR] Waited 300 seconds, no response" >&2
|
||||
|
|
|
@ -16,44 +16,7 @@ version_greater() {
|
|||
[ "$(printf '%s\n' "$@" | sort -r -t '-' -k2,2 | sort -t '.' -n -k1,1 -k2,2 -s | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
setup_msmtp() {
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from $smtp_from@$SMTP_DOMAIN"
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user $SMTP_AUTH_USER"; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password $SMTP_AUTH_PASS"; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
||||
}
|
||||
|
||||
setup_msmtp
|
||||
sh /setup_msmtp.sh
|
||||
|
||||
# just check if we execute apache or php-fpm
|
||||
if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||
|
|
37
docker-setup_msmtp.sh
Normal file
37
docker-setup_msmtp.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ -n "${SMTP_DOMAIN+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||
SITENAME="${FRIENDICA_SITENAME:-Friendica Social Network}"
|
||||
echo "Setup MSMTP for '$SITENAME' with '$SMTP' ..."
|
||||
|
||||
smtp_from="${SMTP_FROM:=no-reply}"
|
||||
|
||||
# Setup MSMTP
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" root
|
||||
usermod --comment "$(echo "$SITENAME" | tr -dc '[:print:]')" www-data
|
||||
|
||||
# add possible mail-senders
|
||||
{
|
||||
echo "www-data: $smtp_from@$SMTP_DOMAIN"
|
||||
echo "root: $smtp_from@$SMTP_DOMAIN"
|
||||
} >/etc/aliases
|
||||
|
||||
# create msmtp settings
|
||||
{
|
||||
echo "account default"
|
||||
echo "host $SMTP"
|
||||
if [ -n "${SMTP_PORT+x}" ]; then echo "port $SMTP_PORT"; else echo "port 587"; fi
|
||||
echo "from \"$smtp_from@$SMTP_DOMAIN\""
|
||||
echo "tls_certcheck off" # No certcheck because of internal docker mail-hostnames
|
||||
if [ -n "${SMTP_TLS+x}" ]; then echo "tls on"; fi
|
||||
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "tls_starttls on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "auth on"; fi
|
||||
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "user \"$SMTP_AUTH_USER\""; fi
|
||||
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "password \"$SMTP_AUTH_PASS\""; fi
|
||||
echo "logfile /var/log/msmtp.log"
|
||||
echo "aliases /etc/aliases"
|
||||
} >/etc/msmtprc
|
||||
|
||||
echo "Setup finished"
|
||||
fi
|
Loading…
Reference in a new issue