1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

60905 Commits

Author SHA1 Message Date
Daan De Meyer
14697c4156 repart: Add Minimize= integration test 2022-11-14 13:06:17 +01:00
Daan De Meyer
c4a87b76c3 repart: Take into account minimal filesystem size
Instead of requiring users to guess the required space for partitions
populated with CopyFiles=, let's make an educated guess ourselves. We
can populate the filesystem once in a very large sparse file and see
how much data is actually used as a good indicator of the required size.
2022-11-11 14:33:19 +01:00
Daan De Meyer
b262cbe871 repart: Use ULL for all size constants 2022-11-11 13:49:50 +01:00
Daan De Meyer
585c5c756f repart: Allow custom root directory per copy blocks source
Preparation for the next commit
2022-11-11 13:49:50 +01:00
Daan De Meyer
a7f1f7d8c1 repart: Don't log partition number when populating filesystem
This might not be known yet so let's use the filesystem itself
instead.
2022-11-11 13:49:50 +01:00
Daan De Meyer
7c17515203 repart: Create loop device when populating filesystems if needed 2022-11-11 13:49:49 +01:00
Daan De Meyer
143c3c08d7 repart: Move fstype_is_ro() checks out of the populate functions
Preparation for the next commit.
2022-11-11 13:49:22 +01:00
Daan De Meyer
78b66c027e resize-fs: Bump xfs minimum partition size to 16MB
14MB leads to errors in mkfs.xfs when running repart.
2022-11-11 13:48:21 +01:00
Daan De Meyer
8bbbdfd788 repart: Calculate filesystem UUID earlier 2022-11-11 13:48:21 +01:00
Daan De Meyer
81427d0fd2 repart: Use COPY_HOLES more 2022-11-11 13:48:21 +01:00
Daan De Meyer
8c467ee8ef repart: Use COPY_REFLINK in context_copy_blocks()
We might be copying between files without a loop device involved.
In that case, a reflink is possible and will be much faster.
2022-11-11 13:47:47 +01:00
Daan De Meyer
a673b0568b repart: Use copy_bytes() instead of copy_bytes_full() 2022-11-11 13:47:47 +01:00
Daan De Meyer
46fddd8eb6
Merge pull request #24803 from DaanDeMeyer/repart-copy-deny-list
repart: Don't descend into directories assigned to other partitions
2022-11-11 13:19:58 +01:00
Yu Watanabe
b27c803601
Merge pull request #25328 from poettering/vertical-tables
format-table: add concept of "vertical" table
2022-11-11 15:18:12 +09:00
Luca Boccassi
021397f776
Merge pull request #25325 from yuwata/resolve-cap-per-link-setting-by-global
resolve: provide effective mDNS or LLMNR settings
2022-11-10 23:20:40 +01:00
Lennart Poettering
31a19acf82 timedatectl: port to new 'vertical' table type 2022-11-10 23:11:17 +01:00
Lennart Poettering
37a50123fa resolvectl: port to new 'vertical' table type 2022-11-10 23:10:37 +01:00
Lennart Poettering
8e07db64a0
Merge pull request #25261 from poettering/dissec-uuid
systemd-dissect: show image UUID in output
2022-11-10 23:10:17 +01:00
Lennart Poettering
858409499c resolvectl: fail properly if we can't append to table 2022-11-10 23:09:56 +01:00
Lennart Poettering
c6bf9dff3a format-table: add an explicit "vertical" mode
Originally, the table formatting code was written to display a number of
records, one per line, and within each line multiple fields of the same
record. The first line contains the column names.

It was then started to be used in a "vertical" mode however,
i.e. with field names on the left instead of the top. Let's support such
a mode explicitly, so that we can provide systematic styling, and can
properly convert this mode to JSON.

A new constructor "table_new_vertical()" is added creating such
"vertical" tables. Internally, this is a table with two columns: "key"
and "value". When outputting this as JSON we'll output a single JSON
object, with key/value as fields. (Which is different from the
traditional output where we'd use the first line as JSON field names,
and output an array of objects).

