Files
IPTables-Management/tests/mocks/persist-mock.sh
ahdoawhfo 26fbcf3584 Mark runnable scripts executable in git
The repo was committed from WSL with core.filemode=false, so the exec
bit was never recorded. After actions/checkout the entry script comes
down as 100644 and tests/test_cli.sh fails with Permission denied.

Set mode 100755 on every script that is invoked directly (entry,
installer, test suite, mock binaries). Sourced helpers under lib/
keep 100644 per convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 13:58:42 +08:00

34 lines
778 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
: "${PERSIST_MOCK_LOG:=/tmp/persist-mock.log}"
: "${PERSIST_MOCK_FAIL:=0}"
: "${PERSIST_MOCK_DELAY_SECS:=0}"
: "${PERSIST_MOCK_ACTIVE_DIR:=}"
: "${PERSIST_MOCK_FAIL_ON_CONCURRENT:=0}"
printf '%s %s\n' "$(basename -- "$0")" "$*" >>"${PERSIST_MOCK_LOG}"
cleanup() {
[[ -n ${PERSIST_MOCK_ACTIVE_DIR} ]] || return 0
rmdir "${PERSIST_MOCK_ACTIVE_DIR}" 2>/dev/null || true
}
if [[ -n ${PERSIST_MOCK_ACTIVE_DIR} ]]; then
if ! mkdir "${PERSIST_MOCK_ACTIVE_DIR}" 2>/dev/null; then
if [[ ${PERSIST_MOCK_FAIL_ON_CONCURRENT} == 1 ]]; then
exit 1
fi
else
trap cleanup EXIT
fi
fi
if [[ ${PERSIST_MOCK_DELAY_SECS} != 0 ]]; then
sleep "${PERSIST_MOCK_DELAY_SECS}"
fi
if [[ ${PERSIST_MOCK_FAIL} == 1 ]]; then
exit 1
fi