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

[Xen-changelog] [xen master] automation: introduce a new variable to control container user



commit 17fbe6504dfdff459bef35af7de80d1efeceb07b
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Tue Sep 25 15:19:31 2018 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Sep 26 09:50:17 2018 +0100

    automation: introduce a new variable to control container user
    
    Sometimes it is handy to create a container and play with its setup
    manually as root.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Doug Goldstein <cardoe@xxxxxxxxxx>
---
 automation/build/README.md      | 2 ++
 automation/scripts/containerize | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/automation/build/README.md b/automation/build/README.md
index bf113175f4..f6cfd46f1e 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -50,6 +50,8 @@ understands.
 - CONTAINER_ARGS: Allows you to pass extra arguments to Docker
   when starting the container.
 
+- CONTAINER_UID0: This specifies whether root is used inside the container.
+
 - XEN_CONFIG_EXPERT: If this is defined in your shell it will be
   automatically passed through to the container.
 
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index bf9af589a8..aa08274eba 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_UID0}" 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 \
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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