From b007533380d27f52bef9ff9cb2d60fc7a805ac2d Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Tue, 5 Sep 2023 22:44:21 +1200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> --- target/scripts/build/packages.sh | 4 +--- target/scripts/startup/setup.d/ldap.sh | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/target/scripts/build/packages.sh b/target/scripts/build/packages.sh index f6f9c638..2c3ab403 100644 --- a/target/scripts/build/packages.sh +++ b/target/scripts/build/packages.sh @@ -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() { diff --git a/target/scripts/startup/setup.d/ldap.sh b/target/scripts/startup/setup.d/ldap.sh index eb2fdf3b..438bc6ac 100644 --- a/target/scripts/startup/setup.d/ldap.sh +++ b/target/scripts/startup/setup.d/ldap.sh @@ -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 }