Merge pull request #2466 from docker-mailserver/revert-macos-logic

Remove macOS specific code / support + shellcheck should avoid python, regardless of permissions
This commit is contained in:
Nathan Pierce 2022-03-09 07:11:15 -05:00 committed by GitHub
commit 67533d7029
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 35 deletions

View file

@ -5,13 +5,9 @@ title: 'Contributing | Tests'
1. Install docker
2. Execute `git submodule update --init --recursive`
3. Install jq
!!! info "MacOS Specific (needed for tests)"
```bash
brew install coreutils
# bash >= 4.0 for associative arrays
brew install bash
```
4. Execute `make clean all`
!!! info "Can I use MacOS?"
We do not support running linting, tests, etc on macOS at this time. Please use a linux VM.

View file

@ -88,14 +88,6 @@ function _show_local_usage
function _get_absolute_script_directory
{
if [[ "$(uname)" == 'Darwin' ]]
then
readlink() {
# requires coreutils
greadlink "${@:+$@}"
}
fi
if dirname "$(readlink -f "${0}")" &>/dev/null
then
DIR="$(dirname "$(readlink -f "${0}")")"
@ -154,7 +146,7 @@ function _run_in_new_container
${CRI} run --rm "${USE_TTY}" \
-v "${CONFIG_PATH}:${DMS_CONFIG}${USE_SELINUX}" \
"${IMAGE_NAME}" "${@:+$@}"
"${IMAGE_NAME}" "${@}"
}
function _main
@ -234,9 +226,9 @@ function _main
if [[ -n ${CONTAINER_NAME} ]]
then
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" setup "${@:+$@}"
${CRI} exec "${USE_TTY}" "${CONTAINER_NAME}" setup "${@}"
else
_run_in_new_container setup "${@:+$@}"
_run_in_new_container setup "${@}"
fi
[[ ${1} == 'help' ]] && _show_local_usage
@ -244,4 +236,4 @@ function _main
return 0
}
_main "${@:+$@}"
_main "${@}"

0
target/bin/print-environment Normal file → Executable file
View file

0
target/bin/setup Normal file → Executable file
View file

View file

@ -418,8 +418,8 @@ function _extract_certs_from_acme
fi
local KEY CERT
KEY=$(acme_extract /etc/letsencrypt/acme.json "${CERT_DOMAIN}" --key)
CERT=$(acme_extract /etc/letsencrypt/acme.json "${CERT_DOMAIN}" --cert)
KEY=$(acme_extract.py /etc/letsencrypt/acme.json "${CERT_DOMAIN}" --key)
CERT=$(acme_extract.py /etc/letsencrypt/acme.json "${CERT_DOMAIN}" --cert)
if [[ -z ${KEY} ]] || [[ -z ${CERT} ]]
then

View file

@ -1,4 +1,4 @@
#! /usr/bin/env bash
#! /bin/bash
# version v0.2.0 unstable
# executed by Make during CI or manually
@ -6,12 +6,6 @@
SCRIPT="lint.sh"
if [[ "$(uname)" == "Darwin" ]]
then
readlink() {
greadlink "${@:+$@}" # Requires coreutils
}
fi
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
REPO_ROOT="$(realpath "${SCRIPT_DIR}"/../../)"
@ -58,7 +52,7 @@ function __log_success
function __in_path
{
command -v "${@:+$@}" &>/dev/null && return 0 ; return 1 ;
command -v "${@}" &>/dev/null && return 0 ; return 1 ;
}
function _eclint
@ -104,10 +98,8 @@ function _shellcheck
-not -path './test/test_helper/*' \
-not -path './target/docker-configomat/*'
)"
# macOS lacks parity for `-executable` but presently produces the same results: https://stackoverflow.com/a/4458361
[[ "$(uname)" == "Darwin" ]] && FIND_EXEC="-perm -711" || FIND_EXEC="-executable"
# shellcheck disable=SC2248
F_BIN="$(find 'target/bin' ${FIND_EXEC} -type f)"
F_BIN="$(find 'target/bin' -type f -not -name '*.py')"
F_BATS="$(find 'test' -maxdepth 1 -type f -iname '*.bats')"
# This command is a bit easier to grok as multi-line.
@ -164,4 +156,4 @@ function __main
esac
}
__main "${@:+$@}" || exit ${?}
__main "${@}" || exit ${?}