mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: add the L? entry
tmpfiles.d(5) has L? for a link that is only made when what it points
to exists:
L? /etc/localtime - - - - ../usr/share/zoneinfo/UTC
The ? was not read, so this made the link whatever was there.
Finit has had this as its own l entry. Read L? as l.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+15
-1
No files matched your search
@@ -22,6 +22,8 @@ All relevant changes are documented in this file.
|
|||||||
`%w`, `%W`, `%B`, `%M`, and `%A`. Before, an entry with a `%`
|
`%w`, `%W`, `%B`, `%M`, and `%A`. Before, an entry with a `%`
|
||||||
in the path was skipped. **Note:** a literal `%` in such an argument,
|
in the path was skipped. **Note:** a literal `%` in such an argument,
|
||||||
e.g. in a `w` entry for `core_pattern`, must now be written `%%`
|
e.g. in a `w` entry for `core_pattern`, must now be written `%%`
|
||||||
|
- tmpfiles: add the `L?` entry, a link that is only made when what it
|
||||||
|
points to exists, the same as Finit's own `l` entry
|
||||||
- tmpfiles: add `--prefix=PATH`, to only run the entries for paths below
|
- tmpfiles: add `--prefix=PATH`, to only run the entries for paths below
|
||||||
it. `--prefix` and `--exclude-prefix` match whole path components,
|
it. `--prefix` and `--exclude-prefix` match whole path components,
|
||||||
`--exclude-prefix=/dev` no longer skips `/devices`
|
`--exclude-prefix=/dev` no longer skips `/devices`
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ files or common packages already rely on, last what few will miss.
|
|||||||
1. Remaining types and modifiers
|
1. Remaining types and modifiers
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
* `L?`, and `C+`, which is read as `C`
|
* `C+`, which is read as `C`
|
||||||
* `z` and `Z` only set the SELinux label when `restorecon` is installed
|
* `z` and `Z` only set the SELinux label when `restorecon` is installed
|
||||||
* `t`, `T` for extended attributes and `h`, `H` for file attributes
|
* `t`, `T` for extended attributes and `h`, `H` for file attributes
|
||||||
* Modifiers `-` (do not fail), `=` (remove what is of another type),
|
* Modifiers `-` (do not fail), `=` (remove what is of another type),
|
||||||
|
|||||||
@@ -1178,6 +1178,8 @@ static void tmpfiles(char *line)
|
|||||||
plus = 1;
|
plus = 1;
|
||||||
else if (*mod == '!')
|
else if (*mod == '!')
|
||||||
boot = 1;
|
boot = 1;
|
||||||
|
else if (*mod == '?' && type[0] == 'L')
|
||||||
|
type[0] = 'l'; /* What Finit has had as l */
|
||||||
}
|
}
|
||||||
if (boot && !boot_flag)
|
if (boot && !boot_flag)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -31,6 +31,16 @@ assert "File content" "$(texec cat $DIR/text)" = "two words"
|
|||||||
say 'A lone - is no argument'
|
say 'A lone - is no argument'
|
||||||
assert "Empty file" "$(texec stat -c %s $DIR/dash)" = "0"
|
assert "Empty file" "$(texec stat -c %s $DIR/dash)" = "0"
|
||||||
|
|
||||||
|
sep
|
||||||
|
say 'L? only makes the link when what it points to is there'
|
||||||
|
run "cat > $CONF" <<CONF
|
||||||
|
L? $DIR/there - - - - /etc/passwd
|
||||||
|
L? $DIR/missing - - - - /no/such/file
|
||||||
|
CONF
|
||||||
|
run "/libexec/finit/tmpfiles --create $CONF"
|
||||||
|
assert "Link to a path that is there" "$(texec readlink $DIR/there)" = "/etc/passwd"
|
||||||
|
assert "No link to a missing path" "$(texec sh -c "ls $DIR | grep -c missing")" = "0"
|
||||||
|
|
||||||
sep
|
sep
|
||||||
say 'With --prefix only the entries below it are run'
|
say 'With --prefix only the entries below it are run'
|
||||||
run "cat > $CONF" <<CONF
|
run "cat > $CONF" <<CONF
|
||||||
|
|||||||
Reference in new issue
Block a user