diff --git a/internal/config/mire.toml b/internal/config/mire.toml index e95a3e9..6276152 100644 --- a/internal/config/mire.toml +++ b/internal/config/mire.toml @@ -8,6 +8,6 @@ # read only paths from host, entry looks like "path on host:path on sanbox" # paths on host are absolute or relative to repo root mounts = [] - # read only host paths to expose on PATH inside the sandbox as /mire/bin/ + # read only host paths to expose on PATH inside the sandbox as /tmp/mire/bin/ # paths on host can be absolute or relative to repo root paths = [] diff --git a/internal/mire/record_shell.sh b/internal/mire/record_shell.sh index 376a284..c5f1d94 100644 --- a/internal/mire/record_shell.sh +++ b/internal/mire/record_shell.sh @@ -8,7 +8,7 @@ visible_home=${MIRE_HOME:?} bootstrap_rc="$host_home/.mire-shell-rc" visible_bootstrap_rc="$visible_home/.mire-shell-rc" setup_scripts_dir='/tmp/mire-setup-scripts' -visible_bin_dir='/mire/bin' +visible_bin_dir='/tmp/mire/bin' cat >"$bootstrap_rc" <<'EOF' cd "${HOME:?}" @@ -35,11 +35,10 @@ if [ "${MIRE_COMPARE_MARKER:-0}" = "1" ]; then fi EOF +# the first ro-bind allows for /usr/bin etc to be mounted and accessible set -- \ --ro-bind / / \ --tmpfs /home \ - --tmpfs /mire \ - --dir "$visible_bin_dir" \ --bind "$host_home" "$visible_home" \ --bind "$host_tmp" '/tmp' \ --dev /dev \ @@ -58,6 +57,8 @@ set -- \ --setenv TZ 'UTC' \ --chdir "$visible_home" +set -- "$@" --dir /tmp/mire --dir "$visible_bin_dir" + if [ -n "${MIRE_SETUP_SCRIPTS:-}" ]; then i=1 while IFS= read -r host_path || [ -n "$host_path" ]; do diff --git a/internal/mire/record_test.go b/internal/mire/record_test.go index 8b758b5..55c5c0f 100644 --- a/internal/mire/record_test.go +++ b/internal/mire/record_test.go @@ -122,7 +122,7 @@ func TestBuildRecordShellScriptUsesExpectedCommands(t *testing.T) { "visible_home=${MIRE_HOME:?}", "bootstrap_rc=\"$host_home/.mire-shell-rc\"", "setup_scripts_dir='/tmp/mire-setup-scripts'", - "visible_bin_dir='/mire/bin'", + "visible_bin_dir='/tmp/mire/bin'", "visible_bootstrap_rc=\"$visible_home/.mire-shell-rc\"", "for path in /tmp/mire-setup-scripts/*.sh; do", "source \"$path\"", @@ -145,8 +145,6 @@ func TestBuildRecordShellScriptUsesExpectedCommands(t *testing.T) { `if [ "${MIRE_COMPARE_MARKER:-0}" = "1" ]; then`, "printf '__MIRE_PROMPT_READY__\\n'", "PROMPT_COMMAND=__mire_prompt_ready", - "--tmpfs /mire", - "--dir \"$visible_bin_dir\"", "--bind \"$host_home\" \"$visible_home\"", "--bind \"$host_tmp\" '/tmp'", "--setenv HOME \"$visible_home\"", @@ -155,6 +153,8 @@ func TestBuildRecordShellScriptUsesExpectedCommands(t *testing.T) { "--setenv TERM 'xterm-256color'", "--setenv TZ 'UTC'", "--chdir \"$visible_home\"", + "--dir /tmp/mire", + "--dir \"$visible_bin_dir\"", "exec bwrap \"$@\" bash --noprofile --rcfile \"$visible_bootstrap_rc\" -i", } { if !strings.Contains(body, want) {