diff options
Diffstat (limited to 'src/cmd/shell.sh')
-rw-r--r-- | src/cmd/shell.sh | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/cmd/shell.sh b/src/cmd/shell.sh index e761f55..8d5cd16 100644 --- a/src/cmd/shell.sh +++ b/src/cmd/shell.sh @@ -25,7 +25,7 @@ cmd_shell_main() if [ ${#} -lt 1 ]; then print_cmd_usage 'shell' >&2 - exit 1 + return 1 fi root="${1}" @@ -34,12 +34,20 @@ cmd_shell_main() dev='' if is_block "${root}"; then dev="${root}" - root="$(block_mount "${dev}")" + if ! root="$(block_mount "${dev}")"; then + return 2 + fi fi - profile_detect "${root}" + if ! profile_detect "${root}"; then + [ "x${dev}" != 'x' ] && block_umount "${root}" + return 2 + fi - session_begin "${root}" . : false + if ! session_begin "${root}" . : false; then + [ "x${dev}" != 'x' ] && block_umount "${root}" + return 2 + fi if [ ${#} -eq 0 ]; then session_exec /bin/sh printf '\n' @@ -50,6 +58,8 @@ cmd_shell_main() session_end [ "x${dev}" != 'x' ] && block_umount "${root}" + + return 0 } cmd_shell_register() |