Is pkg-install the best solution?
Chris H
bsd-lists at bsdforge.com
Mon Feb 9 06:53:59 UTC 2015
On Mon, 09 Feb 2015 07:30:47 +0100 olli hauer <ohauer at gmx.de> wrote
> On 2015-02-09 03:05, Chris H wrote:
> > Greetings,
> > I'm working with a port that [conditionally] requires
> > creating/setting a UID && GID. Following is my approach
> > for a pkg-install. But would simply setting them as
> > USERS=
> > GROUPS=
> > in Makefile be a better approach?
> > pkg-install:
> > #!/bin/sh
> >
> > PATH=/bin:/usr/sbin
> >
> > if [ -z "${WRAP_USER}" ]; then
> > WRAP_USER=myapp
> > fi
> >
> > case $2 in
> > PRE-INSTALL)
> > UID=181
> > GID=${UID}
> > if [ ! -d "${MYAPP_DIR}" ]; then
> > mkdir -p ${MYAPP_DIR}
> > fi
> > if pw user show "${WRAP_USER}" 2>/dev/null; then
> > echo "You already have a user \"${WRAP_USER}\", so I will use it."
> > if pw usermod ${WRAP_USER} -d ${MYAPP_DIR}
> > then
> > echo "Changed home directory of \"${WRAP_USER}\" to
> > \"${MYAPP_DIR}\"" > else
> > "${MYAPP_DIR}\" failed..."
> <snip> ...
>
> Hi Chris,
>
> go with USERS,GROUPS in Makefile and if the user/group does not already exist
> in ports/UIDs, ports/GIDs request one together with the new port.
>
> Using pkg-install to create users/groups is deprecated.
Perfect. Good to know.
Thank you, olli!
Greatly appreciated. :)
--Chris
>
> --
> Regards,
> olli
More information about the freebsd-ports
mailing list