mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: add the ~ modifier, an argument in Base64
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>
This commit is contained in:
4 files changed
+77
-10
No files matched your search
@@ -102,3 +102,18 @@ assert "Single quotes" "$(texec cat "$DIR/single quote")" = "single"
|
||||
assert "Quotes in path" "$(texec cat "$DIR/middle space")" = "middle"
|
||||
assert "Escapes in path" "$(texec cat "$DIR/escA ped")" = '"kept as is"'
|
||||
assert "Skipped with a quote left open" "$(texec sh -c "ls $DIR | grep -c open")" = "0"
|
||||
|
||||
sep
|
||||
say 'With ~ the argument is Base64'
|
||||
run "printf abcdef > $DIR/w1"
|
||||
run "cat > $CONF" <<'CONF'
|
||||
f~ /tmp/arg/b64 - - - - aGVsbG8gJXQK
|
||||
f~ /tmp/arg/b64pad - - - - aGk=
|
||||
f~ /tmp/arg/b64bad - - - - a!!!
|
||||
w~ /tmp/arg/w1 - - - - WFk=
|
||||
CONF
|
||||
run "/libexec/finit/tmpfiles --create $CONF"
|
||||
assert "Decoded, no specifiers" "$(texec cat $DIR/b64)" = "hello %t"
|
||||
assert "Padded" "$(texec cat $DIR/b64pad)" = "hi"
|
||||
assert "Written with w" "$(texec cat $DIR/w1)" = "XYcdef"
|
||||
assert "Skipped when not Base64" "$(texec sh -c "ls $DIR | grep -c b64bad")" = "0"
|
||||
Reference in new issue
Block a user