From owner-freebsd-ports@FreeBSD.ORG Mon Feb 9 06:53:59 2015 Return-Path: Delivered-To: freebsd-ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7138FD38 for ; Mon, 9 Feb 2015 06:53:59 +0000 (UTC) Received: from udns.ultimatedns.net (unknown [IPv6:2602:d1:b4d6:e600:4261:86ff:fef6:aa2a]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 483C7FA2 for ; Mon, 9 Feb 2015 06:53:59 +0000 (UTC) Received: from ultimatedns.net (localhost [127.0.0.1]) by udns.ultimatedns.net (8.14.9/8.14.9) with ESMTP id t196sNg7065331; Sun, 8 Feb 2015 22:54:23 -0800 (PST) (envelope-from bsd-lists@bsdforge.com) To: FreeBSD ports , olli hauer In-Reply-To: <54D85417.7020209@gmx.de> References: <47937acfdc6fc1260b746fc52a2f5d92@ultimatedns.net>, <54D85417.7020209@gmx.de> From: "Chris H" Subject: Re: Is pkg-install the best solution? Date: Sun, 08 Feb 2015 22:54:23 -0800 Content-Type: text/plain; charset=UTF-8; format=fixed MIME-Version: 1.0 Message-id: Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2015 06:53:59 -0000 On Mon, 09 Feb 2015 07:30:47 +0100 olli hauer 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..." > ... > > 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