Apply suggestions from code review

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
Brennan Kinney 2023-09-05 22:44:21 +12:00 committed by polarathene
parent 24d3ba368c
commit b007533380
2 changed files with 4 additions and 6 deletions

View File

@ -99,10 +99,8 @@ function _install_feature_config_templates() {
apt-get "${QUIET}" --no-install-recommends install gettext-base
# zenv:
local URL_ZENV
URL_ZENV="https://github.com/numToStr/zenv/releases/download/0.8.0/zenv-0.8.0-$(uname --machine)-unknown-linux-gnu.tar.gz"
# Download from GH releases to stdout, then extract the zenv file to make available via PATH:
curl -L "${URL_ZENV}" -o - | tar --gzip --extract --directory /usr/local/bin --file - zenv
curl -L "https://github.com/numToStr/zenv/releases/download/0.8.0/zenv-0.8.0-$(uname --machine)-unknown-linux-gnu.tar.gz" -o - | tar --gzip --extract --directory /usr/local/bin --file - zenv
}
function _install_dovecot() {

View File

@ -45,7 +45,7 @@ function _create_config_dovecot() {
}
function _create_config_postfix() {
local QUERY_KIND=${1}
local QUERY_KIND=${1:?QUERY_KIND is required in _create_config_postfix}
local LDAP_CONFIG_FILE="/etc/postfix/ldap/${QUERY_KIND}.cf"
_cleanse_config '=' <(cat 2>/dev/null \
@ -56,9 +56,9 @@ function _create_config_postfix() {
) > "${LDAP_CONFIG_FILE}"
# Opt-out of generated config if `query_filter` was not configured:
if ! grep --silent '^query_filter =' "${LDAP_CONFIG_FILE}"; then
if ! grep -q '^query_filter =' "${LDAP_CONFIG_FILE}"; then
_log 'warn' "'${LDAP_CONFIG_FILE}' is missing the 'query_filter' setting - disabling"
sed -i "s/$(_escape_for_sed <<< "${LDAP_CONFIG_FILE}")//" /etc/postfix/main.cf
sed -i "s/$(_escape_for_sed "${LDAP_CONFIG_FILE}")//" /etc/postfix/main.cf
fi
}