mirror of
https://github.com/systemd/systemd
synced 2026-03-26 08:44:55 +01:00
Compare commits
11 Commits
9b42cc3b12
...
af80c9c224
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af80c9c224 | ||
|
|
2abb433ca1 | ||
|
|
1e5498e237 | ||
|
|
7cfd4f3f51 | ||
|
|
50482aced5 | ||
|
|
a28ed65f4c | ||
|
|
28c68dbea0 | ||
|
|
3d64cb9a54 | ||
|
|
abf73cb072 | ||
|
|
57f911973a | ||
|
|
f40bd7af20 |
20
meson.build
20
meson.build
@ -659,10 +659,6 @@ foreach prog : progs
|
||||
conf.set_quoted(name, path)
|
||||
endforeach
|
||||
|
||||
if run_command(ln, '--relative', '--help', check : false).returncode() != 0
|
||||
error('ln does not support --relative (added in coreutils 8.16)')
|
||||
endif
|
||||
|
||||
#####################################################################
|
||||
|
||||
gperf_test_format = '''
|
||||
@ -779,7 +775,13 @@ if time_epoch <= 0
|
||||
if time_epoch == ''
|
||||
NEWS = files('NEWS')
|
||||
time_epoch = run_command(stat, '-c', '%Y', NEWS,
|
||||
check : true).stdout()
|
||||
check : false)
|
||||
if time_epoch.returncode() != 0
|
||||
# If the above fails, maybe the stat(1) uses BSD-style syntax
|
||||
time_epoch = run_command(stat, '-f', '%m', NEWS,
|
||||
check : true)
|
||||
endif
|
||||
time_epoch = time_epoch.stdout()
|
||||
endif
|
||||
time_epoch = time_epoch.strip().to_int()
|
||||
endif
|
||||
@ -3026,8 +3028,12 @@ if conf.get('ENABLE_HWDB') == 1
|
||||
alias_target('hwdb', auto_suspend_rules, executables_by_name.get('systemd-hwdb'), hwdb_units)
|
||||
endif
|
||||
|
||||
alt_time_epoch = run_command('date', '-Is', '-u', '-d', f'@@time_epoch@',
|
||||
check : true).stdout().strip()
|
||||
alt_time_epoch = run_command('date', '-Is', '-u', '-d', f'@@time_epoch@', check : false)
|
||||
if alt_time_epoch.returncode() != 0
|
||||
# If the above fails, maybe the date(1) uses BSD-style syntax
|
||||
alt_time_epoch = run_command('date', '-Iseconds', '-u', '-r', f'@time_epoch@', check : true)
|
||||
endif
|
||||
alt_time_epoch = alt_time_epoch.stdout().strip()
|
||||
|
||||
summary({
|
||||
'split bin-sbin' : split_bin,
|
||||
|
||||
@ -91,7 +91,7 @@ _portablectl() {
|
||||
elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
|
||||
comps=''
|
||||
elif __contains_word "$verb" ${VERBS[IMAGE]}; then
|
||||
if [[ $n == 1 ]]; then
|
||||
if [[ $n == 1 ]] || [[ "$prev" = -* ]] || __contains_word "${COMP_WORDS[COMP_CWORD-2]}" ${OPTS[ARG]}; then
|
||||
comps=$( compgen -A file -- "$cur" )
|
||||
compopt -o filenames
|
||||
else
|
||||
@ -101,10 +101,10 @@ _portablectl() {
|
||||
comps=$( compgen -A file -- "$cur" )
|
||||
compopt -o filenames
|
||||
elif __contains_word "$verb" ${VERBS[IMAGE_WITH_BOOL]}; then
|
||||
if [[ $n == 1 ]]; then
|
||||
if [[ $n == 1 ]] || [[ "$prev" = -* ]] || __contains_word "${COMP_WORDS[COMP_CWORD-2]}" ${OPTS[ARG]}; then
|
||||
comps=$( compgen -A file -- "$cur" )
|
||||
compopt -o filenames
|
||||
elif [[ $n == 2 ]]; then
|
||||
elif ! __contains_word "$prev" "yes" "no" && { [[ $n == 2 ]] || [[ "$prev" != -* ]]; }; then
|
||||
comps='yes no'
|
||||
else
|
||||
comps=''
|
||||
|
||||
@ -49,14 +49,26 @@
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="GetImageMetadata"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="GetImageMetadataWithExtensions"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="GetImageState"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="GetImageStateWithExtensions"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="AttachImage"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="AttachImageWithExtensions"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="DetachImage"/>
|
||||
@ -65,6 +77,10 @@
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="ReattachImage"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="ReattachImageWithExtensions"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Manager"
|
||||
send_member="RemoveImage"/>
|
||||
@ -91,22 +107,42 @@
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="GetMetadata"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="GetMetadataWithExtensions"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="GetState"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="GetStateWithExtensions"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="Attach"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="AttachWithExtensions"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="Detach"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="DetachWithExtensions"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="Reattach"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="ReattachWithExtensions"/>
|
||||
|
||||
<allow send_destination="org.freedesktop.portable1"
|
||||
send_interface="org.freedesktop.portable1.Image"
|
||||
send_member="Remove"/>
|
||||
|
||||
@ -283,7 +283,7 @@ static int verify_fsroot_dir(
|
||||
|
||||
r = path_extract_filename(path, &f);
|
||||
if (r < 0 && r != -EADDRNOTAVAIL)
|
||||
return log_error_errno(r, "Failed to extract filename of %s: %m", path);
|
||||
return log_error_errno(r, "Failed to extract filename of \"%s\": %m", path);
|
||||
|
||||
if (statx(dir_fd, strempty(f),
|
||||
AT_SYMLINK_NOFOLLOW|(isempty(f) ? AT_EMPTY_PATH : 0),
|
||||
@ -292,7 +292,8 @@ static int verify_fsroot_dir(
|
||||
(unprivileged_mode && ERRNO_IS_PRIVILEGE(errno)) ? LOG_DEBUG : LOG_ERR, errno,
|
||||
"Failed to determine block device node of \"%s\": %m", path);
|
||||
|
||||
assert(S_ISDIR(sxa.stx_mode)); /* We used O_DIRECTORY above, when opening, so this must hold */
|
||||
if (!S_ISDIR(sxa.stx_mode))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ENOTDIR), "Path \"%s\" is not a directory", path);
|
||||
|
||||
if (FLAGS_SET(sxa.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT)) {
|
||||
|
||||
@ -375,13 +376,13 @@ static int verify_esp(
|
||||
|
||||
r = path_extract_filename(p, &f);
|
||||
if (r < 0 && r != -EADDRNOTAVAIL)
|
||||
return log_error_errno(r, "Failed to extract filename of %s: %m", p);
|
||||
return log_error_errno(r, "Failed to extract filename of \"%s\": %m", p);
|
||||
|
||||
/* Trigger any automounts so that xstatfsat() operates on the mount instead of the mountpoint
|
||||
* directory. */
|
||||
r = trigger_automount_at(pfd, f);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to trigger automount at %s: %m", p);
|
||||
return log_error_errno(r, "Failed to trigger automount at \"%s\": %m", p);
|
||||
|
||||
r = xstatfsat(pfd, strempty(f), &sfs);
|
||||
if (r < 0)
|
||||
@ -481,12 +482,12 @@ int find_esp_and_warn_at(
|
||||
|
||||
if (!path_is_valid(path) || !path_is_absolute(path))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"$SYSTEMD_ESP_PATH does not refer to an absolute path, refusing to use it: %s",
|
||||
"$SYSTEMD_ESP_PATH does not refer to an absolute path, refusing to use it: \"%s\"",
|
||||
path);
|
||||
|
||||
r = chaseat(rfd, path, CHASE_AT_RESOLVE_IN_ROOT|CHASE_TRIGGER_AUTOFS, &p, &fd);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to resolve path %s: %m", path);
|
||||
return log_error_errno(r, "Failed to resolve path \"%s\": %m", path);
|
||||
|
||||
/* Note: when the user explicitly configured things with an env var we won't validate the
|
||||
* path beyond checking it refers to a directory. After all we want this to be useful for
|
||||
@ -833,12 +834,12 @@ int find_xbootldr_and_warn_at(
|
||||
|
||||
if (!path_is_valid(path) || !path_is_absolute(path))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"$SYSTEMD_XBOOTLDR_PATH does not refer to an absolute path, refusing to use it: %s",
|
||||
"$SYSTEMD_XBOOTLDR_PATH does not refer to an absolute path, refusing to use it: \"%s\"",
|
||||
path);
|
||||
|
||||
r = chaseat(rfd, path, CHASE_AT_RESOLVE_IN_ROOT|CHASE_TRIGGER_AUTOFS, &p, &fd);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to resolve path %s: %m", p);
|
||||
return log_error_errno(r, "Failed to resolve path \"%s\": %m", p);
|
||||
|
||||
if (fstat(fd, &st) < 0)
|
||||
return log_error_errno(errno, "Failed to stat '%s': %m", p);
|
||||
|
||||
@ -198,6 +198,11 @@ def get_zboot_kernel(f: IO[bytes]) -> bytes:
|
||||
elif comp_type.startswith(b'xzkern'):
|
||||
raise NotImplementedError('xzkern decompression not implemented')
|
||||
elif comp_type.startswith(b'zstd'):
|
||||
try:
|
||||
zstd = try_import('compression.zstd')
|
||||
data = f.read(size)
|
||||
return cast(bytes, zstd.zstd.ZstdDecompressor().decompress(data))
|
||||
except ValueError:
|
||||
zstd = try_import('zstandard')
|
||||
data = f.read(size)
|
||||
return cast(bytes, zstd.ZstdDecompressor().stream_reader(data).read())
|
||||
@ -230,6 +235,10 @@ def maybe_decompress(filename: Union[str, Path]) -> bytes:
|
||||
return cast(bytes, gzip.open(f).read())
|
||||
|
||||
if start.startswith(b'\x28\xb5\x2f\xfd'):
|
||||
try:
|
||||
zstd = try_import('compression.zstd')
|
||||
return cast(bytes, zstd.zstd.ZstdDecompressor().decompress(f.read()))
|
||||
except ValueError:
|
||||
zstd = try_import('zstandard')
|
||||
return cast(bytes, zstd.ZstdDecompressor().stream_reader(f.read()).read())
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ testcase_user_manager() {
|
||||
}
|
||||
|
||||
testcase_multiple_features() {
|
||||
unsquashfs -no-xattrs -d /tmp/TEST-07-PID1-delegate-namespaces-root /usr/share/minimal_0.raw
|
||||
unsquashfs -force -no-xattrs -d /tmp/TEST-07-PID1-delegate-namespaces-root /usr/share/minimal_0.raw
|
||||
|
||||
systemd-run \
|
||||
-p PrivatePIDs=yes \
|
||||
|
||||
@ -90,7 +90,7 @@ EOF
|
||||
}
|
||||
|
||||
testcase_multiple_features() {
|
||||
unsquashfs -no-xattrs -d /tmp/TEST-07-PID1-private-pids-root /usr/share/minimal_0.raw
|
||||
unsquashfs -force -no-xattrs -d /tmp/TEST-07-PID1-private-pids-root /usr/share/minimal_0.raw
|
||||
|
||||
systemd-run \
|
||||
-p PrivatePIDs=yes \
|
||||
|
||||
@ -17,8 +17,8 @@ if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then
|
||||
ARGS+=(--profile=trusted)
|
||||
fi
|
||||
|
||||
unsquashfs -no-xattrs -d /tmp/minimal_0 /usr/share/minimal_0.raw
|
||||
unsquashfs -no-xattrs -d /tmp/minimal_1 /usr/share/minimal_1.raw
|
||||
unsquashfs -force -no-xattrs -d /tmp/minimal_0 /usr/share/minimal_0.raw
|
||||
unsquashfs -force -no-xattrs -d /tmp/minimal_1 /usr/share/minimal_1.raw
|
||||
|
||||
portablectl "${ARGS[@]}" attach --copy=symlink --now --runtime /tmp/minimal_0 minimal-app0
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ if sysctl kernel.dmesg_restrict=0; then
|
||||
dmesg)
|
||||
fi
|
||||
|
||||
unsquashfs -no-xattrs -d /tmp/img /usr/share/minimal_0.raw
|
||||
unsquashfs -force -no-xattrs -d /tmp/img /usr/share/minimal_0.raw
|
||||
runas testuser systemd-run --wait --user --unit=test-root-dir \
|
||||
-p RootDirectory=/tmp/img \
|
||||
grep MARKER=1 /etc/os-release
|
||||
@ -128,7 +128,7 @@ umount /tmp/img_bind
|
||||
# Unprivileged overlayfs was added to Linux 5.11, so try to detect it first
|
||||
mkdir -p /tmp/a /tmp/b /tmp/c
|
||||
if unshare --mount --user --map-root-user mount -t overlay overlay /tmp/c -o lowerdir=/tmp/a:/tmp/b; then
|
||||
unsquashfs -no-xattrs -d /tmp/app2 /tmp/app1.raw
|
||||
unsquashfs -force -no-xattrs -d /tmp/app2 /tmp/app1.raw
|
||||
runas testuser systemd-run --wait --user --unit=test-extension-dir \
|
||||
-p ExtensionDirectories=/tmp/app2 \
|
||||
-p TemporaryFileSystem=/run -p RootDirectory=/tmp/img \
|
||||
|
||||
@ -704,7 +704,7 @@ grep -q -F "MARKER=1" /tmp/markers/50i
|
||||
systemctl stop testservice-50i.service
|
||||
rm -f /run/systemd/system/testservice-50i.service
|
||||
|
||||
unsquashfs -no-xattrs -d /tmp/vpickminimg "$MINIMAL_IMAGE.raw"
|
||||
unsquashfs -force -no-xattrs -d /tmp/vpickminimg "$MINIMAL_IMAGE.raw"
|
||||
cat >/run/systemd/system/testservice-50j.service <<EOF
|
||||
[Service]
|
||||
Type=notify-reload
|
||||
@ -903,7 +903,7 @@ systemd-confext status
|
||||
systemd-confext unmerge
|
||||
rm -rf /run/confexts/
|
||||
|
||||
unsquashfs -no-xattrs -d /tmp/img "$MINIMAL_IMAGE.raw"
|
||||
unsquashfs -force -no-xattrs -d /tmp/img "$MINIMAL_IMAGE.raw"
|
||||
systemd-run --unit=test-root-ephemeral \
|
||||
-p RootDirectory=/tmp/img \
|
||||
-p RootEphemeral=yes \
|
||||
@ -935,7 +935,7 @@ echo "ARCHITECTURE=_any" >>testkit/usr/lib/extension-release.d/extension-release
|
||||
echo "MARKER_SYSEXT_123" >testkit/usr/lib/testfile
|
||||
mksquashfs testkit/ testkit.raw -noappend
|
||||
cp testkit.raw /run/extensions/
|
||||
unsquashfs -l /run/extensions/testkit.raw
|
||||
unsquashfs -force -l /run/extensions/testkit.raw
|
||||
systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for portable service'
|
||||
systemd-dissect --no-pager /run/extensions/testkit.raw | grep -q '✓ sysext for system'
|
||||
systemd-sysext merge
|
||||
@ -951,7 +951,7 @@ echo "ARCHITECTURE=_any" >>testjob/etc/extension-release.d/extension-release.tes
|
||||
echo "MARKER_CONFEXT_123" >testjob/etc/testfile
|
||||
mksquashfs testjob/ testjob.raw -noappend
|
||||
cp testjob.raw /run/confexts/
|
||||
unsquashfs -l /run/confexts/testjob.raw
|
||||
unsquashfs -force -l /run/confexts/testjob.raw
|
||||
systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for system'
|
||||
systemd-dissect --no-pager /run/confexts/testjob.raw | grep -q '✓ confext for portable service'
|
||||
systemd-confext merge
|
||||
|
||||
@ -8,7 +8,7 @@ ENABLED="$3"
|
||||
|
||||
if ! ((ENABLED)) || ! [[ -d .git ]] || ! command -v git >/dev/null || git describe --tags --exact-match &>/dev/null
|
||||
then
|
||||
sed "$INPUT" -e "s/@VCS_TAG@//"
|
||||
sed -e "s/@VCS_TAG@//" "$INPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -20,4 +20,4 @@ fi
|
||||
|
||||
TAG="-g$(git describe --abbrev=7 --match="" --always $DIRTY)"
|
||||
|
||||
sed "$INPUT" -e "s/@VCS_TAG@/$TAG/"
|
||||
sed -e "s/@VCS_TAG@/$TAG/" "$INPUT"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user