A new cell type TABLE_FIELD is added for specifically marking the
"field" cells, i.e. the cells in the first column. We'll automatically
suffic ":" to these fields on output.
2022-11-10 23:09:18 +01:00
Yu Watanabe
251dc2f14b meson: install systemd-ac-power under /usr/bin
And test the its help message.

The program is useful for e.g. scripts that conditionalize their tasks
to be invoked only when running on AC power.
2022-11-10 23:04:23 +01:00
Lennart Poettering
0b556555c2 update TODO 2022-11-10 22:19:42 +01:00
Ricky Tigg
0529f580ee po: Translated using Weblate (Finnish)
Currently translated at 100.0% (193 of 193 strings)

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fi/
Translation: systemd/main
2022-11-10 20:36:28 +01:00
Lennart Poettering
63b130a6fc test: add quick test for ensuring image UUID is deterministic based on the seed passed to repart 2022-11-10 17:33:51 +01:00
Lennart Poettering
71ea84369e locale: honour new env var $SYSTEMD_UTF8=
This is useful to force off fancy unicode glyph use (i.e. use "->"
instead of "→"), which is useful in tests where locales might be
missing, and thus control via $LC_CTYPE is not reliable.

Use this in TEST-58, to ensure the output checks we do aren't confused
by missing these glyphs being unicode or not.
2022-11-10 17:20:36 +01:00
Daan De Meyer
bd69c2a85f repart: Add integration test for #24678 2022-11-10 16:40:33 +01:00
Daan De Meyer
c0fad2d9b6 repart: Don't descend into directories assigned to other partitions
Let's say we have the following repart definitions files root.conf
and home.conf:

```
[Partition]
Type=root
CopyFiles=/
```

```
[Partition]
Type=home
CopyFiles=/home
```

Currently, we'd end up copying /home to both the root partition and
the home partition. To prevent this from happening, let's adopt a
new policy when copying files for a partition: We won't copy any
files/directories that appear in the CopyFiles= list of another
partition, unless that directory explicitly appears in our own
CopyFiles= list.

This way, we prevent copying /home twice into the root and home
partition, but should a user really want that behavior, they can
have it by adding /home to the CopyFIles= list of the root partition
as well.
2022-11-10 16:40:33 +01:00
Daan De Meyer
58b4ad76ca gpt: Add gpt_partition_type_mountpoint_nulstr() 2022-11-10 16:40:33 +01:00
Daan De Meyer
dd8940235f gpt: Replace bitfields with designator field in GptPartitionType
To achieve this we move the PartitionDesignator enum from
dissect-image.h to gpt.h
2022-11-10 16:40:33 +01:00
Daan De Meyer
a424958aa6 copy: Support passing a deny list of files/directories to not copy 2022-11-10 16:40:31 +01:00
Lennart Poettering
5db8b0bcad dissect: make image name bold 2022-11-10 16:00:59 +01:00
Lennart Poettering
b387778c5b dissect: also parse out the top-level GPT table uuid and expose this as image UUID
systemd-repart generates this in a suitably stable fashion, hence let's
actually use it as an identifier for the image. As a first step parse
it, and show it.
2022-11-10 16:00:59 +01:00
Lennart Poettering
9bc4156cdf json: add build helpers to insert id128 in uuid formatting into json object 2022-11-10 16:00:59 +01:00
Lennart Poettering
9df82722f6 update TODO 2022-11-10 15:59:58 +01:00
Daan De Meyer
ddfdf86f81 stat-util: Move inode_hash_ops to stat-util
TO make it usable in other code.
2022-11-10 15:59:18 +01:00
Yu Watanabe
b77899af0d test: add tests for mDNS and LLMNR settings 2022-11-10 21:54:56 +09:00
Yu Watanabe
e4b3f0dfe9 test: create config under /run 2022-11-10 21:54:56 +09:00
Yu Watanabe
c38a03df4a resolvectl: warn if the global mDNS or LLMNR support level is lower than the requested one 2022-11-10 21:54:56 +09:00
Yu Watanabe
dc167037c4 resolve: provide effective supporting levels of mDNS and LLMNR
The per-link settings are ignored if the feature is disabled by the global setting.
Let's announce the effective level, to make not users confused.

