Take a look at the freebsd, openbsd, and debian adduser scripts. See if we can steal one.
I'm going to leave this to people more qualified...