Commit Graph

118 Commits

Author SHA1 Message Date
William Douglas 6d7b543342 RFC tmpfiles: Allow configuration to ignore execution errors
This is an implementation that covers making errors encountered when writing
file content optionally fatal. If this is something that folks would want I'll
add handling of this for all the other directives. I'd appreciate suggestions
on how this might better be structured as well (use of a goto fail or such) as
I'm not super happy with the approach.
2018-09-25 23:30:30 +02:00
Franck Bui f17a8d6178 tmpfiles: don't adjust qgroups on existing subvolumes
The qgroup logic (types 'q' and 'Q') only has an effect if there's no previous
setup at all, and any explicitly configured subvolumes with their qgroups are
left entirely unmodified.

The idea is that if users want a different logic than the one we set up by
default, then by all means they should do that before hand, and tmpfiles won't
override their logic.
2018-08-08 12:37:35 +02:00
Lennart Poettering cfffa385a3
Merge pull request #9489 from keszybz/copyright-removal-3
Copyright header removal, part 3 (or 4?)
2018-07-03 16:55:01 +02:00
Lucas Werkmeister 8252eb18b8 man: add missing <option> tag
One mention of --user was missing the surrounding <option> tag, making
the table look inconsistent (though the inconsistency is less obvious
after the reordering in 709f4c472c, since the four specifiers mentioning
the --user option are no longer immediately adjacent).
2018-07-03 14:53:36 +02:00
Zbigniew Jędrzejewski-Szmek 514094f933 man: drop mode line in file headers
This is already included in .dir-locals, so we don't need it
in the files themselves.
2018-07-03 01:32:25 +02:00
Zbigniew Jędrzejewski-Szmek fdbbee37d5 man: drop unused <authorgroup> tags from man sources
Docbook styles required those to be present, even though the templates that we
use did not show those names anywhere. But something changed semi-recently (I
would suspect docbook templates, but there was only a minor version bump in
recent years, and the changelog does not suggest anything related), and builds
now work without those entries. Let's drop this dead weight.

Tested with F26-F29, debian unstable.

