Any way to prevent do-extract chmod and chown?

Joseph Ward jbwlists at hilltopgroup.com
Tue Jul 3 14:36:49 UTC 2018


On 07/02/2018 16:50, Chris H wrote:
> On Fri, 29 Jun 2018 00:05:59 +0200 "Mathieu Arnold" <mat at FreeBSD.org>
> said
>
>> On Thu, Jun 28, 2018 at 01:43:41PM -0400, Joseph Ward wrote:
>> > 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.
>>
>> I am not aware of anything.  But if you already have "stuff" creating a
>> big hierarchy with many users and groups, it may be easier to adapt
>> "stuff" to generate a pkg-plist file, or maybe to split your ports into
>> smaller, more manageable bits.
>>
>> make makeplist will give you a correct listing of files and
>> directories, but as everything runs as a regular user, it cannot be
>> aware of the users/groups you intend on using in the plist.
> make makeplist may be of help to you, as it would allow you to assign
> ownership in
> large chunks, thusly:
>
> @a:b:c
> this
> that
> ...
> theother
> @d:f:e
> somefile
> ...
> another
> bunch
> of
> files
> @other:owner:group:perms
> thesefiles
> ...
> thosefiles
>
> This all assumes that the files are grouped as you need them tho. :-)
>
> HTH
>
> --Chris
>
>>
>> -- 
>> Mathieu Arnold
>
>
> _______________________________________________

Unfortunately, they're not grouped together.  What I'm doing (which is
probably a little crazy) is turning jails into packages so that I can
very easily upgrade them on my remote systems.  So I have a basejail
package which is the dependency for my smtp-jail package, which includes
the mounts into the basejail, etc.  So it's essentially the freebsd base
permissions (and subsets for the thin jails) which of course aren't
grouped at all, and also involves thousands of files.

I ended up using mtree (as suggested by Freddie Cash), having the build
system that creates the jails and their dist-files take the mtree spec
for the jail and include it in the package, and then as a
pkg-post-install script I made it put the permissions back via mtree -u. 

My other option was to take the makeplist target and alter it.  I found
the generate_plist() function in Mk/Scripts/check-stagedir.sh, which
uses find and sed to create the plist.  I was going to add a "stat" in
there, with the formatting of

stat -f "@(%Su,%Sg,%OMp%OLp) %N"

so that I ended up with the plist with the correct permissions on every
file. I'm pretty sure that would have worked, but the mtree solution
suggested by Freddie worked really well, so I just stuck with it.


-Joseph


More information about the freebsd-ports mailing list