mirror of
https://git.sr.ht/~magic_rb/website
synced 2024-11-29 03:26:14 +01:00
20 lines
1.7 KiB
Org Mode
20 lines
1.7 KiB
Org Mode
|
=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:
|
||
|
|
||
|
#+begin_example
|
||
|
# /usr/lib/tmpfiles.d/screen.conf
|
||
|
d /run/screens 1777 root screen 10d
|
||
|
d /run/uscreens 0755 root screen 10d12h
|
||
|
#+end_example
|
||
|
|
||
|
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 [[https://hackage.haskell.org/package/gdiff][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.
|