pkgsrc/net/samba4/files/deluser.sh
ryoon 8e9d5fc761 Import samba-4.2.1 as net/samba4.
Samba is the standard Windows interoperability suite of programs
for Linux and Unix.

Samba is Free Software licensed under the GNU General Public License,
the Samba project is a member of the Software Freedom Conservancy.

Since 1992, Samba has provided secure, stable and fast file and
print services for all clients using the SMB/CIFS protocol, such
as all versions of DOS and Windows, OS/2, Linux and many others.

Samba is an important component to seamlessly integrate Linux/Unix
Servers and Desktops into Active Directory environments. It can
function both as a domain controller or as a regular domain member.

This package tracks 4.x branch release.
2015-05-12 12:19:52 +00:00

68 lines
1 KiB
Bash

#!@SH@
#
# $NetBSD: deluser.sh,v 1.1 2015/05/12 12:19:52 ryoon Exp $
#
# This is a deluser script for NetBSD systems whose userdel(8) doesn't
# accept "$" in the username.
awkprog="@AWK@"
mktempprog="@MKTEMP@"
pwdmkdbprog="@PWD_MKDB@"
rmprog="@RM@"
progname=deluser
usage() {
echo "Usage: $progname [-n] name"
exit 1
}
doit=""
while getopts n flag; do
case $flag in
n) doit=":" ;;
esac
done
shift `expr $OPTIND - 1`
if [ $# -lt 1 ]; then
usage
fi
name="$1"
case "$name" in
*:*)
echo "$progname: \`$name' is not a valid user name" 1>&2
exit 1
esac
ptmp=`$mktempprog -q /etc/ptmp`
case "$ptmp" in
/etc/ptmp)
;;
*)
echo "$progname: can't create /etc/ptmp" 1>&2
exit 1
;;
esac
if [ ! -f /etc/master.passwd ]; then
echo "$progname: /etc/master.passwd not found" 1>&2
$rmprog -f $ptmp
exit 1
fi
$awkprog -v name="${name}" ' \
BEGIN { FS = ":" } \
{ \
if ($1 != name) \
print $0; \
}' /etc/master.passwd > $ptmp
$doit $pwdmkdbprog -p $ptmp
rc=$?
$rmprog -f $ptmp
exit $rc