summaryrefslogtreecommitdiffstats
path: root/lib/cmd
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-05-24 01:56:13 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-05-24 02:00:59 (EDT)
commitee3f67f2b0e053b29a142dd6ee8e8cc8f020022d (patch)
tree4f8f08d4e7c5a04c1fcdc47d56ae1163f1d0335e /lib/cmd
parentbf77b190c769131a175a3b41c599a7f92d356519 (diff)
cmd/shell: Accept block device as root
Diffstat (limited to 'lib/cmd')
-rw-r--r--lib/cmd/shell.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/cmd/shell.sh b/lib/cmd/shell.sh
index dfff07f..b5b6d69 100644
--- a/lib/cmd/shell.sh
+++ b/lib/cmd/shell.sh
@@ -18,12 +18,14 @@
# along with the ProteanOS Development Kit. If not, see
# <http://www.gnu.org/licenses/>.
+use block
use profile
use session
cmd_shell_main()
{
local root=
+ local dev=
if [ ${#} -lt 1 ]; then
print_cmd_usage 'shell' >&2
@@ -33,6 +35,12 @@ cmd_shell_main()
root="${1}"
shift 1
+ dev=''
+ if is_block "${root}"; then
+ dev="${root}"
+ root="$(block_mount "${dev}")"
+ fi
+
. "${root}/etc/os-release"
profile_set "${ID}"
@@ -45,4 +53,8 @@ cmd_shell_main()
session_exec "${@}"
fi
session_end
+
+ if [ "x${dev}" != 'x' ]; then
+ block_umount "${root}"
+ fi
}