NetBSD/share/sushi/users/adduser/script

26 lines
523 B
Plaintext
Raw Normal View History

#!/bin/sh -x
# $NetBSD: script,v 1.1 2001/01/05 02:07:00 garbled Exp $
CTIME=`date +%s`
if [ ! -z $6 ]; then
EXPIRE=`expr $6 \* 24 \* 60 \* 60 + $CTIME`
EXPIRE=`echo "-e $EXPIRE"`
fi
if [ -z $5 ]; then
HOME=`grep base_dir /etc/usermgmt.conf | awk '{print $2}'`
HOME=`echo "${HOME}/${1}"`
else
HOME=$5
fi
if [ -z $8 ]; then
UID=""
else
UID="-u $8"
fi
if [ $3 != "NONE" ]; then
SG="-G $3"
fi
useradd $SG $UID -c "$4" -d $HOME $EXPIRE -g $2 -m -s $7 -v $1
if [ $? -eq 0 ]; then
echo "User $1 successfully created"
fi