From owner-freebsd-ports@FreeBSD.ORG Mon Feb 9 06:30: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 BAFF2A2B for ; Mon, 9 Feb 2015 06:30:59 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F229DA9 for ; Mon, 9 Feb 2015 06:30:58 +0000 (UTC) Received: from [192.168.0.100] ([87.139.233.65]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0LpsmR-1Xj9aW3wW7-00ffPd; Mon, 09 Feb 2015 07:30:44 +0100 Message-ID: <54D85417.7020209@gmx.de> Date: Mon, 09 Feb 2015 07:30:47 +0100 From: olli hauer User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: FreeBSD ports Subject: Re: Is pkg-install the best solution? References: <47937acfdc6fc1260b746fc52a2f5d92@ultimatedns.net> In-Reply-To: <47937acfdc6fc1260b746fc52a2f5d92@ultimatedns.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:2Kgl5Rq7iePP7kwbhiK+tsQLlFPgnbs3IrMJIcBa5F5h2C/VeRA zLTGDEJ+8kNZdiVSKpn9GRQ+CvHMEShJzopSQixb7IujM6phGuHRw8k7mcnDPTHaQ3g01m4 BM2cfioQzMm8EZQPnJBGI+STVef1wlEhhPhtizKGEtX78fXgxQS1PzFnOc9/nZmUvq5R0l6 jaJADE+JB8wAdA7a6GisA== X-UI-Out-Filterresults: notjunk:1; Cc: Chris H 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:30:59 -0000 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. -- Regards, olli