summaryrefslogtreecommitdiffstats
path: root/lib/cmd/shell.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cmd/shell.sh')
-rw-r--r--lib/cmd/shell.sh26
1 files changed, 5 insertions, 21 deletions
diff --git a/lib/cmd/shell.sh b/lib/cmd/shell.sh
index 5c85d7e..dfff07f 100644
--- a/lib/cmd/shell.sh
+++ b/lib/cmd/shell.sh
@@ -19,12 +19,11 @@
# <http://www.gnu.org/licenses/>.
use profile
-use chroot
+use session
cmd_shell_main()
{
local root=
- local uname_s=
if [ ${#} -lt 1 ]; then
print_cmd_usage 'shell' >&2
@@ -37,28 +36,13 @@ 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
-
- chroot_mount "${root}"
+ session_begin "${root}" . : false
if [ ${#} -eq 0 ]; then
- chroot "${root}" /bin/sh -c "cd '/prokit/wd/${$}'; /bin/sh"
+ session_exec /bin/sh
printf '\n'
info "$(get_msg 'cmd_shell_exiting')"
else
- chroot "${root}" /bin/sh -c "cd '/prokit/wd/${$}'; ${*}"
+ session_exec "${@}"
fi
- chroot_umount "${root}"
-
- case "${uname_s}" in
- 'Linux')
- umount "${root}/prokit/wd/${$}"
- ;;
- esac
- rmdir "${root}/prokit/wd/${$}"
+ session_end
}