summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVagrant Cascadian <vagrant@debian.org>2016-12-22 13:28:56 -0800
committerHolger Levsen <holger@layer-acht.org>2016-12-23 01:47:42 +0100
commite8b09d551ccdaa4f43a2e7de5d48aa6190ec2deb (patch)
tree904aea4b55c2097888876f61a848345b81886e43
parent26578389744eef4088a98638de9ee2379cb4daf3 (diff)
downloadjenkins.debian.net-e8b09d551ccdaa4f43a2e7de5d48aa6190ec2deb.tar.xz
Add support for specifying machines by architecture.
Signed-off-by: Holger Levsen <holger@layer-acht.org>
-rwxr-xr-xupdate_jdn.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/update_jdn.sh b/update_jdn.sh
index 7d0810f1..cf763e9b 100755
--- a/update_jdn.sh
+++ b/update_jdn.sh
@@ -12,6 +12,7 @@ TMPFILE=$(mktemp)
# The $@ below means that command line args get passed on to j-j-b
# which allows one to specify --flush-cache or --ignore-cache
JJB="jenkins-job-builder $@"
+DPKG_ARCH="$(dpkg --print-architecture)"
# so we can later run some commands only if $0 has been updated…
if [ -f $STAMP ] && [ $STAMP -nt $BASEDIR/$0 ] ; then
@@ -90,7 +91,7 @@ users=$(for i in ${!user_host_groups[@]}; do echo ${i%,*} ; done | sort -u)
( $UP2DATE && [ -z $(find authorized_keys -newer $0) ] ) || for user in ${users}; do
# -v is a bashism to check for set variables, used here to see if this user is active on this host
- [ -v user_host_groups["$user","$HOSTNAME"] -o -v user_host_groups["$user",'*'] ] || continue
+ [ -v user_host_groups["$user","$HOSTNAME"] -o -v user_host_groups["$user",'*'] -o -v user_host_groups["$user", "$DPKG_ARCH"] ] || continue
# create the user
if ! getent passwd $user > /dev/null ; then
@@ -98,7 +99,7 @@ users=$(for i in ${!user_host_groups[@]}; do echo ${i%,*} ; done | sort -u)
sudo adduser --gecos "" --shell "${u_shell[$user]:-/bin/bash}" --disabled-password $user
fi
# add groups: first try the specific host, or if unset fall-back to default '*' setting
- for h in "$HOSTNAME" '*' ; do
+ for h in "$HOSTNAME" "$DPKG_ARCH" '*' ; do
if [ -v user_host_groups["$user","$h"] ] ; then
sudo usermod -G "${user_host_groups["$user","$h"]}" $user
break