From ecd02e3b8aa47fc1b31bea4f170775ec5b44b08d Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 05 Oct 2014 09:28:16 -0400 Subject: session: Bind mount a dir to the session dir --- (limited to 'lib/cmd') 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/${$}" } -- cgit v0.9.1