diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index 95326228..8db61a47 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -22,6 +22,8 @@ All relevant changes are documented in this file. `%w`, `%W`, `%B`, `%M`, and `%A`. Before, an entry with a `%` 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 `%%` +- 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 it. `--prefix` and `--exclude-prefix` match whole path components, `--exclude-prefix=/dev` no longer skips `/devices` diff --git a/doc/tmpfiles-todo.md b/doc/tmpfiles-todo.md index bfcfbeae..6ea495eb 100644 --- a/doc/tmpfiles-todo.md +++ b/doc/tmpfiles-todo.md @@ -11,7 +11,7 @@ files or common packages already rely on, last what few will miss. 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 * `t`, `T` for extended attributes and `h`, `H` for file attributes * Modifiers `-` (do not fail), `=` (remove what is of another type), diff --git a/src/tmpfiles.c b/src/tmpfiles.c index f1fa53fb..9ae80855 100644 --- a/src/tmpfiles.c +++ b/src/tmpfiles.c @@ -1178,6 +1178,8 @@ static void tmpfiles(char *line) plus = 1; else if (*mod == '!') boot = 1; + else if (*mod == '?' && type[0] == 'L') + type[0] = 'l'; /* What Finit has had as l */ } if (boot && !boot_flag) return; diff --git a/test/tmpfiles-arg.sh b/test/tmpfiles-arg.sh index ef1676b2..fcb06f10 100755 --- a/test/tmpfiles-arg.sh +++ b/test/tmpfiles-arg.sh @@ -31,6 +31,16 @@ assert "File content" "$(texec cat $DIR/text)" = "two words" say 'A lone - is no argument' 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" <