pkgsrc/sysutils/user_darwin/files/userdel.sh
rh d55390bb88 Update the user_darwin scripts to 20071026. This adds compatibility with
Darwin 9.x / Mac OS X 10.5 (Leopard), which no longer uses netinfo.
2007-10-29 08:12:55 +00:00

20 lines
390 B
Bash
Executable file

#!/bin/sh
PATH=/bin:/usr/bin:$PATH
if [ $# -gt 1 ]; then
echo "userdel: Unrecognized option $1" 1>&2
exit 1
fi
user="$1"
if [ -z "$user" ]; then
echo "userdel: Must specify username" 1>&2
exit 1
fi
if ! niutil -destroy . /users/$user 2>/dev/null && \
! dscl . -delete /users/$user >/dev/null 2>&1 ; then
echo "userdel: Could not delete user" 1>&2
exit 1
fi