2020-05-27 16:34:06 +00:00
|
|
|
#!/bin/sh -e
|
2020-09-28 15:30:53 +00:00
|
|
|
#
|
|
|
|
# 2020 Dennis Camera (dennis.camera@ssrq-sds-fds.ch)
|
|
|
|
#
|
|
|
|
# This file is part of cdist.
|
|
|
|
#
|
|
|
|
# cdist is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# cdist is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
2020-05-27 16:34:06 +00:00
|
|
|
|
2020-09-28 15:37:41 +00:00
|
|
|
os=$(cat "${__global:?}/explorer/os")
|
2020-06-01 18:26:52 +00:00
|
|
|
|
2020-06-01 15:07:35 +00:00
|
|
|
# Install DMA
|
2021-01-11 11:16:09 +00:00
|
|
|
case ${os}
|
2020-06-01 15:07:35 +00:00
|
|
|
in
|
2020-06-22 12:02:13 +00:00
|
|
|
(alpine)
|
|
|
|
__package dma --state present
|
|
|
|
export require='__package/dma'
|
|
|
|
;;
|
2020-06-01 15:07:35 +00:00
|
|
|
(debian|devuan|ubuntu)
|
|
|
|
__package dma --state present
|
|
|
|
export require='__package/dma'
|
2020-05-27 16:34:06 +00:00
|
|
|
;;
|
2020-06-01 15:07:35 +00:00
|
|
|
(freebsd)
|
|
|
|
# Stop sendmail if necessary
|
|
|
|
__process 'sendmail' --name 'sendmail.*' --state absent \
|
|
|
|
--stop '/etc/rc.d/sendmail onestop'
|
|
|
|
|
|
|
|
# ... and disable it
|
|
|
|
__key_value 'rcconf-sendmail-enable' --file '/etc/rc.conf' \
|
|
|
|
--key 'sendmail_enable' --delimiter '=' --value '"NONE"' \
|
|
|
|
--exact_delimiter
|
2020-05-27 16:34:06 +00:00
|
|
|
|
|
|
|
# Setup mailwrapper accordingly
|
2020-06-01 15:07:35 +00:00
|
|
|
__file '/etc/mail/mailer.conf' --mode 0644 --source - <<-'EOF'
|
2020-06-01 17:24:32 +00:00
|
|
|
#
|
|
|
|
# Execute the "real" sendmail program, named /usr/libexec/sendmail/sendmail
|
|
|
|
#
|
2020-06-01 15:07:35 +00:00
|
|
|
sendmail /usr/libexec/dma
|
|
|
|
send-mail /usr/libexec/dma
|
|
|
|
mailq /usr/libexec/dma
|
|
|
|
newaliases /usr/libexec/dma
|
|
|
|
rmail /usr/libexec/dma
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
(*)
|
|
|
|
cat <<EOF >&2
|
2020-05-27 16:34:06 +00:00
|
|
|
Your OS (${os}) is not supported yet.
|
|
|
|
|
|
|
|
Maybe adding support is as simple as adapting the packages or allowing it,
|
|
|
|
we highly encourage you to open a PR with the necessary changes.
|
|
|
|
See: https://code.ungleich.ch/ungleich-public/cdist-contrib/
|
|
|
|
EOF
|
|
|
|
exit 1
|
2020-06-01 15:07:35 +00:00
|
|
|
;;
|
2020-05-27 16:34:06 +00:00
|
|
|
esac
|