Closes #24863.
2022-11-10 21:54:56 +09:00
Yu Watanabe
bce459e327 resolve: introduce link_get_llmnr_support() and link_get_mdns_support() 2022-11-10 21:54:18 +09:00
Yu Watanabe
f6e4aa7b03 resolve: drop redundant call of socket_ipv6_is_supported()
As link_relevant() is called with AF_INET6, which returns true only when
the link has at least one relevant IPv6 address.
2022-11-10 21:46:36 +09:00
Cristian Rodríguez
afd8e1d945 build: Use -fstrict-flex-arrays=1 if supported
Due to "historical reasons" both gcc and clang treat *all* trailing
arrays members as flexible arrays, this has an evil side effect
of inhibiting bounds checks on such members as __builtin_object_size
cannot say for sure that:

struct {
...
type foo[3];
}

has a trailing foo member of fixed size rather than unspecified.

Ideally we should use -fstrict-flex-arrays as is, but we have to
tolerate kernel uapi headers that use [0] and third party libraries
written in c89 that may use [1] like curl.
2022-11-10 21:07:59 +09:00
Yu Watanabe
7618ab1b71 test-network: skip test_match if alternative name is not supported by kernel
Fixes #25259.
2022-11-10 10:05:43 +00:00
Luca Boccassi
741504aa17
Merge pull request #24813 from DaanDeMeyer/at-all-the-things
Add more openat() style variants for existing stuff
2022-11-10 10:57:14 +01:00
Luca Boccassi
84fe5182d5
Merge pull request #25315 from poettering/dissect-mtree
dissect: add new --mtree switch to generate BSD comaptible mtree manifests of DDIs
2022-11-10 10:44:27 +01:00
Frantisek Sumsal
a92401d558
Merge pull request #25280 from keszybz/initrd-with-overlayfs
Initrd with overlayfs
2022-11-10 08:22:15 +00:00
Zbigniew Jędrzejewski-Szmek
a940f507fb pid1: skip cleanup if root is not tmpfs/ramfs
in_initrd() was really doing two things: checking if we're in the initrd, and
also verifying that the initrd is set up correctly. But this second check is
complicated, in particular it would return false for overlayfs, even with an
upper tmpfs layer. It also doesn't support the use case of having an initial
initrd with tmpfs, and then transitioning into an intermediate initrd that is
e.g. a DDI, i.e. a filesystem possibly with verity arranged as a disk image.

We don't need to check if we're in initrd in every program. Instead, concerns
are separated:
- in_initrd() just does a simple check for /etc/initrd-release.
- When doing cleanup, pid1 checks if it's on a tmpfs before starting to wipe
  the old root. The only case where we want to remove the old root is when
  we're on a plain tempory filesystem. With an overlay, we'd be creating
  whiteout files, which is not very useful. (*)

This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=2137631
which is caused by systemd refusing to treat the system as an initrd because
overlayfs is used.

(*) I think the idea of keeping the initrd fs around for shutdown is outdated.
We should just have a completely separate exitrd that is unpacked when we want
to shut down. This way, we don't waste memory at runtime, and we also don't
transition to a potentially older version of systemd. But we don't have support
for this yet.

This replaces 0fef5b0f0b.
2022-11-09 22:44:23 +01:00
Zbigniew Jędrzejewski-Szmek
3ed332e77a test-fd-util: fix typos and use log_tests_skipped() 2022-11-09 22:44:23 +01:00
Lennart Poettering
baf6c93296 test: add trivial test for systemd-dissect --mtree 2022-11-09 22:20:51 +01:00
Lennart Poettering
b5b40106c7 man: document new systemd-dissect --mtree switch 2022-11-09 22:20:51 +01:00