mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: make a directory for v, q, and Q entries
Files from distributions use v, q, and Q for directories that should
be btrfs subvolumes when that is possible:
v /var/lib/machines 0700 - - -
tmpfiles skipped them as unsupported, so the directory was missing.
On a file system without subvolumes tmpfiles.d(5) has them make a
plain directory. Do that everywhere, read them as d.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+23
-12
No files matched your search
@@ -15,6 +15,9 @@ All relevant changes are documented in this file.
|
|||||||
skipped unless the new `--boot` option is given. Finit gives it at
|
skipped unless the new `--boot` option is given. Finit gives it at
|
||||||
boot, and now also `--remove`, so `r`, `R`, and `D` entries take effect
|
boot, and now also `--remove`, so `r`, `R`, and `D` entries take effect
|
||||||
at boot and no longer need a separate call
|
at boot and no longer need a separate call
|
||||||
|
- tmpfiles: the `v`, `q`, and `Q` entries now make a plain directory, like
|
||||||
|
`d`. Finit has no support for btrfs subvolumes, and before the entries
|
||||||
|
were skipped as unsupported
|
||||||
- tmpfiles: add the `:` prefix for mode, user, and group, to set them only
|
- tmpfiles: add the `:` prefix for mode, user, and group, to set them only
|
||||||
on a path the entry creates, and the `~` prefix for the mode, to drop
|
on a path the entry creates, and the `~` prefix for the mode, to drop
|
||||||
read, write, or execute where the existing path has it for no one
|
read, write, or execute where the existing path has it for no one
|
||||||
|
|||||||
+4
-12
@@ -21,15 +21,7 @@ user to call it from cron.
|
|||||||
glob in the path is not cleaned
|
glob in the path is not cleaned
|
||||||
|
|
||||||
|
|
||||||
2. Subvolumes
|
2. Specifiers
|
||||||
-------------
|
|
||||||
|
|
||||||
`v`, `q`, and `Q` are skipped as unsupported. systemd makes a plain
|
|
||||||
directory when the file system is not btrfs, doing the same gets
|
|
||||||
distribution files with these entries to work.
|
|
||||||
|
|
||||||
|
|
||||||
3. Specifiers
|
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
A path with `%` in it is skipped, also the escaped `%%`. The ones that
|
A path with `%` in it is skipped, also the escaped `%%`. The ones that
|
||||||
@@ -39,7 +31,7 @@ and `%V`. This is the largest gap for using such files unchanged, and
|
|||||||
the most work.
|
the most work.
|
||||||
|
|
||||||
|
|
||||||
4. Remaining types and modifiers
|
3. Remaining types and modifiers
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
* `L?`, and `C+`, which is read as `C`
|
* `L?`, and `C+`, which is read as `C`
|
||||||
@@ -50,7 +42,7 @@ the most work.
|
|||||||
* Quoted paths, a path with a space in it cannot be written
|
* Quoted paths, a path with a space in it cannot be written
|
||||||
|
|
||||||
|
|
||||||
5. Command line
|
4. Command line
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
Missing options: `--prefix`, `--root`, `--replace`, `--dry-run`,
|
Missing options: `--prefix`, `--root`, `--replace`, `--dry-run`,
|
||||||
@@ -59,7 +51,7 @@ is the useful one, for packages that run `tmpfiles --create` on only
|
|||||||
their own paths.
|
their own paths.
|
||||||
|
|
||||||
|
|
||||||
6. Smaller things
|
5. Smaller things
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
* Files are processed one directory at a time. tmpfiles.d(5) sorts
|
* Files are processed one directory at a time. tmpfiles.d(5) sorts
|
||||||
|
|||||||
@@ -884,6 +884,10 @@ static void tmpfiles(char *line)
|
|||||||
if (boot && !boot_flag)
|
if (boot && !boot_flag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* No btrfs subvolumes, a plain directory as tmpfiles.d(5) has for other file systems */
|
||||||
|
if (strchr("vqQ", type[0]))
|
||||||
|
type[0] = 'd';
|
||||||
|
|
||||||
path = strtok(NULL, "\t ");
|
path = strtok(NULL, "\t ");
|
||||||
if (!path)
|
if (!path)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -103,3 +103,15 @@ run "touch $DIR/keep; chmod 2755 $DIR/keep; /libexec/finit/tmpfiles --create $CO
|
|||||||
assert "Mode given" "$(texec stat -c '%a %U:%G' $DIR/suid)" = "4755 bin:sys"
|
assert "Mode given" "$(texec stat -c '%a %U:%G' $DIR/suid)" = "4755 bin:sys"
|
||||||
assert "Mode not given" "$(texec stat -c '%a %U:%G' $DIR/keep)" = "2755 sys:bin"
|
assert "Mode not given" "$(texec stat -c '%a %U:%G' $DIR/keep)" = "2755 sys:bin"
|
||||||
assert "Masked to 0" "$(texec stat -c '%a' $DIR/none)" = "0"
|
assert "Masked to 0" "$(texec stat -c '%a' $DIR/none)" = "0"
|
||||||
|
|
||||||
|
sep
|
||||||
|
say 'v, q, and Q entries make a plain directory, like d'
|
||||||
|
run "cat > $CONF" <<CONF
|
||||||
|
v $DIR/v 0750 bin sys
|
||||||
|
q $DIR/q 0700 sys bin
|
||||||
|
Q $DIR/Q
|
||||||
|
CONF
|
||||||
|
run "/libexec/finit/tmpfiles --create $CONF"
|
||||||
|
assert "v" "$(texec stat -c '%F %a %U:%G' $DIR/v)" = "directory 750 bin:sys"
|
||||||
|
assert "q" "$(texec stat -c '%F %a %U:%G' $DIR/q)" = "directory 700 sys:bin"
|
||||||
|
assert "Q" "$(texec stat -c '%F %a %U:%G' $DIR/Q)" = "directory 755 root:root"
|
||||||
Reference in new issue
Block a user