website/home/projects/tmpfilesd.org
magic_rb f694cd382f
Add projects page
Signed-off-by: magic_rb <magic_rb@redalder.org>
2023-12-24 22:22:44 +01:00

1.7 KiB

tmpfilesd is a daemon which manages a file hierarchy declaratively. It is unfortunately slightly underused in my opinion. I'm imagining a tool which completely replaces any need for commands like rm, cp, mv, … and of course their equivalents in your favorite standard library.

Currently tmpfilesd takes a file hierarchy specified in a particular format, as so:

# /usr/lib/tmpfiles.d/screen.conf
d /run/screens  1777 root screen 10d
d /run/uscreens 0755 root screen 10d12h

What's stopping tmpfilesd from being used as a global system file hierarchy manager, is that it doesn't keep state between runs, as in if screen.conf gets removed, tmpfilesd will not remove the files which used to be declared by it. This means it is not suitable for package installations and such. If this wasn't the case, most packages could be installed without installation bash scripts or the like and could be uninstalled very easily. I am sure many package managers do this sort of thing already, but a dedicated tool would be in my opinion useful.

Furthermore, it would be desirable if tmpfilesd could display diffs between different configurations (including what's on disk and in the state) and clearly display what it wants to do.

With everything described above it could become a ubiquitous file management tool.

Proposal

Utilize a Haskell library, for diffing arbitrary data structures where that data structure would be the file hierarchy. One such library could be gdiff. It already provides us with an patch data structure which then can be used for all sorts of things including diff display and actually bringing the filesystem into the desired state.