Date: Wed, 27 Jun 2018 17:54:14 -0600 From: Adam Weinberger <adamw@adamw.org> To: jbwlists@hilltopgroup.com Cc: freebsd-ports@freebsd.org Subject: Re: Any way to prevent do-extract chmod and chown? Message-ID: <CAP7rwcj16M6pPD6CgxgwfOhk9MtE7Aa_OVE9GqFRbgY1xrAf-Q@mail.gmail.com> In-Reply-To: <dbfc8dbc-547c-74d9-e2dc-3cb3367293e1@hilltopgroup.com> References: <dbfc8dbc-547c-74d9-e2dc-3cb3367293e1@hilltopgroup.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 27, 2018 at 5:09 PM Joseph Ward <jbwlists@hilltopgroup.com> 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? > > > Thanks, > > Joseph Ward Hi Joseph, Your best bet is to use plist keywords. See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/plist-keywords.html for details. You can set owner/group on individual files in the pkg-plist: @(ownername,groupname,444) path/to/file Or you can set it on a block of files: @group groupname @owner ownername path/to/file1 path/to/file2 # Adam -- Adam Weinberger adamw@adamw.org https://www.adamw.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAP7rwcj16M6pPD6CgxgwfOhk9MtE7Aa_OVE9GqFRbgY1xrAf-Q>