Commit e27b77c9 authored by Martin Pitt's avatar Martin Pitt
Browse files

Allow specifying an alternate /etc/machine-id location

Add d/p/Add-env-variable-for-machine-ID-path.patch. This is necessary for
running tests as long as it isn't in our base images (see Debian #745876)
parent 3d291be8
......@@ -2,6 +2,9 @@ systemd (215-6) UNRELEASED; urgency=medium
* Cherry-pick upstream patch to fix udev crash in link_config_get().
* Cherry-pick upstream patch to fix tests in limited schroot environments.
* Add d/p/Add-env-variable-for-machine-ID-path.patch: Allow specifying an
alternate /etc/machine-id location. This is necessary for running tests
as long as it isn't in our base images (see Debian #745876)
-- Martin Pitt <mpitt@debian.org> Sun, 12 Oct 2014 17:29:00 +0200
......
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Sat, 26 Apr 2014 23:15:34 +0200
Subject: Add env variable for machine ID path
During package build, in minimal chroots, or other systems which do not already
have an /etc/machine-id we get six test failures. Introduce a
$SYSTEMD_MACHINE_ID_PATH environment variable which can specify a location
other than /etc/machine-id, so that the unit tests are independent from the
environment.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=62344
---
src/libsystemd/sd-id128/sd-id128.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/libsystemd/sd-id128/sd-id128.c b/src/libsystemd/sd-id128/sd-id128.c
index a1e44e6..1ee1e21 100644
--- a/src/libsystemd/sd-id128/sd-id128.c
+++ b/src/libsystemd/sd-id128/sd-id128.c
@@ -111,6 +111,7 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
ssize_t k;
unsigned j;
sd_id128_t t;
+ const char *machine_id_path;
assert_return(ret, -EINVAL);
@@ -119,7 +120,10 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
return 0;
}
- fd = open("/etc/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY);
+ machine_id_path = getenv("SYSTEMD_MACHINE_ID_PATH");
+ if (machine_id_path == NULL)
+ machine_id_path = "/etc/machine-id";
+ fd = open(machine_id_path, O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (fd < 0)
return -errno;
......@@ -157,3 +157,4 @@ buildsys-Don-t-default-to-gold-as-the-linker.patch
sd-bus-Accept-no-sender-as-the-destination-field.patch
login-don-t-overmount-run-user-UID-on-upgrades.patch
udev-re-enable-mount-propagation-for-udevd.patch
Add-env-variable-for-machine-ID-path.patch
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment