From 5a6b8d63230e3d2f9a60c6d20f301c2b26baba5c Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Thu, 25 Jun 2020 18:16:01 +0100 Subject: [PATCH] dev_cli: Add a shell command And drop the caller into a privileged root shell. Signed-off-by: Samuel Ortiz --- scripts/dev_cli.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/scripts/dev_cli.sh b/scripts/dev_cli.sh index cceac17a2..14bb06b21 100755 --- a/scripts/dev_cli.sh +++ b/scripts/dev_cli.sh @@ -167,6 +167,9 @@ cmd_help() { echo " clean []]" echo " Remove the Cloud Hypervisor artifacts." echo "" + echo " shell" + echo " Run the development container into an interactive, privileged BASH shell." + echo "" echo " help" echo " Display this help message." echo "" @@ -351,6 +354,29 @@ cmd_build-container() { $BUILD_DIR } +cmd_shell() { + say_warn "Starting a privileged shell prompt as root ..." + say_warn "WARNING: Your $CLH_ROOT_DIR folder will be bind-mounted in the container under $CTR_CLH_ROOT_DIR" + $DOCKER_RUNTIME run \ + -ti \ + --workdir "$CTR_CLH_ROOT_DIR" \ + --rm \ + --privileged \ + --security-opt seccomp=unconfined \ + --ipc=host \ + --net=host \ + --tmpfs /tmp:exec \ + --volume /dev:/dev \ + --volume "$CLH_ROOT_DIR:$CTR_CLH_ROOT_DIR" \ + --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ + --env USER="root" \ + --env CH_LIBC="${libc}" \ + --entrypoint bash \ + "$CTR_IMAGE" + + fix_dir_perms $? +} + # Parse main command line args. # while [ $# -gt 0 ]; do