]>
git.saurik.com Git - apple/xnu.git/blob - tools/tests/libMicro/od_account_delete.sh
5 echo "Interrupting account creation"
10 trap sighandler INT TERM
17 GROUP_NAME
='od_test_group'
23 echo "Usage: ${NAME} count nodename"
25 echo " ie. ${NAME} 1000 /Local/Default"
27 echo " will delete ${GROUPNAME} and 1000 users "
28 echo " from '${PREFIX}1' to '${PREFIX}1000'"
30 echo "This tool assumes user 'diradmin' with password 'admin' for OD admin"
31 echo "when talking to anything other than /Local/Default"
39 # we don't need credentials if its a local node
40 if [ $NODE != "/Local/Default" ]; then
45 echo "Deleting users ${PREFIX}1 to ${PREFIX}$COUNT"
47 # Using a script file and feed it into dscl is much faster than
48 # calling dscl everytime.
51 echo "Writing a temporary script ..."
52 if [ -n "$OD_ADMIN" ]; then
53 echo "auth $OD_ADMIN $OD_PASS" >> $TMPF
56 while [ $i -le $COUNT ]
58 result
=`dscl $NODE -list Users/${PREFIX}${i} 2> /dev/null`
60 echo "delete Users/${PREFIX}${i}" >> $TMPF
61 printf "\r${PREFIX}${i} / ${COUNT}"
67 echo "Deleting temporary test groups"
68 if [ -n "$OD_ADMIN" ]; then
69 result
=`dseditgroup -q -o delete -n $NODE -u $OD_ADMIN -P $OD_PASS ${GROUP_NAME}1 2>&1 /dev/null`
70 result
=`dseditgroup -q -o delete -n $NODE -u $OD_ADMIN -P $OD_PASS ${GROUP_NAME}2 2>&1 /dev/null`
72 result
=`dseditgroup -q -o delete -n $NODE ${GROUP_NAME}1 2>&1 /dev/null`
73 result
=`dseditgroup -q -o delete -n $NODE ${GROUP_NAME}2 2>&1 /dev/null`
76 result
=`dseditgroup -q -o delete com.apple.access_libMicro 2>&1 /dev/null`
78 # Now do the real work
80 if [[ -f $TMPF ]]; then
81 echo "Running dscl to delete users. Please be patient. This takes a while ..."
82 if [[ -x /usr
/sbin
/slapconfig
]]; then
83 /usr
/sbin
/slapconfig
-setfullsyncmode no
86 /usr
/bin
/time dscl
${NODE} < $TMPF
88 if [[ -x /usr
/sbin
/slapconfig
]]; then
89 /usr
/sbin
/slapconfig
-setfullsyncmode yes
93 # and now delete the temp file