Page MenuHomeFreeBSD

rc: Add mtree support for service scripts
Needs ReviewPublic

Authored by grembo on Aug 28 2022, 10:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 23, 6:25 PM
Unknown Object (File)
Dec 21 2024, 5:26 PM
Unknown Object (File)
Nov 26 2024, 3:42 AM
Unknown Object (File)
Nov 21 2024, 9:54 AM
Unknown Object (File)
Nov 19 2024, 10:03 AM
Unknown Object (File)
Oct 20 2024, 8:03 AM
Unknown Object (File)
Oct 16 2024, 3:28 PM
Unknown Object (File)
Oct 4 2024, 7:18 PM
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Given a service script X, check if there is a file path_to_X/../mtree/X
and - if it exists - run mtree on it.

This allows services (including those from ports) to recreate temporary
directory hierarchies on service start.

These mtree files could either come packaged with a port or could be
added manually by a system administrator without altering/patching
a port.

This was inspired by the discussion on the FreeBSD-current mailing list:
https://lists.freebsd.org/archives/freebsd-current/2022-August/002497.html

In the specific example, a user needed to recreate /var/run/clamav.
With this patch, they could create a file
/usr/local/etc/mtree/clamav-clamd with the following content to
address their problem:

/set type=dir
.
    var
        run
            clamav mode=0750 uname=clamav gname=clamav

This file could either be adopted by the port maintainer or, if they
don't like it, be placed their by the system administrator.

This is a proof of concept/basis for a discussion. There are certainly
other ways of addressing this issue.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 47163
Build 44050: arc lint + arc unit

Event Timeline

In Linux this king of thing is performed by tmpfiles.d, which has its own format. Some ports are installing these files, but they are incompatible with mtree, so we're basically reimplementing that.