apply final feedback

This commit is contained in:
georglauterbach 2024-01-24 16:40:42 +01:00
parent c6f89a3ca6
commit 4b8f36bf98
No known key found for this signature in database
GPG Key ID: F367F7C43C118578
1 changed files with 18 additions and 13 deletions

View File

@ -1,6 +1,7 @@
#!/bin/bash
# -eE :: exit on error (do this in functions as well)
# -e :: exit on error (do this in functions as well)
# -E :: inherit the ERR trap to functions, command substitutions and sub-shells
# -u :: show (and exit) when using unset variables
# -o pipefail :: exit on error in pipes
set -eE -u -o pipefail
@ -34,16 +35,6 @@ function _pre_installation_steps() {
apt-get "${QUIET}" install --no-install-recommends "${EARLY_PACKAGES[@]}" 2>/dev/null
}
function _add_ppas() {
_log 'debug' 'Adding PPAs'
_log 'trace' 'Adding Rspamd PPA'
curl -sSfL https://rspamd.com/apt-stable/gpg.key | gpg --dearmor >/etc/apt/trusted.gpg.d/rspamd.gpg
echo "deb [signed-by=/etc/apt/trusted.gpg.d/rspamd.gpg] http://rspamd.com/apt-stable/ ${VERSION_CODENAME} main" >/etc/apt/sources.list.d/rspamd.list
_log 'trace' 'Updating package index after adding PPAs'
apt-get "${QUIET}" update
}
function _install_utils() {
_log 'debug' 'Installing utils sourced from Github'
_log 'trace' 'Installing jaq'
@ -83,8 +74,6 @@ function _install_packages() {
# the following packages are all for Fail2Ban
# https://github.com/docker-mailserver/docker-mailserver/pull/3403#discussion_r1306581431
fail2ban python3-pyinotify python3-dnspython
# redis-server belongs to rspamd
rspamd redis-server
)
# predominantly for Amavis support
@ -173,6 +162,21 @@ function _install_dovecot() {
apt-get "${QUIET}" --no-install-recommends install libxapian30
}
function _install_rspamd() {
_log 'debug' 'Installing Rspamd'
_log 'trace' 'Adding Rspamd PPA'
curl -sSfL https://rspamd.com/apt-stable/gpg.key | gpg --dearmor >/etc/apt/trusted.gpg.d/rspamd.gpg
echo \
"deb [signed-by=/etc/apt/trusted.gpg.d/rspamd.gpg] http://rspamd.com/apt-stable/ ${VERSION_CODENAME} main" \
>/etc/apt/sources.list.d/rspamd.list
_log 'trace' 'Updating package index after adding PPAs'
apt-get "${QUIET}" update
_log 'trace' 'Installing actual package'
apt-get "${QUIET}" install rspamd redis-server
}
function _post_installation_steps() {
_log 'debug' 'Running post-installation steps (cleanup)'
_log 'debug' 'Deleting sensitive files (secrets)'
@ -196,4 +200,5 @@ _install_utils
_install_postfix
_install_packages
_install_dovecot
_install_rspamd
_post_installation_steps