This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository buildscripts. commit 7c534f8499e4ec033afbc403e34f435669489cfc Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Nov 25 09:26:45 2017 +0100 bin/slave-start-prepare.sh: use a (more or less) sophisticated call chain and sg to set groups. --- bin/slave-start-prepare.sh | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/bin/slave-start-prepare.sh b/bin/slave-start-prepare.sh index 8e6fae8..d7608ab 100755 --- a/bin/slave-start-prepare.sh +++ b/bin/slave-start-prepare.sh @@ -11,17 +11,36 @@ typeset prefix="$(cut -d"-" -f1 <<< "$(basename "${0}")")" # 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" ) +if [[ "${#}" -eq "0" ]]; then + typeset -a set_groups + set_groups=( "mock" "obs" "sbuild" ) -typeset cur_group="" -for cur_group in "${set_groups[@]}"; do - exec newgrp "${cur_group}" -done + exec "${0}" --set-groups "${set_groups[@]}" +else + if [[ "${1}" == "--set-groups" ]]; then + shift + + if [[ "${#}" -gt "0" ]]; then + # Process next group in list. + typeset cur_group="${1}" + shift -# Make the primary group actually primary. -exec newgrp - + exec sg "${cur_group}" "${0} --set-groups ${@}" + else + # No more groups in list, make the primary group actually primary. + exec sg - "${0} --skip-groups" + fi + else + if [[ "${1}" == "--skip-groups" ]]; then + # All groups processed, including primary group. + # Continuing script execution. + : + else + echo "Script called with unknown parameters. Aborting." >&2 + exit "1" + fi + fi +fi # Generate this stuff via: # - openssl s_client -showcerts -servername hostname -connect host:port -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/buildscripts.git