adding users in ports

subbsd subbsd at gmail.com
Fri Apr 3 01:41:11 PDT 2009


Hello maillist,

I've planned porting some software to FreeBSD and currently generate Makefile 
for ports. My application required presence of some account in system.

 I've see many sample from current ports like "squid, cacti, avahi, mysql, 
pgsql, cups, distcc..." and many-many-many, they are using equally 
construction like:
---

        if ${PW} user show "${USER}" 2>/dev/null; then
                echo "You already have a user \"${USER}\", so I will use it."
        else
                if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \
                        -d "/nonexistent" -s /usr/sbin/nologin -c "User user"
                then
                        echo "Added user \"${USER}\"."
                else
                        echo "Adding user \"${USER}\" failed..."
                        exit 1
                fi
        fi

---

My question - why do not make this facility by generic (for example create 
add/del/check-existence procedure in  some /usr/ports/Mk/bsd.users.mk file) ?

Thanks




More information about the freebsd-ports mailing list