Files
mgmt/test/shell/augeas-1.sh
Karpfen 7e8ced534f misc: Use /usr/bin/env for a more generic shebang
Use path based SHELL in Makefiles. It was suggested that this is a
better solution for make for cases when there is no /usr/bin/env.

See: https://github.com/purpleidea/mgmt/pull/694#discussion_r1015596204
2025-03-22 14:53:21 -04:00

44 lines
912 B
Bash
Executable File

#!/usr/bin/env -S bash -e
exit 0 # XXX: disable for now
. "$(dirname "$0")/../util.sh"
mkdir -p "${MGMT_TMPDIR}"
echo > "${MGMT_TMPDIR}"sshd_config
$TIMEOUT "$MGMT" run --tmp-prefix yaml augeas-1.yaml &
pid=$!
# kill server on error
trap 'kill -SIGINT "$pid"' EXIT
sleep 30s # let it converge
# make an exception on macOS as augeas behaves differently
if [[ $(uname) == "Darwin" ]] ; then
value=false
else
#value=no
value=false # seems it's this on linux now too
fi
# make it easier to see why the test failed
set -x
cat "${MGMT_TMPDIR}"sshd_config
grep "X11Forwarding ${value}" "${MGMT_TMPDIR}"sshd_config
sed -i 's/'"${value}"'/yes/' "${MGMT_TMPDIR}"sshd_config
grep "X11Forwarding yes" "${MGMT_TMPDIR}"sshd_config
sleep 10s # augeas is slow
grep "X11Forwarding ${value}" "${MGMT_TMPDIR}"sshd_config
trap '' EXIT
killall -SIGINT mgmt # send ^C to exit mgmt
wait $pid # get exit status
exit $?