mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
28 lines
589 B
Bash
Executable File
28 lines
589 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
TEST_DIR=$(dirname "$0")
|
|
TESTS_ROOT="$(pwd)/${TEST_DIR}/test_root"
|
|
|
|
>&2 echo "Hint: Execute '${TEST_DIR}/testenv_exec.sh \$(pgrep -P $$) /bin/sh; reset' to enter the test namespace"
|
|
|
|
unshare=$(which unshare)
|
|
chroot=$(which chroot)
|
|
|
|
export PATH=/sbin:/bin
|
|
export PS1='\w \$ '
|
|
export PS2='> '
|
|
export PS3='#? '
|
|
export PS4='+ '
|
|
|
|
# Not supported by Busybox unshare:
|
|
# --cgroup --time
|
|
exec "$unshare" \
|
|
--user --map-root-user \
|
|
--fork --pid --mount-proc \
|
|
--mount \
|
|
--mount-proc \
|
|
--uts --ipc --net \
|
|
"$chroot" "$TESTS_ROOT" /bin/chrootsetup.sh "$@"
|