$ perl -i -0pe 's/\s*<authorgroup>.*<.authorgroup>//gms' man/*xml
2018-06-14 12:22:18 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Lennart Poettering 052c59c3d0 man: don't refer to "service manager" in tmpfiles.d(5)
system-tmpfiles is not a "service manager" hence say "command" instead.
2018-05-29 11:39:15 +02:00
Lennart Poettering b294e5943f core: introduce specifiers for /tmp and /var/tmp
This corresponds nicely with the specifiers we already pass for
/var/lib, /var/cache, /run and so on.

This is particular useful to update the test-path service files to
operate without guessable files, thus allowing multiple parallel
test-path invocations to pass without issues (the idea is to set $TMPDIR
early on in the test to some private directory, and then only use the
new %T or %V specifier to refer to it).
2018-05-29 11:39:15 +02:00
Lennart Poettering 709f4c472c man: sort specifier list in systemd.unit(5) alphabetically
Usually, we order our settings in our unit files in a logical order,
grouping related settings together, and putting more relevant stuff
first, instead of following a strictly alphabetical order.

For specifiers I think it makes sense to follow an alphabetical order
however, since they literally are just characters, and hence I think the
concept of alphabetical ordering is much more commanding for them. Also,
since specifiers are usually not used in combination, but mostly used
indepdently of each other I think it's not that important to group
similar ones together.

No other changes except the reordering.
2018-05-29 11:39:15 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Lucas Werkmeister 662b3e5861 man: document meaning of age in tmpfiles.d (#8092)
This documents how the age of a file is determined, which previously was
only alluded to in other parts of the documentation. Fixes #8091.

The phrasings of “last modification timestamp” etc. are taken from
man:inode(7) (as of man-pages 4.14). The debug messages in tmpfiles.c
use different messages (“modify time”), which according to a code
comment follow man:stat(1); however, my copy of that manpage (from GNU
coreutils 8.29) documents %y as “time of last data modification”
instead.
2018-02-05 08:19:09 +01:00
Lennart Poettering 49e87292dc tmpfiles: make "f" lines behaviour match what the documentation says
CHANGE OF BEHAVIOUR — with this commit "f" line's behaviour is altered
to match what the documentation says: if an "argument" string is
specified it is written to the file only when the file didn't exist
before. Previously, it would be appended to the file each time
systemd-tmpfiles was invoked — which is not a particularly useful
behaviour as the tool is not idempotent then and the indicated files
grow without bounds each time the tool is invoked.

I did some spelunking whether this change in behaviour would break
things, but afaics nothing relies on the previous O_APPEND behaviour of
this line type, hence I think it's relatively safe to make "f" lines
work the way the docs say, rather than adding a new modifier for it or
so.

Triggered by:

https://lists.freedesktop.org/archives/systemd-devel/2018-January/040171.html
2018-01-24 10:54:10 +01:00
Lennart Poettering 7fa1074831 tmpfiles: create parent directories if they are missing for more line types
Currently, we create leading directories implicitly for all lines that
create directory or directory-like nodes.

With this, we also do the same for a number of other lines: f/F, C, p,
L, c/b (that is regular files, pipes, symlinks, device nodes as well as
file trees we copy).

The leading directories are created with te default access mode of 0755.
If something else is desired, users should simply declare appropriate
"d" lines.

Fixes: #7853
2018-01-23 21:19:00 +01:00
Zbigniew Jędrzejewski-Szmek 1655cdee04 man: fix example formatting in systemd.preset
Repeating "example" everywhere was not useful, so remove
that and improve the formatting a bit.
2018-01-20 10:37:34 +11:00
Zbigniew Jędrzejewski-Szmek 5a8575ef01 tmpfiles: also add %t/%S/%C/%L specifiers
sd_path_home() returns ENXIO when a variable (such as $XDG_RUNTIME_DIR) is not
defined. Previously we used ENOKEY for unresolvable specifiers. To avoid having
two codes, or translating ENXIO to ENOKEY, I replaced ENOKEY use with ENXIO.

v2:
- use sd_path_home and change to ENXIO everywhere
2017-12-06 10:30:26 +01:00
Zbigniew Jędrzejewski-Szmek f2b5ca0e4e tmpfiles: add --user switch 2017-12-06 10:19:29 +01:00
ayekat ca23eeb54c tmpfiles: Add specifiers to allow running as user instance
This commit adds specifiers %U, %u and %h for the user UID, name and
home directory, respectively.

[zj: drop untrue copy-pasted comments and move the next text
     to the new "Specifiers" section.
     Now that #7444 has been merged, also drop the specifier functions.]
2017-12-06 10:19:22 +01:00
Zbigniew Jędrzejewski-Szmek 751223fecf Fail on unknown (alphanumerical) specifiers
The code intentionally ignored unknown specifiers, treating them as text. This
needs to change because otherwise we can never add a new specifier in a backwards
compatible way. So just treat an unknown (potential) specifier as an error.

In principle this is a break of backwards compatibility, but the previous
behaviour was pretty much useless, since the expanded value could change every
time we add new specifiers, which we do all the time.

As a compromise for backwards compatibility, only fail on alphanumerical
characters. This should cover the most cases where an unescaped percent
character is used, like size=5% and such, which behave the same as before with
this patch. OTOH, this means that we will not be able to use non-alphanumerical
specifiers without breaking backwards compatibility again. I think that's an
acceptable compromise.

v2:
- add NEWS entry

v3:
- only fail on alphanumerical
2017-12-06 10:17:37 +01:00
Zbigniew Jędrzejewski-Szmek 2df36d096d man: specifiers are allow for argument field in tmpfiles 2017-12-01 18:58:54 +01:00
Zbigniew Jędrzejewski-Szmek 572eb058cf Add SPDX license identifiers to man pages 2017-11-19 19:08:15 +01:00
Ansgar Burchardt e80f1a7928 typo: chache → cache (#6864) 2017-09-19 06:48:09 +02:00
Zbigniew Jędrzejewski-Szmek 8165be2edf man: unify titling, fix description of precedence in sysusers.d(5)
Fixes #6639.

(This behaviour of systemd-sysusers is long established, so it's better
to adjust the documentation rather than change the code. If there are any
situations out there where it matters, users must have adjusted to the
current behaviour.)
2017-09-14 11:55:57 +02:00
Lennart Poettering 9b9c30ec75 man: fix example indentation in tmpfiles.d(5) (#6578)
docboc actually copies the indentation 1:1 into the final man page and
that makes the example really weirdly aligned. Let's fix that.
2017-08-26 21:59:21 +09:00
William Douglas b3f5897f6e tmpfiles: Allow create symlink on directories (#6039)
Currently if tmpfiles is run with force on symlink creation but there already
exists a directory at that location, the creation will fail. This change
updates the behavior to remove the directory with rm_fr and then attempts to
create the symlink again.
2017-08-09 17:53:03 +02:00
Yu Watanabe b719b26cb3 man: fix typo (#4615) 2016-11-08 10:51:35 +01:00
Zbigniew Jędrzejewski-Szmek ed7fd549d0 man: add an example how to unconditionally empty a directory (#4570)
It was logical, but not entirely obvious, that 'e' with no arguments does
nothing. Expand the explanation a bit and add an example.

Fixes #4564.
2016-11-08 09:39:10 +01:00
Jakub Wilk b17649ee5e man: fix typos (#4527) 2016-10-31 08:08:08 -04:00
Zbigniew Jędrzejewski-Szmek 0a07667d8d man: provide html links to a bunch of external man pages 2016-08-06 16:39:53 -04:00
Zbigniew Jędrzejewski-Szmek df8dee85da tmpfiles: add new 'e' action which cleans up a dir without creating it
I wanted to add a config line that would empty a directory
without creating it if doesn't exist. Existing actions don't allow
this.

v2: properly add 'e' to needs_glob() and takes_ownership()
2016-04-20 09:00:39 -04:00
Zbigniew Jędrzejewski-Szmek 4b743d679b man: try to explain different actions in tmpfiles a bit better
- do not suggest that vendor configuration files should be in
  /etc, use /usr/lib/tmpfiles.d instead
- split the first example, because the text talked about "needing
  two directories", but then a smack attribute was also set, and
  on a different path, which looked like a typo. Replace that
  with the example from original patch [1] which added 't'.
- fix the example for /var/tmp/abrt. The 'x' line was redundant,
  because /var/tmp/abrt/* is already filtered because "d /var/tmp/abrt"
  overrides "d /var/tmp".

[1] http://permalink.gmane.org/gmane.comp.sysutils.systemd.devel/25051
2016-04-20 09:00:39 -04:00
Jan Synacek b908bb63c4 man/tmpfiles.d: add note about permissions and ownership of symlinks
...because this is might not be obvious.
2016-01-13 08:41:54 +01:00
Jakub Wilk 7f3fdb7f19 man: fix typos 2015-12-26 20:37:17 +01:00
Lennart Poettering 2904e949f2 tmpfiles: create subvolumes for "v", "q", and "Q" only if / is a subvolume
It's not a good idea to create subvolumes for parts of the OS tree (such
as /home, or /var) if the root directory is not a subvolume too. We
shouldn't assume control of "heavier" objects such as subvolumes, if the
originating object (the root directory) is a "light-weight" object, i.e.
a plain directory.

Effectively this means that chroot() environments that are run on a
plain directory do not have to deal with problems around systemd
creating subvolumes that cannot be removed with a simple "rm" anymore.
However, if the chroot manager creates a proper subvolume for such an
environment it will also get further subvolumes placed in there, under
the assumption that the manager understands the concept of subvolumes in
that case.
2015-11-16 15:25:42 +01:00
Jan Engelhardt a8eaaee72a doc: correct orthography, word forms and missing/extraneous words 2015-11-06 13:45:21 +01:00
Jan Engelhardt b938cb902c doc: correct punctuation and improve typography in documentation 2015-11-06 13:00:02 +01:00
kayrus c30c611ce3 Fixed link to chattr man page 2015-11-03 14:39:47 +01:00
Lennart Poettering 5fb13eb51b tmpfiles: introduce "q" and "Q" for creating quota-enabled btrfs subvolumes
This allows us to set up the quota group hierarchy in a reasonable way
on btrfs file systems.
2015-10-22 01:59:25 +02:00
Evgeny Vereshchagin 9d261cbdbe man: tmpfiles.d: add info about age field
The age field applies to lines starting with `v`, `C`, `X` too.
See the function `clean_item` in the file `src/tmpfiles/tmpfiles.c`
2015-10-19 13:34:31 +00:00
Tom Gundersen 12b42c7667 man: revert dynamic paths for split-usr setups
This did not really work out as we had hoped. Trying to do this upstream
introduced several problems that probably makes it better suited as a
downstream patch after all. At any rate, it is not releaseable in the
current state, so we at least need to revert this before the release.

 * by adjusting the path to binaries, but not do the same thing to the
   search path we end up with inconsistent man-pages. Adjusting the search
   path too would be quite messy, and it is not at all obvious that this is
   worth the effort, but at any rate it would have to be done before we
   could ship this.

 * this means that distributed man-pages does not make sense as they depend
   on config options, and for better or worse we are still distributing
   man pages, so that is something that definitely needs sorting out before
   we could ship with this patch.

 * we have long held that split-usr is only minimally supported in order
   to boot, and something we hope will eventually go away. So before we start
   adding even more magic/effort in order to make this work nicely, we should
   probably question if it makes sense at all.
2015-06-18 19:47:44 +02:00
Filipe Brandenburger 681eb9cf2b man: generate configured paths in manpages
In particular, use /lib/systemd instead of /usr/lib/systemd in distributions
like Debian which still have not adopted a /usr merge setup.

Use XML entities from man/custom-entities.ent to replace configured paths while
doing XSLT processing of the original XML files. There was precedent of some
files (such as systemd.generator.xml) which were already using this approach.

This addresses most of the (manual) fixes from this patch:
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/patches/Fix-paths-in-man-pages.patch?h=experimental-220

The idea of using generic XML entities was presented here:
http://lists.freedesktop.org/archives/systemd-devel/2015-May/032240.html

This patch solves almost all the issues, with the exception of:
- Path to /bin/mount and /bin/umount.
- Generic statements about preference of /lib over /etc.

These will be handled separately by follow up patches.

Tested:
- With default configure settings, ran "make install" to two separate
  directories and compared the output to confirm they matched exactly.
- Used a set of configure flags including $CONFFLAGS from Debian:
  http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/tree/debian/rules
  Installed the tree and confirmed the paths use /lib/systemd instead of
  /usr/lib/systemd and that no other unexpected differences exist.
- Confirmed that `make distcheck` still passes.
2015-05-28 19:28:19 +02:00
Lennart Poettering 6d785b6d07 man: elaborate on the order by which tmpfiles operations are executed 2015-04-22 18:24:47 +02:00
Lennart Poettering 1ae705fb3d man: slightly fewer paragraphs can help readability 2015-04-13 15:23:53 +02:00
Lennart Poettering bd1100898d man: fix examples indentation in tmpfiles.d(5) 2015-04-13 15:23:52 +02:00
Lennart Poettering 0ac0b1e720 man: add information about more lines to explanation of argument field 2015-04-13 15:23:52 +02:00
Lennart Poettering 6a9171d2ec man: document which tmpfiles line types follow symlinks
Generally, we will not follow symlinks, except for "w".

Avoid documentation for now for fifo, device node, directory lines,
which currently follow symlinks but better shouldn't.
2015-04-13 15:23:52 +02:00
Goffredo Baroncelli fa3f5fd2d3 man: add h/H to tmpfiles.d(5) 2015-03-19 22:23:01 -04:00
daurnimator 657cf7f4f8 tmpfiles: port to unquote_many_words() 2015-03-10 16:08:20 +01:00
Zbigniew Jędrzejewski-Szmek 00c53f4283 man: explain time units in tmpfiles
https://bugzilla.redhat.com/show_bug.cgi?id=1195294
2015-02-23 20:08:05 -05:00