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
F83606608: D36385.diff
Sun, May 12, 2:34 PM
Unknown Object (File)
Sun, Apr 28, 10:11 AM
Unknown Object (File)
Feb 10 2024, 3:15 AM
Unknown Object (File)
Dec 28 2023, 2:02 PM
Unknown Object (File)
Dec 20 2023, 5:56 AM
Unknown Object (File)
Dec 18 2023, 4:40 AM
Unknown Object (File)
Nov 18 2023, 10:43 PM
Unknown Object (File)
Nov 18 2023, 10:37 AM
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.