Unverified Commit e8b09d55 authored by Vagrant Cascadian's avatar Vagrant Cascadian Committed by Holger Levsen
Browse files

Add support for specifying machines by architecture.



Signed-off-by: Holger Levsen's avatarHolger Levsen <holger@layer-acht.org>
parent 26578389
...@@ -12,6 +12,7 @@ TMPFILE=$(mktemp) ...@@ -12,6 +12,7 @@ TMPFILE=$(mktemp)
# The $@ below means that command line args get passed on to j-j-b # The $@ below means that command line args get passed on to j-j-b
# which allows one to specify --flush-cache or --ignore-cache # which allows one to specify --flush-cache or --ignore-cache
JJB="jenkins-job-builder $@" JJB="jenkins-job-builder $@"
DPKG_ARCH="$(dpkg --print-architecture)"
# so we can later run some commands only if $0 has been updated… # so we can later run some commands only if $0 has been updated…
if [ -f $STAMP ] && [ $STAMP -nt $BASEDIR/$0 ] ; then 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) ...@@ -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 ( $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 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 # create the user
if ! getent passwd $user > /dev/null ; then if ! getent passwd $user > /dev/null ; then
...@@ -98,7 +99,7 @@ users=$(for i in ${!user_host_groups[@]}; do echo ${i%,*} ; done | sort -u) ...@@ -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 sudo adduser --gecos "" --shell "${u_shell[$user]:-/bin/bash}" --disabled-password $user
fi fi
# add groups: first try the specific host, or if unset fall-back to default '*' setting # 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 if [ -v user_host_groups["$user","$h"] ] ; then
sudo usermod -G "${user_host_groups["$user","$h"]}" $user sudo usermod -G "${user_host_groups["$user","$h"]}" $user
break break
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment