summaryrefslogtreecommitdiffstats
path: root/lib/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cmd')
-rw-r--r--lib/cmd/shell.sh13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/cmd/shell.sh b/lib/cmd/shell.sh
index 00589d2..2745f4b 100644
--- a/lib/cmd/shell.sh
+++ b/lib/cmd/shell.sh
@@ -25,19 +25,24 @@ cmd_shell_main()
{
local root=
- if [ ${#} -ne 1 ]; then
+ if [ ${#} -lt 1 ]; then
print_cmd_usage 'shell' >&2
exit 1
fi
root="${1}"
+ shift 1
. "${root}/etc/os-release"
profile_set "${ID}"
chroot_mount "${root}"
- chroot "${root}" /bin/sh
- printf '\n'
- info "$(get_msg 'cmd_shell_exiting')"
+ if [ ${#} -eq 0 ]; then
+ chroot "${root}" /bin/sh
+ printf '\n'
+ info "$(get_msg 'cmd_shell_exiting')"
+ else
+ chroot "${root}" /bin/sh -c "${*}"
+ fi
chroot_umount "${root}"
}