Fix warnings and weird stuff >_>

This commit is contained in:
Alexandre Aubin 2020-09-14 17:54:20 +02:00
parent ca5f264baf
commit 9156b1e56a

View file

@ -27,22 +27,21 @@ do_pre_regen() {
# Add possibility to specify a relay
# Could be useful with some isp with no 25 port open or more complex setup
export relay_host="$(yunohost settings get 'smtp.relay.host')"
if [ ! -z "${relay_host}" ]; then
if [ -n "${relay_host}" ]
then
export relay_port="$(yunohost settings get 'smtp.relay.port')"
export relay_user="$(yunohost settings get 'smtp.relay.user')"
relay_password="$(yunohost settings get 'smtp.relay.password')"
# Avoid to display "Relay account paswword" to other users
touch ${postfix_dir}/sasl_passwd
chmod o=--- ${postfix_dir}/sasl_passwd
chmod 750 ${postfix_dir}/sasl_passwd
# Avoid "postmap: warning: removing zero-length database file"
chown postfix ${pending_dir}/etc/postfix
chown postfix ${pending_dir}/etc/postfix/sasl_passwd
cat <<< "[${relay_host}]:${relay_port} ${relay_user}:${relay_password}" > ${postfix_dir}/sasl_passwd
postmap ${postfix_dir}/sasl_passwd
fi
export main_domain
export domain_list="$YNH_DOMAINS"
@ -67,8 +66,12 @@ do_pre_regen() {
do_post_regen() {
regen_conf_files=$1
chmod o=--- /etc/postfix/sasl_passwd*
chown postfix /etc/postfix/sasl_passwd*
if [ -e /etc/postfix/sasl_passwd ]
then
chmod 750 /etc/postfix/sasl_passwd*
chown postfix:root /etc/postfix/sasl_passwd*
fi
[[ -z "$regen_conf_files" ]] \
|| { service postfix restart && service postsrsd restart; }