[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] automation: introduce a new variable to control container user



Sometimes it is handy to create a container and play as root with its
setup manually.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 automation/scripts/containerize | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index bf9af589a8..ea3c7378aa 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -23,6 +23,12 @@ case "_${CONTAINER}" in
     _stretch|_) CONTAINER="${BASE}/debian:stretch" ;;
 esac
 
+# Use this variable to control whehter root should be used
+case "_${CONTAINER_ROOT}" in
+    _1)   userarg= ;;
+    _0|_) userarg="-u $(id -u)" ;;
+esac
+
 # Save the commands for future use
 cmd=$@
 
@@ -70,7 +76,7 @@ fi
 # Kick off Docker
 einfo "*** Launching container ..."
 exec docker run \
-    -u $(id -u) \
+    ${userarg} \
     ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
     -v "${CONTAINER_PATH}":/build:rw \
     -v "${HOME}/.ssh":/root/.ssh:ro \
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.