With files in five directories, where one in /etc replaces the one
with the same name in /usr/lib, it is not easy to tell what tmpfiles
goes by. systemd-tmpfiles has --cat-config for this.
Add the option. It prints each file that would be read below a line
with its name, and exits:
/libexec/finit/tmpfiles --cat-config
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
In tmpfiles.d(5) a ~ after the type of an f, F, or w entry means the
argument is Base64, for content that cannot be written on a line:
f~ /root/.ssh/authorized_keys 0600 root root - c3NoLWVkMjU1MTkg...
tmpfiles ignores the ~ and writes the argument as it is.
Decode the argument. As in systemd it is not looked at for specifiers
or escapes, and an entry with an argument that is not Base64 is
skipped.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
There is no way to write an entry for a path with a space in it, the
fields are split at every space. In tmpfiles.d(5) a field can be
quoted, and have C-style escapes:
d "/srv/my files"
d /srv/my\sfiles
Split the fields with a function that resolves both. The argument is
still the rest of the line as it is, quotes and all, like in systemd.
An entry with a quote left open is skipped.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A w entry empties the file before it writes the argument. With a file
that holds "abcdef":
w /tmp/file - - - - XY
leaves "XY". With systemd-tmpfiles the file holds "XYcdef", it writes
over the start of what is there. For a file in /proc or /sys there is
no difference.
Open the file without O_TRUNC.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
An entry with a # in the argument loses it and the rest of the line:
f /tmp/file - - - - a#b c
gives a file holding "a". The lines are read with fparseln(), which
by default takes a # anywhere in a line as the start of a comment. In
tmpfiles.d(5) only a line that starts with # is a comment.
Read the lines without a comment character and skip the lines that
start with one.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
An f or w entry with \x39 in the argument writes the byte 3 followed
by a 9, where it should write a 9:
f /tmp/file - - - - \x39
write_hex() only takes the digits 0 to 7, as for an octal escape.
Take all hex digits.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A ^ after the type says the argument is the name of a credential to
read the real argument from. Files from systemd have them:
f^ /etc/hosts - - - - network.hosts
The ^ was not read, so on a system without /etc/hosts this made one
holding the text "network.hosts".
Finit has no credentials. Skip the entry, which is what systemd does
when the credential is not set.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A w entry with a glob wrote its whole argument to the first path
only. The rest got it up to the first backslash:
w /sys/class/net/eth*/queues/rx-0/rps_cpus - - - - f\n
write_arg() put a NUL in the argument at each escape as it went, so
the second call saw a shorter string.
Leave the argument as it is.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
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>
A package that ships a tmpfiles.d file wants its own paths created
when it is installed, without running every other entry on the
system:
tmpfiles --create --prefix=/var/lib/app
Add the option, it can be given more than once. It and
--exclude-prefix compare whole path components now, before
--exclude-prefix=/dev also left out /devices.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
An entry written in aligned columns got the space after the age field
as part of its argument:
L /tmp/null - - - - /dev/null
This made a link to " /dev/null". Only the first separator after
the age was dropped. A lone "-" for no argument was also taken as is,
so an f entry with it made a file holding a dash.
Skip all the space before the argument, and read "-" as no argument.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>