mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: fix C entries, never copy over what exists
A C entry for a directory does the opposite of tmpfiles.d(5):
C /etc/pam.d - - - -
When /etc/pam.d does not exist the entry fails with "Not a directory",
the files of the source are copied to a file with the name of the
path, one over the other. When it is an empty directory nothing is
copied. When it has files in it, they are overwritten with the ones
from /usr/share/factory, at every boot. For a file, an existing one
is overwritten as well.
is_dir_empty() returns true for a directory that is not empty, and
rsync() from libite copies over what is there and needs a slash at the
end of a destination directory that is missing.
Copy with a tree walk of our own instead. It copies to a path that
is missing or an empty directory, overwrites nothing, and does not
follow links. Mode, owner, and modification time are those of the
source.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+258
-29
No files matched your search
@@ -337,6 +337,12 @@ All relevant changes are documented in this file.
|
||||
- Fix tmpfiles `w` entries for a regular file, the file was truncated.
|
||||
As in tmpfiles.d(5), the argument is now written over the start of what
|
||||
the file holds
|
||||
- Fix tmpfiles `C` entries. A directory was not copied to a path that
|
||||
did not exist, or to an empty directory, and was copied over a
|
||||
directory that had files in it, at every boot, as with the `/etc/pam.d`
|
||||
entry in Finit's own `etc.conf`. A file was copied over an existing
|
||||
one. As in tmpfiles.d(5), nothing that exists is now overwritten, and
|
||||
links are copied as links
|
||||
- Fix logins refused after boot on a system with systemd's tmpfiles.d
|
||||
files installed. They create `/run/nologin` at boot, and on systemd it
|
||||
is removed by systemd-user-sessions. Finit now removes it when leaving
|
||||
|
||||
Reference in new issue
Block a user