From owner-freebsd-ports@freebsd.org Thu Jun 28 17:45:50 2018 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 804531021FA9 for ; Thu, 28 Jun 2018 17:45:50 +0000 (UTC) (envelope-from jbwlists@hilltopgroup.com) Received: from equinox.hilltopgroup.com (equinox.hilltopgroup.com [204.109.63.175]) by mx1.freebsd.org (Postfix) with ESMTP id 1FE3D85FF6; Thu, 28 Jun 2018 17:45:50 +0000 (UTC) (envelope-from jbwlists@hilltopgroup.com) Received: from mail.relativity.hilltop.int (unknown [104.185.205.155]) by equinox.hilltopgroup.com (Postfix) with ESMTP id E00B237BDD5; Thu, 28 Jun 2018 13:45:48 -0400 (EDT) Received: from sovereign.sector005 (equinox.hilltopgroup.com [204.109.63.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jbwlists@hilltopgroup.com) by mail.relativity.hilltop.int (Postfix) with ESMTPSA id 6D7D6132AA; Thu, 28 Jun 2018 13:45:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hilltopgroup.com; s=mail; t=1530207948; bh=AQVgIXmQFq5plZgUzqz/3fMkWDTANlZ+VyldW8lN1Nw=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=g9T5RTqBKlynDxgSApp5tesWVPnOiB9b0s9a5+NIiu1IIpyiA6ykxVTHAdLToSPxJ 7ev7wivWBIbVBfueabTwzvaZp4kw1X5Fw34Pi/QtVUFgw5FZM+j6s4h7rZBCtFmc5I ++ZvxjNMqaJdmVq6Ck1etr4fVZ7t0OZ1JAFnrUg4= Subject: Re: Any way to prevent do-extract chmod and chown? To: Mathieu Arnold Cc: freebsd-ports@freebsd.org References: <20180628082738.uv3bs6jmrrp52h5m@atuin.in.mat.cc> From: Joseph Ward Message-ID: Date: Thu, 28 Jun 2018 13:43:41 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180628082738.uv3bs6jmrrp52h5m@atuin.in.mat.cc> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2018 17:45:50 -0000 Thank you.  I found that to be the case; even though changing the "do-extract" target successfully staged the files and directories with the original permissions, pkg create seems to strip them out again without the pkg-plist additions. Are you aware of an easy/already existing command to create the pkg-plist with the user/group/permissions items for each file, or is that a script I'm going to have to write manually?  I'm currently using the makeplist target as there are no subsitutions or anything else that would screw up the default scenario. Thanks, Joseph On 06/28/2018 04:27, Mathieu Arnold wrote: > On Wed, Jun 27, 2018 at 07:06:44PM -0400, Joseph Ward wrote: >> Hi everyone, >> >> I'm creating some internal-only ports and I'm trying to maintain the >> permissions and owners of the files present in the distfile.tar.gz when >> they get packaged up for install. >> >> When I "make extract", the "do-extract" target is performing a chmod and >> chown on everything, as seen from the following excerpt from the >> bsd.port.mk file: >> >> >> .if !target(do-extract) >> do-extract: ${EXTRACT_WRKDIR} >>         @for file in ${EXTRACT_ONLY}; do \ >>                 if ! (cd ${EXTRACT_WRKDIR} && ${EXTRACT_CMD} >> ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ >>                 then \ >>                         exit 1; \ >>                 fi; \ >>         done >>         @if [ ${UID} = 0 ]; then \ >>                 ${CHMOD} -R ug-s ${WRKDIR}; \ >>                 ${CHOWN} -R 0:0 ${WRKDIR}; \ >>         fi >> .endif >> >> >> Short of commenting those lines out (which I really don't want to do >> because I have 0 idea why it's there or what I'd break with other ports) >> is there any way at all to maintain the ownership of the files?  > Building ports as root is a rare thing these days, most build tools > build everything as a regular user (most of the time, nobody) so > ownership of files in distribution files is not retained anyway. > > To set user/group/mode ownership in the resulting packages, you need to use > the @user, @group and @mode keywords in the pkg-plist file. (or the @ > keyword if one file needs a specific user/group/mode.) See: > > https://www.freebsd.org/doc/en/books/porters-handbook/plist-keywords.html >