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:
2012-08-23 00:16:22 -04:00
parent ef0a3488ae
commit ab74e27bb8
7 changed files with 81 additions and 25 deletions

View 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