Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jun 2018 10:27:38 +0200
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        Joseph Ward <jbwlists@hilltopgroup.com>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Any way to prevent do-extract chmod and chown?
Message-ID:  <20180628082738.uv3bs6jmrrp52h5m@atuin.in.mat.cc>
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

--z6bfi6uyvi4vghdu
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jun 27, 2018 at 07:06:44PM -0400, Joseph Ward wrote:
> Hi everyone,
>=20
> 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.
>=20
> 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:
>=20
>=20
> .if !target(do-extract)
> do-extract: ${EXTRACT_WRKDIR}
> =A0=A0=A0=A0=A0=A0=A0 @for file in ${EXTRACT_ONLY}; do \
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ! (cd ${EXTRACT_WRKDIR} =
&& ${EXTRACT_CMD}
> ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 then \
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 exi=
t 1; \
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fi; \
> =A0=A0=A0=A0=A0=A0=A0 done
> =A0=A0=A0=A0=A0=A0=A0 @if [ ${UID} =3D 0 ]; then \
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ${CHMOD} -R ug-s ${WRKDIR};=
 \
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ${CHOWN} -R 0:0 ${WRKDIR}; \
> =A0=A0=A0=A0=A0=A0=A0 fi
> .endif
>=20
>=20
> 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?=A0

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

--=20
Mathieu Arnold

--z6bfi6uyvi4vghdu
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAABCgB9FiEEOraXidLtEhBkQLpbOkUW81GDzkgFAls0m/lfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNB
QjY5Nzg5RDJFRDEyMTA2NDQwQkE1QjNBNDUxNkYzNTE4M0NFNDgACgkQOkUW81GD
zkjjDhAAuPNDeWOwihT1+Wis6fQeG2SEwKuOFHaagRvQsAt4U+nfro7sSZ3NYbtQ
KuD6arSupj2FnltaywD93aZCnyxoQfA4ETaJ3anRCD6mhrK1agWlxcQcBRCcEy38
goM+Sm1VNZsc/8u4jEUjEzLMO1cQbsBnavjBnz7l+/5oKooon8iTYH20B4wpA8Yz
VCD1uFsv64QZ+4SGVebVWklICbLCvq/tucplzYUvp6bw5rEhUAEdBbRNwIPOexzI
Yu2asM4HlfqorFhpdf7w7Q9Qkd3jjtWVCBtJhngkK/bMc/P5NIxmNSEUrSl67rNp
V7ORmrNDdKfFboNYpReEIaJ/4YYthou3EmSkouUiStjuUEA1mfLq9ssKojqh8p5t
uFyteZWNIf5rWihbGJNvQMRcVgabOn2YqJOB6dvoQpWzdsAglHA8TJgRPVygogMf
eamuFFOfGErGQePqPlAos1u617bvd32izJriXC1dQsGMk0OwnIIU98ZjE9CTHeHj
6Qs2lkSR41lVmPJKl0SZN0s2TOqUp8xXDa6lrzC2KzO85TPvPHo/bWgFgVjpV0N1
1g/XwPRRPYoRY88HuBuixK6XOF3QPOI5xD5IODN1+WArMOJYxyXAMS/rWEzuMUWB
bPQ68vcm4lkQ9tMQZ3Pa7wOgCFr7I0YhgDzxBMEJvU8EhDiPM0g=
=er0k
-----END PGP SIGNATURE-----

--z6bfi6uyvi4vghdu--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180628082738.uv3bs6jmrrp52h5m>