Latest
This commit is contained in:
parent
1dfd4ad9b1
commit
d654073009
1 changed files with 13 additions and 8 deletions
|
@ -73,8 +73,6 @@ if command -v postfix > /dev/null; then
|
||||||
logg warn 'Unable to identify root user home directory'
|
logg warn 'Unable to identify root user home directory'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Forward user e-mails
|
|
||||||
|
|
||||||
### Ensure /etc/postfix/header_checks exists
|
### Ensure /etc/postfix/header_checks exists
|
||||||
if [ ! -d /etc/postfix/header_checks ]; then
|
if [ ! -d /etc/postfix/header_checks ]; then
|
||||||
logg info 'Creating /etc/postfix/header_checks since it does not exist'
|
logg info 'Creating /etc/postfix/header_checks since it does not exist'
|
||||||
|
@ -90,25 +88,32 @@ if command -v postfix > /dev/null; then
|
||||||
### Update aliases
|
### Update aliases
|
||||||
if [ -f /etc/aliases ]; then
|
if [ -f /etc/aliases ]; then
|
||||||
logg info 'Forward root e-mails to {{ .user.email }}'
|
logg info 'Forward root e-mails to {{ .user.email }}'
|
||||||
sudo sed s/#root.*/root:\ {{ .user.email }}/ -i /etc/aliases && sudo newaliases
|
sudo sed s/#root.*/root:\ {{ .user.email }}/ -i /etc/aliases
|
||||||
if ! cat /etc/aliases | grep '{{ .user.username }}: root' > /dev/null; then
|
if ! cat /etc/aliases | grep '{{ .user.username }}: root' > /dev/null; then
|
||||||
logg info 'Forward user e-mail to root@localhost'
|
logg info 'Forward user e-mail to root@localhost'
|
||||||
echo '{{ .user.username }}: root' | sudo tee -a /etc/aliases > /dev/null
|
echo '{{ .user.username }}: root' | sudo tee -a /etc/aliases > /dev/null
|
||||||
fi
|
fi
|
||||||
|
logg info 'Running `newaliases` to regenerate the alias database'
|
||||||
|
sudo newaliases
|
||||||
|
else
|
||||||
|
logg warn '/etc/aliases does not appear to exist'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /Applications ] && [ -d /System ]; then
|
if [ -d /Applications ] && [ -d /System ]; then
|
||||||
### macOS
|
### macOS
|
||||||
# Source: https://budiirawan.com/install-mail-server-mac-osx/
|
# Source: https://budiirawan.com/install-mail-server-mac-osx/
|
||||||
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/postfix/com.apple.postfix.master.plist" ]; then
|
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/postfix/com.apple.postfix.master.plist" ] && ! sudo launchctl list | grep 'postfix.master' > /dev/null; then
|
||||||
logg info 'Copying com.apple.postfix.master.plist'
|
logg info 'Copying com.apple.postfix.master.plist'
|
||||||
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/postfix/com.apple.postfix.master.plist" /System/Library/LaunchDaemons/com.apple.postfix.master.plist
|
sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/postfix/com.apple.postfix.master.plist" /System/Library/LaunchDaemons/com.apple.postfix.master.plist
|
||||||
sudo launchctl load /System/Library/LaunchDaemons/com.apple.postfix.master.plist && logg success 'launchctl load of com.apple.postfix.master successful'
|
sudo launchctl load /System/Library/LaunchDaemons/com.apple.postfix.master.plist && logg success 'launchctl load of com.apple.postfix.master successful'
|
||||||
fi
|
fi
|
||||||
logg info 'Starting postfix'
|
if ! sudo postfix status > /dev/null; then
|
||||||
sudo postfix start
|
logg info 'Starting postfix'
|
||||||
logg info 'Reloading postfix'
|
sudo postfix start
|
||||||
sudo postfix reload
|
else
|
||||||
|
logg info 'Reloading postfix'
|
||||||
|
sudo postfix reload
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
### Enable / restart postfix on Linux
|
### Enable / restart postfix on Linux
|
||||||
logg info 'Enabling / restarting postfix'
|
logg info 'Enabling / restarting postfix'
|
||||||
|
|
Loading…
Reference in a new issue