summaryrefslogtreecommitdiffstats
path: root/lib/cmd
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-10-05 09:28:16 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-10-05 09:28:16 (EDT)
commitecd02e3b8aa47fc1b31bea4f170775ec5b44b08d (patch)
tree527060257eddad3ace96e0ccd22875733526ecb2 /lib/cmd
parent896e4a4f99b5ce827af46938bbc5040d8ae931ac (diff)
session: Bind mount a dir to the session dir
Diffstat (limited to 'lib/cmd')
-rw-r--r--lib/cmd/shell.sh24
1 files changed, 5 insertions, 19 deletions
diff --git a/lib/cmd/shell.sh b/lib/cmd/shell.sh
index 9f5b6ba..c2570e0 100644
--- a/lib/cmd/shell.sh
+++ b/lib/cmd/shell.sh
@@ -24,7 +24,7 @@ use session
cmd_shell_main()
{
local root=
- local uname_s=
+ local session_dir=
if [ ${#} -lt 1 ]; then
print_cmd_usage 'shell' >&2
@@ -37,28 +37,14 @@ cmd_shell_main()
. "${root}/etc/os-release"
profile_set "${ID}"
- uname_s="$( (uname -s) 2>/dev/null)" || uname_s='unknown'
- mkdir -p "${root}/prokit/wd/${$}"
- case "${uname_s}" in
- 'Linux')
- mount -o bind . "${root}/prokit/wd/${$}"
- ;;
- esac
-
- session_begin "${root}" :
+ session_begin "${root}" . :
+ session_dir="/prokit/sessions/$(session_id)"
if [ ${#} -eq 0 ]; then
- chroot "${root}" /bin/sh -c "cd '/prokit/wd/${$}'; /bin/sh"
+ chroot "${root}" /bin/sh -c "cd '${session_dir}'; /bin/sh"
printf '\n'
info "$(get_msg 'cmd_shell_exiting')"
else
- chroot "${root}" /bin/sh -c "cd '/prokit/wd/${$}'; ${*}"
+ chroot "${root}" /bin/sh -c "cd '${session_dir}'; ${*}"
fi
session_end
-
- case "${uname_s}" in
- 'Linux')
- umount "${root}/prokit/wd/${$}"
- ;;
- esac
- rmdir "${root}/prokit/wd/${$}"
}