[X2Go-Commits] [buildscripts] 01/01: bin/slave-start-{prepare, chroot}.sh: disable su hack and actually do the work manually via newgrp.

git-admin at x2go.org git-admin at x2go.org
Sat Nov 25 08:34:58 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository buildscripts.

commit 5e98afecf51b88f66b340c27c3f01a350f8303e4
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Nov 25 08:34:46 2017 +0100

    bin/slave-start-{prepare,chroot}.sh: disable su hack and actually do the work manually via newgrp.
    
    Using su doesn't really work, since it needs a TTY. Spawning a TTY will
    make Jenkins print out data directly, but we *need* to wait until the
    jenkins slave command is launched for this to happen.
---
 bin/slave-start-chroot.sh  |  2 +-
 bin/slave-start-prepare.sh | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/bin/slave-start-chroot.sh b/bin/slave-start-chroot.sh
index 3c1209f..ebf2c59 100755
--- a/bin/slave-start-chroot.sh
+++ b/bin/slave-start-chroot.sh
@@ -22,4 +22,4 @@ fi
 
 "${HOME}/bin/slave-sync.sh"
 
-schroot -c "${chroot}" -- python -c "import pty; pty.spawn(['/bin/su', '-', '${USER}', '-c', 'bin/${prefix}-slave-start-prepare.sh'])"
+schroot -c "${chroot}" -- "bin/${prefix}-slave-start-prepare.sh"
diff --git a/bin/slave-start-prepare.sh b/bin/slave-start-prepare.sh
index 94d1ef0..8e6fae8 100755
--- a/bin/slave-start-prepare.sh
+++ b/bin/slave-start-prepare.sh
@@ -4,6 +4,25 @@ set -e
 
 typeset prefix="$(cut -d"-" -f1 <<< "$(basename "${0}")")"
 
+# Apply groups defined for the user within the chroot system.
+# We cannot use su, because that requires a TTY and spawning such
+# a TTY (even if it's just a PTY) will make Jenkins output stuff
+# directly - that data will never make it to the jenkins slave command.
+# sudo doesn't do what is said on the box.
+# For now, do this stuff manually.
+
+typeset -a set_groups
+typeset -i i="0"
+set_groups=( "mock" "obs" "sbuild" )
+
+typeset cur_group=""
+for cur_group in "${set_groups[@]}"; do
+  exec newgrp "${cur_group}"
+done
+
+# Make the primary group actually primary.
+exec newgrp -
+
 # Generate this stuff via:
 #   - openssl s_client -showcerts -servername hostname -connect host:port
 #   - copy the first PEM-encoded certificate to ${cert} including headers (if printed)

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/buildscripts.git


More information about the x2go-commits mailing list