1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 13:06:01 +01:00

Make init.sh safe to run twice

(cherry picked from commit 5dbbf23332)
This commit is contained in:
John Ericson 2021-12-09 15:16:18 +00:00
parent 51b03401fb
commit 5e13c907b4

6
tests/init.sh Normal file → Executable file
View file

@ -1,8 +1,14 @@
set -eu -o pipefail
source common.sh
test -n "$TEST_ROOT"
if test -d "$TEST_ROOT"; then
chmod -R u+w "$TEST_ROOT"
# We would delete any daemon socket, so let's stop the daemon first.
if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
killDaemon
fi
rm -rf "$TEST_ROOT"
fi
mkdir "$TEST_ROOT"