mirror of
https://github.com/systemd/systemd.git
synced 2025-03-21 02:50:18 +03:00
core: copy os-release with COPY_TRUNCATE
Otherwise if the os-release file shrinks between updates, there will be a merge of the two. Also remove redundant ENOENT check. Follow-up for 3f37a82545d461ab
This commit is contained in:
parent
9a441937e1
commit
bf85c2395e
@ -1406,10 +1406,10 @@ static int setup_os_release(RuntimeScope scope) {
|
||||
}
|
||||
|
||||
r = mkdir_parents_label(os_release_dst, 0755);
|
||||
if (r < 0 && r != -EEXIST)
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to create parent directory of %s, ignoring: %m", os_release_dst);
|
||||
|
||||
r = copy_file(os_release_src, os_release_dst, /* open_flags= */ 0, 0644, COPY_MAC_CREATE);
|
||||
r = copy_file(os_release_src, os_release_dst, /* open_flags= */ 0, 0644, COPY_MAC_CREATE|COPY_TRUNCATE);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to create %s, ignoring: %m", os_release_dst);
|
||||
|
||||
|
@ -92,9 +92,9 @@ elif [ -f /run/testsuite82.touch ]; then
|
||||
echo miep >/tmp/nextroot-lower/lower
|
||||
|
||||
# Copy os-release away, so that we can manipulate it and check that it is updated in the propagate
|
||||
# directory across soft reboots.
|
||||
# directory across soft reboots. Try to cover corner cases by truncating it.
|
||||
mkdir -p /tmp/nextroot-lower/usr/lib
|
||||
cp /etc/os-release /tmp/nextroot-lower/usr/lib/os-release
|
||||
grep ID /etc/os-release >/tmp/nextroot-lower/usr/lib/os-release
|
||||
echo MARKER=1 >>/tmp/nextroot-lower/usr/lib/os-release
|
||||
cmp /etc/os-release /run/systemd/propagate/os-release
|
||||
(! grep -q MARKER=1 /etc/os-release)
|
||||
|
Loading…
x
Reference in New Issue
Block a user