Made the diff stat from inside the testfs, so new users/groups would stat correctly. Changed disco-ball fetch to fetch into the testfs, not into / (yikes!). New disco-ball command spin does what the main disco loop used to do for each module. Added the "users" disco ball to the standard library.
This commit is contained in:
27
balls/users/scripts/00-makeusers.sh
Normal file
27
balls/users/scripts/00-makeusers.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
########################
|
||||
# 00-makeusers.sh
|
||||
#
|
||||
# Make linux users for the 'users' disco ball
|
||||
# Each user is represented as a key under ${HOSTNAME}/users, with the value
|
||||
# of each key being a list of useradd/usermod compatible command line flags
|
||||
# that are passed, one each, directly into usermod/useradd
|
||||
########################
|
||||
|
||||
HOSTNAME=$(hostname)
|
||||
|
||||
for username in $(disco-param keys ${HOSTNAME}/users)
|
||||
do
|
||||
NAME=$username
|
||||
PARAMS=$(disco-param get ${HOSTNAME}/users/${NAME})
|
||||
getent passwd | grep "^${NAME}" 2>&1 | disco-shutup
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -eq 0 ] && [ "$PARAMS" == "" ]; then
|
||||
userdel ${NAME}
|
||||
elif [ $RETVAL -ne 0 ]; then
|
||||
usermod ${PARAMS} ${NAME}
|
||||
elif [ "$PARAMS" != "" ]; then
|
||||
useradd ${PARAMS} ${NAME}
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user