summaryrefslogtreecommitdiff
path: root/src/nspawn/nspawn-util.c
Commit message (Collapse)AuthorAgeFilesLines
* nspawn: port over basename() → path_extract_filename()Lennart Poettering2022-12-231-1/+5
|
* meson: install libsystemd-shared into rootpkglibdirMichael Biebl2022-06-071-1/+4
| | | | | | | | | | | | | | | | | Introduce rootpkglibdir for installing libsystemd-{shared,core}.so. The benefit over using rootlibexecdir is that this path can be multiarch aware, i.e. this path can be architecture qualified. This is something we'd like to make use of in Debian/Ubuntu to make libsystemd-shared co-installable, e.g. for i386 the path would be /usr/lib/i386-linux-gnu/systemd/libsystemd-shared-*.so and for amd64 /usr/lib/x86_64-linux-gnu/systemd/libsystemd-shared-*.so. This will allow for example to install and run systemd-boot/i386 on an amd64 host. It also simplifies/enables cross-building/bootstrapping. For more infos about Multi-Arch see https://wiki.debian.org/Multiarch. See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990547
* test-nspawn-util: fix the test to actually find anythingZbigniew Jędrzejewski-Szmek2022-04-071-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We would use a relative path, looking for globs like 'lib/systemd/libsystemd-shared-*.so' under the build directory, and never find anything. The test was supposed to find library in the current installation. But we cannot assume that the right library is installed, so the test only printed the result for manual inspection. Thus nobody noticed when it broke. I think it broke in c6134d3e2f1d1d17b32b6e06556cd0c5429bc78a, path-util: get rid of prefix_root(). But that commit doesn't compile because of changes in meson, so this is just a guess. Before: /* test_systemd_installation_has_version */ Current installation has systemd >= 0: no Current installation has systemd >= 231: no Current installation has systemd >= 249: no Current installation has systemd >= 999: no With the fix: $ build/test-nspawn-util /* test_systemd_installation_has_version */ Found libsystemd shared at "/lib/systemd/libsystemd-shared-245.so.so", version 245 (OK). Current installation has systemd >= 0: yes Found libsystemd shared at "/lib/systemd/libsystemd-shared-245.so.so", version 245 (OK). Current installation has systemd >= 231: yes Found libsystemd shared at "/lib/systemd/libsystemd-shared-245.so.so", version 245 (too old). Found libsystemd shared at "/lib/systemd/libsystemd-shared-251.so.so", version 251 (OK). Current installation has systemd >= 251: yes Found libsystemd shared at "/lib/systemd/libsystemd-shared-245.so.so", version 245 (too old). Found libsystemd shared at "/lib/systemd/libsystemd-shared-251.so.so", version 251 (too old). Found libsystemd shared at "/lib/systemd/libsystemd-shared-250.so.so", version 250 (too old). Found libsystemd shared at "/usr/lib/systemd/libsystemd-shared-245.so.so", version 245 (too old). Found libsystemd shared at "/usr/lib/systemd/libsystemd-shared-251.so.so", version 251 (too old). Found libsystemd shared at "/usr/lib/systemd/libsystemd-shared-250.so.so", version 250 (too old). Current installation has systemd >= 999: no $ build/test-nspawn-util /var/lib/machines/rawhide /* test_systemd_installation_has_version */ /* test_systemd_installation_has_version */ Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (OK). /var/lib/machines/rawhide has systemd >= 0: yes Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (OK). /var/lib/machines/rawhide has systemd >= 231: yes Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (OK). /var/lib/machines/rawhide has systemd >= 251: yes Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (too old). Found libsystemd shared at "/var/lib/machines/rawhide/usr/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251 (too old). /var/lib/machines/rawhide has systemd >= 999: no While at it, NULSTR_FOREACH → FOREACH_STRING.
* nspawn: fix comparisons of versions with non-numerical suffixesZbigniew Jędrzejewski-Szmek2022-04-071-14/+7
| | | | | | | | | | | | | | | | | | | | | | See a2b0cd3f5ab3f450e74e2085ad20372a05451c74. When -Dshared-lib-tag is used, libsystemd-shared.so and libsystemd-core.so get a suffix which breaks the parsing done by systemd_installation_has_version(). We can assume that the tag will be something like "251-rc1-1.fc37" that is currently used in Fedora. (Anything that does *not* start with the version would be completely crazy.) By switching to strverscmp_improved() we simplify the code and fix comparisons with such versions. $ build/test-nspawn-util /var/lib/machines/rawhide ... Found libsystemd shared at "/var/lib/machines/rawhide/lib/systemd/libsystemd-shared-251-rc1-1.fc37.so.so", version 251-rc1-1.fc37 (OK). /var/lib/machines/rawhide has systemd >= 251: yes ... I noticed this when I started a systemd-nspawn container with Redora rawhide and got the message "Not running with unified cgroup hierarchy, LSM BPF is not supported". I thought the message is in error, but it was actually correct: nspawn was misdetecting that the container does not sport new-enough systemd to support cgroups-v2.
* Move systemd_installation_has_version() to src/nspawn/Zbigniew Jędrzejewski-Szmek2022-04-071-0/+78
This function implements a heuristic that is only used by nspawn. It doesn't belong in basic. I opted for a new file "nspawn-utils.c", because it seems likely that we'll need some other new utilities like that in the future. No functional change.