mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-18 10:27:00 +02:00
maint(sys-apps/systemd): Cleanup old version.
This commit is contained in:
parent
1a637d2fc9
commit
c2e02f63bd
@ -1,2 +1 @@
|
||||
DIST systemd-211.tar.xz 2664508 SHA256 f278c1ff6f0f0efadf0f7fff01ed6a0ead1a7868b5a9e1baa240e1673e516648 SHA512 fd33920825d0b63bf6e6a583cbfbf44fe577428f5fa6993b659d7f310f8fbdb3f5b22d585818ec4b834fd0703bc5d6bf93e6925e5c391f14ee65f44c0878d5e5 WHIRLPOOL 26205fc02cb13fb8f43c23888d83c31daa676c117a32e65adbc372e8eb974fe7e37f560b85b72abb4cfc832a45a6658858a1cca17a526baa967ba2d95904a448
|
||||
DIST systemd-212.tar.xz 2722692 SHA256 652906b43704fe705cb47757ea9bbbf3c1ab4a1d55ea38b0013a6f2d0863f2c2 SHA512 3e6dac77785cb2f928886886f92cdd11ed00a4db1453699e0102d3ecffa03d1795f44df10239105e4b2b039f0e3e4b5d44c9f876f25c10a6dc4f7e1fbf87c333 WHIRLPOOL 31d1a967435963155c60ca5016f207aa105e9ddcb7d73e9fcde20f7e1fb66701384b81ee01134bf4d75dfa1ea0d412bb352ff11ac6f8c05e836135baf94bbe37
|
||||
|
@ -1,66 +0,0 @@
|
||||
From 2b1ce33baa29bddf5367c0bcfcfb884e36641cc7 Mon Sep 17 00:00:00 2001
|
||||
From: Brandon Philips <brandon@ifup.co>
|
||||
Date: Thu, 20 Mar 2014 11:28:12 -0700
|
||||
Subject: [PATCH] network: dhcp: create explicit host route to gateway
|
||||
|
||||
Some DHCP servers gives you a netmask of 255.255.255.255 so the gateway is not
|
||||
routable. Other DHCP client implementations look through the existing routes to
|
||||
figure out if they should add an explicit host route. See below for a link.
|
||||
|
||||
However, it makes sense to just create the route explicitly whether it is
|
||||
needed or not since it is explicit, makes the dhcp route entries independent of
|
||||
other entries and saves us from knowing the state of the kernel tables.
|
||||
|
||||
The code from dhcpcd that works around this issue is on line 637.
|
||||
https://android.googlesource.com/platform/external/dhcpcd/+/master/configure.c
|
||||
---
|
||||
src/network/networkd-link.c | 26 ++++++++++++++++++++++++++
|
||||
1 file changed, 26 insertions(+)
|
||||
|
||||
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
|
||||
index 275ad97..8077ac7 100644
|
||||
--- a/src/network/networkd-link.c
|
||||
+++ b/src/network/networkd-link.c
|
||||
@@ -237,6 +237,8 @@ static int link_enter_set_routes(Link *link) {
|
||||
|
||||
if (link->dhcp_lease) {
|
||||
_cleanup_route_free_ Route *route = NULL;
|
||||
+ _cleanup_route_free_ Route *route_gw = NULL;
|
||||
+ struct in_addr netmask;
|
||||
struct in_addr gateway;
|
||||
|
||||
r = sd_dhcp_lease_get_router(link->dhcp_lease, &gateway);
|
||||
@@ -253,6 +255,30 @@ static int link_enter_set_routes(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
+ r = route_new_dynamic(&route_gw);
|
||||
+ if (r < 0) {
|
||||
+ log_error_link(link, "Could not allocate route: %s",
|
||||
+ strerror(-r));
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
+ /* The dhcp netmask may mask out the gateway. Add an explicit
|
||||
+ * route for the gw host so that we can route no matter the
|
||||
+ * netmask or existing kernel route tables. */
|
||||
+ route_gw->family = AF_INET;
|
||||
+ route_gw->dst_addr.in = gateway;
|
||||
+ route_gw->dst_prefixlen = 32;
|
||||
+ route_gw->scope = RT_SCOPE_LINK;
|
||||
+
|
||||
+ r = route_configure(route_gw, link, &route_handler);
|
||||
+ if (r < 0) {
|
||||
+ log_warning_link(link,
|
||||
+ "could not set host route: %s", strerror(-r));
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
+ link->route_messages ++;
|
||||
+
|
||||
route->family = AF_INET;
|
||||
route->in_addr.in = gateway;
|
||||
|
||||
--
|
||||
1.8.5.2 (Apple Git-48)
|
||||
|
@ -1,25 +0,0 @@
|
||||
From d6201d7653de28af38f7c84b7280302b512f4ef9 Mon Sep 17 00:00:00 2001
|
||||
From: Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Date: Wed, 12 Mar 2014 19:25:11 +0100
|
||||
Subject: gpt-auto-generator: don't return OOM on parentless devices
|
||||
|
||||
---
|
||||
src/gpt-auto-generator/gpt-auto-generator.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
|
||||
index e487f6438689..19c5eea9de2f 100644
|
||||
--- a/src/gpt-auto-generator/gpt-auto-generator.c
|
||||
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
|
||||
@@ -395,7 +395,7 @@ static int enumerate_partitions(dev_t devnum) {
|
||||
|
||||
parent = udev_device_get_parent(d);
|
||||
if (!parent)
|
||||
- return log_oom();
|
||||
+ return 0;
|
||||
|
||||
/* Does it have a devtype? */
|
||||
devtype = udev_device_get_devtype(parent);
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,28 +0,0 @@
|
||||
From aca07d5e53da1970b31907fc07237800424e84f1 Mon Sep 17 00:00:00 2001
|
||||
From: Brandon Philips <brandon.philips@coreos.com>
|
||||
Date: Thu, 13 Mar 2014 15:19:40 -0700
|
||||
Subject: [PATCH] nspawn: allow -EEXIST on mkdir_safe /home/${uid}
|
||||
|
||||
With systemd 211 nspawn attempts to create the home directory for the
|
||||
given uid. However, if the home directory already exists then it will
|
||||
fail. Don't error out on -EEXIST.
|
||||
---
|
||||
src/nspawn/nspawn.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||
index b637b51..7c3d7b8 100644
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -2543,7 +2543,7 @@ static int change_uid_gid(char **_home) {
|
||||
}
|
||||
|
||||
r = mkdir_safe(home, 0755, uid, gid);
|
||||
- if (r < 0) {
|
||||
+ if (r < 0 && r != -EEXIST) {
|
||||
log_error("Failed to make home directory: %s", strerror(-r));
|
||||
return r;
|
||||
}
|
||||
--
|
||||
1.8.5.2 (Apple Git-48)
|
||||
|
@ -1,29 +0,0 @@
|
||||
From 7bf2f4397255bc8f6cf20a0f2adab4c984ea7d14 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Wed, 19 Mar 2014 10:41:29 +0100
|
||||
Subject: [PATCH] sd-dhcp-client: accept infinite lease lifetime
|
||||
|
||||
Otherwise we would fail with -EINVAL. Thanks to Brandon Philips
|
||||
<brandon.philips@coreos.com>, for reporting the bug.
|
||||
---
|
||||
src/libsystemd-network/sd-dhcp-client.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
|
||||
index 8411141..ce375dd 100644
|
||||
--- a/src/libsystemd-network/sd-dhcp-client.c
|
||||
+++ b/src/libsystemd-network/sd-dhcp-client.c
|
||||
@@ -747,6 +747,10 @@ static int client_set_lease_timeouts(sd_dhcp_client *client, uint64_t usec) {
|
||||
assert(client);
|
||||
assert(client->event);
|
||||
|
||||
+ /* don't set timers for infinite leases */
|
||||
+ if (client->lease->lifetime == 0xffffffff)
|
||||
+ return 0;
|
||||
+
|
||||
if (client->lease->lifetime < 10)
|
||||
return -EINVAL;
|
||||
|
||||
--
|
||||
1.8.5.2 (Apple Git-48)
|
||||
|
@ -1,26 +0,0 @@
|
||||
From d21c038833f621fc4328fdd75decaacdb147c396 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 13 Mar 2014 20:00:50 +0100
|
||||
Subject: bus: fix memory leak when kdbus is not enabled
|
||||
|
||||
---
|
||||
src/libsystemd/sd-bus/sd-bus.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
|
||||
index ffa3369feb37..ca7c428a3162 100644
|
||||
--- a/src/libsystemd/sd-bus/sd-bus.c
|
||||
+++ b/src/libsystemd/sd-bus/sd-bus.c
|
||||
@@ -1189,7 +1189,8 @@ _public_ int sd_bus_open_user(sd_bus **ret) {
|
||||
#ifdef ENABLE_KDBUS
|
||||
asprintf(&b->address, KERNEL_USER_BUS_FMT, (unsigned long) getuid());
|
||||
#else
|
||||
- return -ECONNREFUSED;
|
||||
+ r = -ECONNREFUSED;
|
||||
+ goto fail;
|
||||
#endif
|
||||
}
|
||||
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,181 +0,0 @@
|
||||
From 53776069023eb1ae33acb0ae9ae1a27e8b172c25 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 13 Mar 2014 20:33:22 +0100
|
||||
Subject: sd-bus: don't look for a 64bit value when we only have 32bit value on
|
||||
reply cookie hash table access
|
||||
|
||||
This broke hashtable lookups for the message cookies on s390x, which is
|
||||
a 64bit BE machine where accessing 32bit values as 64bit and vice versa
|
||||
will explode.
|
||||
|
||||
Also, while we are at it, be a bit more careful when dealing with the
|
||||
64bit cookies we expose and the 32bit serial numbers dbus uses in its
|
||||
payload.
|
||||
|
||||
Problem identified by Fridrich Strba.
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-dump.c | 4 ++--
|
||||
src/libsystemd/sd-bus/bus-kernel.c | 2 +-
|
||||
src/libsystemd/sd-bus/bus-message.c | 15 ++++++++++-----
|
||||
src/libsystemd/sd-bus/bus-message.h | 5 +++--
|
||||
src/libsystemd/sd-bus/sd-bus.c | 12 ++++++------
|
||||
5 files changed, 22 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
|
||||
index 0e4154973775..ea81644d46bc 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-dump.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-dump.c
|
||||
@@ -69,10 +69,10 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) {
|
||||
if (BUS_MESSAGE_COOKIE(m) == 0xFFFFFFFFULL)
|
||||
fprintf(f, " Cookie=-1");
|
||||
else
|
||||
- fprintf(f, " Cookie=%lu", (unsigned long) BUS_MESSAGE_COOKIE(m));
|
||||
+ fprintf(f, " Cookie=%" PRIu64, BUS_MESSAGE_COOKIE(m));
|
||||
|
||||
if (m->reply_cookie != 0)
|
||||
- fprintf(f, " ReplyCookie=%lu", (unsigned long) m->reply_cookie);
|
||||
+ fprintf(f, " ReplyCookie=%" PRIu64, m->reply_cookie);
|
||||
|
||||
fputs("\n", f);
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
|
||||
index 8a2ca0299677..80ef15bd422b 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-kernel.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-kernel.c
|
||||
@@ -266,7 +266,7 @@ static int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) {
|
||||
well_known ? 0 :
|
||||
m->destination ? unique : KDBUS_DST_ID_BROADCAST;
|
||||
m->kdbus->payload_type = KDBUS_PAYLOAD_DBUS;
|
||||
- m->kdbus->cookie = m->header->serial;
|
||||
+ m->kdbus->cookie = (uint64_t) m->header->serial;
|
||||
m->kdbus->priority = m->priority;
|
||||
|
||||
if (m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)
|
||||
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
|
||||
index fb894eff1fb4..97ab0e3beac8 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-message.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-message.c
|
||||
@@ -617,7 +617,7 @@ static int message_new_reply(
|
||||
t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED;
|
||||
t->reply_cookie = BUS_MESSAGE_COOKIE(call);
|
||||
|
||||
- r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_cookie);
|
||||
+ r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, (uint32_t) t->reply_cookie);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
@@ -752,7 +752,7 @@ int bus_message_new_synthetic_error(
|
||||
t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED;
|
||||
t->reply_cookie = cookie;
|
||||
|
||||
- r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_cookie);
|
||||
+ r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, (uint32_t) t->reply_cookie);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
@@ -5075,21 +5075,26 @@ int bus_message_parse_fields(sd_bus_message *m) {
|
||||
break;
|
||||
}
|
||||
|
||||
- case BUS_MESSAGE_HEADER_REPLY_SERIAL:
|
||||
+ case BUS_MESSAGE_HEADER_REPLY_SERIAL: {
|
||||
+ uint32_t serial;
|
||||
+
|
||||
if (m->reply_cookie != 0)
|
||||
return -EBADMSG;
|
||||
|
||||
if (!streq(signature, "u"))
|
||||
return -EBADMSG;
|
||||
|
||||
- r = message_peek_field_uint32(m, &ri, item_size, &m->reply_cookie);
|
||||
+ r = message_peek_field_uint32(m, &ri, item_size, &serial);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
+ m->reply_cookie = serial;
|
||||
+
|
||||
if (m->reply_cookie == 0)
|
||||
return -EBADMSG;
|
||||
|
||||
break;
|
||||
+ }
|
||||
|
||||
case BUS_MESSAGE_HEADER_UNIX_FDS:
|
||||
if (unix_fds != 0)
|
||||
@@ -5489,7 +5494,7 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) {
|
||||
return -ENOMEM;
|
||||
|
||||
n->reply_cookie = (*m)->reply_cookie;
|
||||
- r = message_append_field_uint32(n, BUS_MESSAGE_HEADER_REPLY_SERIAL, n->reply_cookie);
|
||||
+ r = message_append_field_uint32(n, BUS_MESSAGE_HEADER_REPLY_SERIAL, (uint32_t) n->reply_cookie);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h
|
||||
index 5fbe3e60307a..df792945b020 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-message.h
|
||||
+++ b/src/libsystemd/sd-bus/bus-message.h
|
||||
@@ -84,7 +84,7 @@ struct sd_bus_message {
|
||||
|
||||
sd_bus *bus;
|
||||
|
||||
- uint32_t reply_cookie;
|
||||
+ uint64_t reply_cookie;
|
||||
|
||||
const char *path;
|
||||
const char *interface;
|
||||
@@ -162,7 +162,8 @@ static inline uint64_t BUS_MESSAGE_BSWAP64(sd_bus_message *m, uint64_t u) {
|
||||
return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_64(u) : u;
|
||||
}
|
||||
|
||||
-static inline uint32_t BUS_MESSAGE_COOKIE(sd_bus_message *m) {
|
||||
+static inline uint64_t BUS_MESSAGE_COOKIE(sd_bus_message *m) {
|
||||
+ /* Note that we return the serial converted to a 64bit value here */
|
||||
return BUS_MESSAGE_BSWAP32(m, m->header->serial);
|
||||
}
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
|
||||
index ca7c428a3162..8e44e502f70c 100644
|
||||
--- a/src/libsystemd/sd-bus/sd-bus.c
|
||||
+++ b/src/libsystemd/sd-bus/sd-bus.c
|
||||
@@ -1486,15 +1486,15 @@ static int bus_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call
|
||||
return r;
|
||||
|
||||
if (bus->is_kernel || *idx >= BUS_MESSAGE_SIZE(m))
|
||||
- log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%lu reply_cookie=%lu error=%s",
|
||||
+ log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%" PRIu64 " reply_cookie=%" PRIu64 " error=%s",
|
||||
bus_message_type_to_string(m->header->type),
|
||||
strna(sd_bus_message_get_sender(m)),
|
||||
strna(sd_bus_message_get_destination(m)),
|
||||
strna(sd_bus_message_get_path(m)),
|
||||
strna(sd_bus_message_get_interface(m)),
|
||||
strna(sd_bus_message_get_member(m)),
|
||||
- (unsigned long) BUS_MESSAGE_COOKIE(m),
|
||||
- (unsigned long) m->reply_cookie,
|
||||
+ BUS_MESSAGE_COOKIE(m),
|
||||
+ m->reply_cookie,
|
||||
strna(m->error.message));
|
||||
|
||||
return r;
|
||||
@@ -2253,15 +2253,15 @@ static int process_message(sd_bus *bus, sd_bus_message *m) {
|
||||
bus->current = m;
|
||||
bus->iteration_counter++;
|
||||
|
||||
- log_debug("Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%lu reply_cookie=%lu error=%s",
|
||||
+ log_debug("Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%" PRIu64 " reply_cookie=%" PRIu64 " error=%s",
|
||||
bus_message_type_to_string(m->header->type),
|
||||
strna(sd_bus_message_get_sender(m)),
|
||||
strna(sd_bus_message_get_destination(m)),
|
||||
strna(sd_bus_message_get_path(m)),
|
||||
strna(sd_bus_message_get_interface(m)),
|
||||
strna(sd_bus_message_get_member(m)),
|
||||
- (unsigned long) BUS_MESSAGE_COOKIE(m),
|
||||
- (unsigned long) m->reply_cookie,
|
||||
+ BUS_MESSAGE_COOKIE(m),
|
||||
+ m->reply_cookie,
|
||||
strna(m->error.message));
|
||||
|
||||
r = process_hello(bus, m);
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 233bd18dd9144977cc3179a89e0449614c0e9557 Mon Sep 17 00:00:00 2001
|
||||
From: Brandon Philips <brandon.philips@coreos.com>
|
||||
Date: Thu, 13 Mar 2014 15:19:40 -0700
|
||||
Subject: nspawn: allow -EEXIST on mkdir_safe /home/${uid}
|
||||
|
||||
With systemd 211 nspawn attempts to create the home directory for the
|
||||
given uid. However, if the home directory already exists then it will
|
||||
fail. Don't error out on -EEXIST.
|
||||
---
|
||||
src/nspawn/nspawn.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||
index b2c974d97016..6bf0a20ecae2 100644
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -2464,7 +2464,7 @@ static int change_uid_gid(char **_home) {
|
||||
}
|
||||
|
||||
r = mkdir_safe(home, 0755, uid, gid);
|
||||
- if (r < 0) {
|
||||
+ if (r < 0 && r != -EEXIST) {
|
||||
log_error("Failed to make home directory: %s", strerror(-r));
|
||||
return r;
|
||||
}
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,88 +0,0 @@
|
||||
From 3a87ae6e818f875b8bd70bc09dbc173fe90f2769 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Thu, 13 Mar 2014 19:02:28 +0100
|
||||
Subject: networkd: fix creation of runtime dirs at startup
|
||||
|
||||
This allows us to drop the repeated attempted creations of the runtime dirs during runtime.
|
||||
---
|
||||
src/libsystemd-network/sd-dhcp-lease.c | 4 ----
|
||||
src/network/networkd-link.c | 4 ----
|
||||
src/network/networkd-manager.c | 4 ----
|
||||
src/network/networkd.c | 16 ++++++++++++++--
|
||||
4 files changed, 14 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
|
||||
index f7a204af82a9..e6d80d4c665d 100644
|
||||
--- a/src/libsystemd-network/sd-dhcp-lease.c
|
||||
+++ b/src/libsystemd-network/sd-dhcp-lease.c
|
||||
@@ -297,10 +297,6 @@ int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
|
||||
assert(lease);
|
||||
assert(lease_file);
|
||||
|
||||
- r = mkdir_safe_label("/run/systemd/network/leases", 0755, 0, 0);
|
||||
- if (r < 0)
|
||||
- goto finish;
|
||||
-
|
||||
r = fopen_temporary(lease_file, &f, &temp_path);
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
|
||||
index fdc351fed31a..5449a1246ec7 100644
|
||||
--- a/src/network/networkd-link.c
|
||||
+++ b/src/network/networkd-link.c
|
||||
@@ -1367,10 +1367,6 @@ int link_save(Link *link) {
|
||||
assert(link);
|
||||
assert(link->state_file);
|
||||
|
||||
- r = mkdir_safe_label("/run/systemd/network/links", 0755, 0, 0);
|
||||
- if (r < 0)
|
||||
- goto finish;
|
||||
-
|
||||
r = fopen_temporary(link->state_file, &f, &temp_path);
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
|
||||
index f41914f8809a..8c2f5efbd341 100644
|
||||
--- a/src/network/networkd-manager.c
|
||||
+++ b/src/network/networkd-manager.c
|
||||
@@ -407,10 +407,6 @@ int manager_update_resolv_conf(Manager *m) {
|
||||
|
||||
assert(m);
|
||||
|
||||
- r = mkdir_safe_label("/run/systemd/network", 0755, 0, 0);
|
||||
- if (r < 0)
|
||||
- return r;
|
||||
-
|
||||
r = fopen_temporary("/run/systemd/network/resolv.conf", &f, &temp_path);
|
||||
if (r < 0)
|
||||
return r;
|
||||
diff --git a/src/network/networkd.c b/src/network/networkd.c
|
||||
index 2f6a12dbccfd..f0e6ad5201a5 100644
|
||||
--- a/src/network/networkd.c
|
||||
+++ b/src/network/networkd.c
|
||||
@@ -42,8 +42,20 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
/* Always create the directories people can create inotify
|
||||
* watches in. */
|
||||
- mkdir_label("/run/systemd/network/links", 0755);
|
||||
- mkdir_label("/run/systemd/network/leases", 0755);
|
||||
+ r = mkdir_label("/run/systemd/network", 0755);
|
||||
+ if (r < 0)
|
||||
+ log_error("Could not create runtime directory: %s",
|
||||
+ strerror(-r));
|
||||
+
|
||||
+ r = mkdir_label("/run/systemd/network/links", 0755);
|
||||
+ if (r < 0)
|
||||
+ log_error("Could not create runtime directory 'links': %s",
|
||||
+ strerror(-r));
|
||||
+
|
||||
+ r = mkdir_label("/run/systemd/network/leases", 0755);
|
||||
+ if (r < 0)
|
||||
+ log_error("Could not create runtime directory 'leases': %s",
|
||||
+ strerror(-r));
|
||||
|
||||
r = manager_new(&m);
|
||||
if (r < 0) {
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,31 +0,0 @@
|
||||
From 2d8a2869f482e17982eb4748d82a5066497e07bb Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Thu, 13 Mar 2014 18:42:56 +0100
|
||||
Subject: networkd: lease - store (up to) one dhcp lease file per interface
|
||||
|
||||
This removes an accidentally left-over test fragment.
|
||||
---
|
||||
src/network/networkd-link.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
|
||||
index 5449a1246ec7..2650f863575b 100644
|
||||
--- a/src/network/networkd-link.c
|
||||
+++ b/src/network/networkd-link.c
|
||||
@@ -1379,7 +1379,12 @@ int link_save(Link *link) {
|
||||
link_state_to_string(link->state));
|
||||
|
||||
if (link->dhcp_lease) {
|
||||
- const char *lease_file = "/run/systemd/network/leases/test.lease";
|
||||
+ char *lease_file;
|
||||
+
|
||||
+ r = asprintf(&lease_file, "/run/systemd/network/leases/%u",
|
||||
+ (unsigned) link->ifindex);
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
|
||||
r = dhcp_lease_save(link->dhcp_lease, lease_file);
|
||||
if (r < 0)
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,69 +0,0 @@
|
||||
From ca37f1e43b089e721760064b93882958e3f61485 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Fri, 14 Mar 2014 09:05:56 -0400
|
||||
Subject: Do not return -1 (EINVAL) on allocation error
|
||||
|
||||
---
|
||||
src/core/socket.c | 8 +++-----
|
||||
src/network/networkd-link.c | 12 ++++++------
|
||||
2 files changed, 9 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/core/socket.c b/src/core/socket.c
|
||||
index 35531edb751e..ac59ce9d6a88 100644
|
||||
--- a/src/core/socket.c
|
||||
+++ b/src/core/socket.c
|
||||
@@ -198,16 +198,14 @@ static int socket_instantiate_service(Socket *s) {
|
||||
|
||||
assert(s->accept);
|
||||
|
||||
- if (!(prefix = unit_name_to_prefix(UNIT(s)->id)))
|
||||
+ prefix = unit_name_to_prefix(UNIT(s)->id);
|
||||
+ if (!prefix)
|
||||
return -ENOMEM;
|
||||
|
||||
- r = asprintf(&name, "%s@%u.service", prefix, s->n_accepted);
|
||||
-
|
||||
- if (r < 0)
|
||||
+ if (asprintf(&name, "%s@%u.service", prefix, s->n_accepted) < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
r = manager_load_unit(UNIT(s)->manager, name, NULL, NULL, &u);
|
||||
-
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
|
||||
index 2650f863575b..275ad97a6307 100644
|
||||
--- a/src/network/networkd-link.c
|
||||
+++ b/src/network/networkd-link.c
|
||||
@@ -53,10 +53,10 @@ int link_new(Manager *manager, struct udev_device *device, Link **ret) {
|
||||
if (link->ifindex <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
- r = asprintf(&link->state_file, "/run/systemd/network/links/%u",
|
||||
- (unsigned) link->ifindex);
|
||||
+ r = asprintf(&link->state_file, "/run/systemd/network/links/%"PRIu64,
|
||||
+ link->ifindex);
|
||||
if (r < 0)
|
||||
- return r;
|
||||
+ return -ENOMEM;
|
||||
|
||||
mac = udev_device_get_sysattr_value(device, "address");
|
||||
if (mac) {
|
||||
@@ -1381,10 +1381,10 @@ int link_save(Link *link) {
|
||||
if (link->dhcp_lease) {
|
||||
char *lease_file;
|
||||
|
||||
- r = asprintf(&lease_file, "/run/systemd/network/leases/%u",
|
||||
- (unsigned) link->ifindex);
|
||||
+ r = asprintf(&lease_file, "/run/systemd/network/leases/%"PRIu64,
|
||||
+ link->ifindex);
|
||||
if (r < 0)
|
||||
- return r;
|
||||
+ return -ENOMEM;
|
||||
|
||||
r = dhcp_lease_save(link->dhcp_lease, lease_file);
|
||||
if (r < 0)
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,148 +0,0 @@
|
||||
From systemd-devel-bounces@lists.freedesktop.org Fri Mar 14 04:32:58 2014
|
||||
From: Michael Marineau <michael.marineau@coreos.com>
|
||||
Date: Thu, 13 Mar 2014 21:32:12 -0700
|
||||
Subject: [systemd-devel] [PATCH 1/3] shared: add root argument to search_and_fopen
|
||||
To: systemd-devel@lists.freedesktop.org
|
||||
Message-ID: <1394771534-27529-1-git-send-email-michael.marineau@coreos.com>
|
||||
|
||||
|
||||
This adds the same root argument to search_and_fopen that
|
||||
conf_files_list already has. Tools that use those two functions as a
|
||||
pair can now be easily modified to load configuration files from an
|
||||
alternate root filesystem tree.
|
||||
---
|
||||
src/binfmt/binfmt.c | 2 +-
|
||||
src/modules-load/modules-load.c | 2 +-
|
||||
src/shared/util.c | 12 ++++++------
|
||||
src/shared/util.h | 4 ++--
|
||||
src/sysctl/sysctl.c | 2 +-
|
||||
src/tmpfiles/tmpfiles.c | 2 +-
|
||||
6 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
|
||||
index a1877c4..9fc5d4e 100644
|
||||
--- a/src/binfmt/binfmt.c
|
||||
+++ b/src/binfmt/binfmt.c
|
||||
@@ -86,7 +86,7 @@ static int apply_file(const char *path, bool ignore_enoent) {
|
||||
|
||||
assert(path);
|
||||
|
||||
- r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f);
|
||||
+ r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f);
|
||||
if (r < 0) {
|
||||
if (ignore_enoent && r == -ENOENT)
|
||||
return 0;
|
||||
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
|
||||
index 49b153d..ecb84da 100644
|
||||
--- a/src/modules-load/modules-load.c
|
||||
+++ b/src/modules-load/modules-load.c
|
||||
@@ -145,7 +145,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
|
||||
assert(ctx);
|
||||
assert(path);
|
||||
|
||||
- r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f);
|
||||
+ r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f);
|
||||
if (r < 0) {
|
||||
if (ignore_enoent && r == -ENOENT)
|
||||
return 0;
|
||||
diff --git a/src/shared/util.c b/src/shared/util.c
|
||||
index 9e8cd54..8b8d2fb 100644
|
||||
--- a/src/shared/util.c
|
||||
+++ b/src/shared/util.c
|
||||
@@ -5668,14 +5668,14 @@ int on_ac_power(void) {
|
||||
return found_online || !found_offline;
|
||||
}
|
||||
|
||||
-static int search_and_fopen_internal(const char *path, const char *mode, char **search, FILE **_f) {
|
||||
+static int search_and_fopen_internal(const char *path, const char *mode, const char *root, char **search, FILE **_f) {
|
||||
char **i;
|
||||
|
||||
assert(path);
|
||||
assert(mode);
|
||||
assert(_f);
|
||||
|
||||
- if (!path_strv_canonicalize_absolute_uniq(search, NULL))
|
||||
+ if (!path_strv_canonicalize_absolute_uniq(search, root))
|
||||
return -ENOMEM;
|
||||
|
||||
STRV_FOREACH(i, search) {
|
||||
@@ -5699,7 +5699,7 @@ static int search_and_fopen_internal(const char *path, const char *mode, char **
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
-int search_and_fopen(const char *path, const char *mode, const char **search, FILE **_f) {
|
||||
+int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f) {
|
||||
_cleanup_strv_free_ char **copy = NULL;
|
||||
|
||||
assert(path);
|
||||
@@ -5722,10 +5722,10 @@ int search_and_fopen(const char *path, const char *mode, const char **search, FI
|
||||
if (!copy)
|
||||
return -ENOMEM;
|
||||
|
||||
- return search_and_fopen_internal(path, mode, copy, _f);
|
||||
+ return search_and_fopen_internal(path, mode, root, copy, _f);
|
||||
}
|
||||
|
||||
-int search_and_fopen_nulstr(const char *path, const char *mode, const char *search, FILE **_f) {
|
||||
+int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f) {
|
||||
_cleanup_strv_free_ char **s = NULL;
|
||||
|
||||
if (path_is_absolute(path)) {
|
||||
@@ -5744,7 +5744,7 @@ int search_and_fopen_nulstr(const char *path, const char *mode, const char *sear
|
||||
if (!s)
|
||||
return -ENOMEM;
|
||||
|
||||
- return search_and_fopen_internal(path, mode, s, _f);
|
||||
+ return search_and_fopen_internal(path, mode, root, s, _f);
|
||||
}
|
||||
|
||||
char *strextend(char **x, ...) {
|
||||
diff --git a/src/shared/util.h b/src/shared/util.h
|
||||
index 81831e2..e99f8d1 100644
|
||||
--- a/src/shared/util.h
|
||||
+++ b/src/shared/util.h
|
||||
@@ -696,8 +696,8 @@ char *strip_tab_ansi(char **p, size_t *l);
|
||||
|
||||
int on_ac_power(void);
|
||||
|
||||
-int search_and_fopen(const char *path, const char *mode, const char **search, FILE **_f);
|
||||
-int search_and_fopen_nulstr(const char *path, const char *mode, const char *search, FILE **_f);
|
||||
+int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f);
|
||||
+int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f);
|
||||
|
||||
#define FOREACH_LINE(line, f, on_error) \
|
||||
for (;;) \
|
||||
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
|
||||
index 76efacb..8868732 100644
|
||||
--- a/src/sysctl/sysctl.c
|
||||
+++ b/src/sysctl/sysctl.c
|
||||
@@ -123,7 +123,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
|
||||
|
||||
assert(path);
|
||||
|
||||
- r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f);
|
||||
+ r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f);
|
||||
if (r < 0) {
|
||||
if (ignore_enoent && r == -ENOENT)
|
||||
return 0;
|
||||
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
||||
index 6e36dc7..3684289 100644
|
||||
--- a/src/tmpfiles/tmpfiles.c
|
||||
+++ b/src/tmpfiles/tmpfiles.c
|
||||
@@ -1376,7 +1376,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
|
||||
|
||||
assert(fn);
|
||||
|
||||
- r = search_and_fopen_nulstr(fn, "re", conf_file_dirs, &f);
|
||||
+ r = search_and_fopen_nulstr(fn, "re", NULL, conf_file_dirs, &f);
|
||||
if (r < 0) {
|
||||
if (ignore_enoent && r == -ENOENT)
|
||||
return 0;
|
||||
--
|
||||
1.8.3.2
|
||||
|
||||
_______________________________________________
|
||||
systemd-devel mailing list
|
||||
systemd-devel@lists.freedesktop.org
|
||||
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
|
||||
|
@ -1,116 +0,0 @@
|
||||
From systemd-devel-bounces@lists.freedesktop.org Fri Mar 14 04:33:04 2014
|
||||
From: Michael Marineau <michael.marineau@coreos.com>
|
||||
Date: Thu, 13 Mar 2014 21:32:13 -0700
|
||||
Subject: [systemd-devel] [PATCH 2/3] tmpfiles: Add --root option to operate on an alternate fs tree.
|
||||
To: systemd-devel@lists.freedesktop.org
|
||||
Message-ID: <1394771534-27529-2-git-send-email-michael.marineau@coreos.com>
|
||||
|
||||
|
||||
This makes it possible to initialize or cleanup an arbitrary filesystem
|
||||
hierarchy in the same way that it would be during system boot.
|
||||
---
|
||||
src/tmpfiles/tmpfiles.c | 27 ++++++++++++++++++++++++---
|
||||
1 file changed, 24 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
||||
index 3684289..4ce35b5 100644
|
||||
--- a/src/tmpfiles/tmpfiles.c
|
||||
+++ b/src/tmpfiles/tmpfiles.c
|
||||
@@ -111,6 +111,7 @@ static bool arg_boot = false;
|
||||
|
||||
static char **include_prefixes = NULL;
|
||||
static char **exclude_prefixes = NULL;
|
||||
+static char *arg_root = NULL;
|
||||
|
||||
static const char conf_file_dirs[] =
|
||||
"/etc/tmpfiles.d\0"
|
||||
@@ -1188,6 +1189,15 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
||||
if (!should_include_path(i->path))
|
||||
return 0;
|
||||
|
||||
+ if (arg_root) {
|
||||
+ char *p = strjoin(arg_root, i->path, NULL);
|
||||
+ if (!p)
|
||||
+ return log_oom();
|
||||
+
|
||||
+ free(i->path);
|
||||
+ i->path = p;
|
||||
+ }
|
||||
+
|
||||
if (user && !streq(user, "-")) {
|
||||
const char *u = user;
|
||||
|
||||
@@ -1277,7 +1287,8 @@ static int help(void) {
|
||||
" --remove Remove marked files/directories\n"
|
||||
" --boot Execute actions only safe at boot\n"
|
||||
" --prefix=PATH Only apply rules that apply to paths with the specified prefix\n"
|
||||
- " --exclude-prefix=PATH Ignore rules that apply to paths with the specified prefix\n",
|
||||
+ " --exclude-prefix=PATH Ignore rules that apply to paths with the specified prefix\n"
|
||||
+ " --root=PATH Operate on an alternate filesystem root\n",
|
||||
program_invocation_short_name);
|
||||
|
||||
return 0;
|
||||
@@ -1293,6 +1304,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
ARG_BOOT,
|
||||
ARG_PREFIX,
|
||||
ARG_EXCLUDE_PREFIX,
|
||||
+ ARG_ROOT,
|
||||
};
|
||||
|
||||
static const struct option options[] = {
|
||||
@@ -1304,6 +1316,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
{ "boot", no_argument, NULL, ARG_BOOT },
|
||||
{ "prefix", required_argument, NULL, ARG_PREFIX },
|
||||
{ "exclude-prefix", required_argument, NULL, ARG_EXCLUDE_PREFIX },
|
||||
+ { "root", required_argument, NULL, ARG_ROOT },
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -1350,6 +1363,13 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return log_oom();
|
||||
break;
|
||||
|
||||
+ case ARG_ROOT:
|
||||
+ arg_root = path_make_absolute_cwd(optarg);
|
||||
+ if (!arg_root)
|
||||
+ return log_oom();
|
||||
+ path_kill_slashes(arg_root);
|
||||
+ break;
|
||||
+
|
||||
case '?':
|
||||
return -EINVAL;
|
||||
|
||||
@@ -1376,7 +1396,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
|
||||
|
||||
assert(fn);
|
||||
|
||||
- r = search_and_fopen_nulstr(fn, "re", NULL, conf_file_dirs, &f);
|
||||
+ r = search_and_fopen_nulstr(fn, "re", arg_root, conf_file_dirs, &f);
|
||||
if (r < 0) {
|
||||
if (ignore_enoent && r == -ENOENT)
|
||||
return 0;
|
||||
@@ -1477,7 +1497,7 @@ int main(int argc, char *argv[]) {
|
||||
_cleanup_strv_free_ char **files = NULL;
|
||||
char **f;
|
||||
|
||||
- r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs);
|
||||
+ r = conf_files_list_nulstr(&files, ".conf", arg_root, conf_file_dirs);
|
||||
if (r < 0) {
|
||||
log_error("Failed to enumerate tmpfiles.d files: %s", strerror(-r));
|
||||
goto finish;
|
||||
@@ -1508,6 +1528,7 @@ finish:
|
||||
|
||||
free(include_prefixes);
|
||||
free(exclude_prefixes);
|
||||
+ free(arg_root);
|
||||
|
||||
set_free_free(unix_sockets);
|
||||
|
||||
--
|
||||
1.8.3.2
|
||||
|
||||
_______________________________________________
|
||||
systemd-devel mailing list
|
||||
systemd-devel@lists.freedesktop.org
|
||||
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
|
||||
|
@ -1,39 +0,0 @@
|
||||
From systemd-devel-bounces@lists.freedesktop.org Fri Mar 14 04:33:02 2014
|
||||
From: Michael Marineau <michael.marineau@coreos.com>
|
||||
Date: Thu, 13 Mar 2014 21:32:14 -0700
|
||||
Subject: [systemd-devel] [PATCH 3/3] tmpfiles: Add --root to the man page.
|
||||
To: systemd-devel@lists.freedesktop.org
|
||||
Message-ID: <1394771534-27529-3-git-send-email-michael.marineau@coreos.com>
|
||||
|
||||
|
||||
---
|
||||
man/systemd-tmpfiles.xml | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/man/systemd-tmpfiles.xml b/man/systemd-tmpfiles.xml
|
||||
index 0b62640..193acb7 100644
|
||||
--- a/man/systemd-tmpfiles.xml
|
||||
+++ b/man/systemd-tmpfiles.xml
|
||||
@@ -152,6 +152,14 @@
|
||||
prefix. This option can be specified
|
||||
multiple times.</para></listitem>
|
||||
</varlistentry>
|
||||
+ <varlistentry>
|
||||
+ <term><option>--root=ROOT</option></term>
|
||||
+ <listitem><para>Takes a directory path
|
||||
+ as an argument. All paths will be
|
||||
+ prefixed with the given alternate ROOT
|
||||
+ path, including config search paths.
|
||||
+ </para></listitem>
|
||||
+ </varlistentry>
|
||||
|
||||
<xi:include href="standard-options.xml" xpointer="help" />
|
||||
<xi:include href="standard-options.xml" xpointer="version" />
|
||||
--
|
||||
1.8.3.2
|
||||
|
||||
_______________________________________________
|
||||
systemd-devel mailing list
|
||||
systemd-devel@lists.freedesktop.org
|
||||
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
|
||||
|
@ -1,315 +0,0 @@
|
||||
From systemd-devel-bounces@lists.freedesktop.org Fri Mar 14 04:42:13 2014
|
||||
From: Greg KH <gregkh@linuxfoundation.org>
|
||||
Date: Fri, 14 Mar 2014 04:43:04 +0000
|
||||
Subject: [systemd-devel] [PATCH] machine-id: add --root option to operate on an alternate fs tree
|
||||
To: systemd Mailing List <systemd-devel@lists.freedesktop.org>
|
||||
Message-ID: <20140314044304.GA24528@kroah.com>
|
||||
Content-Disposition: inline
|
||||
|
||||
|
||||
This makes it possible to initialize the /etc/machine-id file on an
|
||||
arbitrary filesystem hierarchy. This helps systems that wish to run
|
||||
this at image creation time in a subdirectory, or from initramfs before
|
||||
pivot-root is called.
|
||||
|
||||
diff --git a/man/systemd-machine-id-setup.xml b/man/systemd-machine-id-setup.xml
|
||||
index 5c34b345d012..b879b40b997d 100644
|
||||
--- a/man/systemd-machine-id-setup.xml
|
||||
+++ b/man/systemd-machine-id-setup.xml
|
||||
@@ -96,6 +96,14 @@
|
||||
<para>The following options are understood:</para>
|
||||
|
||||
<variablelist>
|
||||
+ <varlistentry>
|
||||
+ <term><option>--root=ROOT</option></term>
|
||||
+ <listitem><para>Takes a directory path
|
||||
+ as an argument. All paths will be
|
||||
+ prefixed with the given alternate ROOT
|
||||
+ path, including config search paths.
|
||||
+ </para></listitem>
|
||||
+ </varlistentry>
|
||||
<xi:include href="standard-options.xml" xpointer="help" />
|
||||
<xi:include href="standard-options.xml" xpointer="version" />
|
||||
</variablelist>
|
||||
diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c
|
||||
index 1b55da7e56b8..7d52b468a11a 100644
|
||||
--- a/src/core/machine-id-setup.c
|
||||
+++ b/src/core/machine-id-setup.c
|
||||
@@ -59,18 +59,22 @@ static int shorten_uuid(char destination[36], const char *source) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
-static int generate(char id[34]) {
|
||||
- int fd, r;
|
||||
+static int generate(char id[34], const char *root) {
|
||||
+ int fd, r = 0;
|
||||
unsigned char *p;
|
||||
sd_id128_t buf;
|
||||
char *q;
|
||||
ssize_t k;
|
||||
const char *vm_id;
|
||||
+ char *dbus_machine_id;
|
||||
|
||||
assert(id);
|
||||
|
||||
+ if (asprintf(&dbus_machine_id, "%s/var/lib/dbus/machine-id", root) < 0)
|
||||
+ return log_oom();
|
||||
+
|
||||
/* First, try reading the D-Bus machine id, unless it is a symlink */
|
||||
- fd = open("/var/lib/dbus/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
|
||||
+ fd = open(dbus_machine_id, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
|
||||
if (fd >= 0) {
|
||||
k = loop_read(fd, id, 33, false);
|
||||
close_nointr_nofail(fd);
|
||||
@@ -83,7 +87,7 @@ static int generate(char id[34]) {
|
||||
id[33] = 0;
|
||||
|
||||
log_info("Initializing machine ID from D-Bus machine ID.");
|
||||
- return 0;
|
||||
+ goto finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +109,8 @@ static int generate(char id[34]) {
|
||||
r = shorten_uuid(id, uuid);
|
||||
if (r >= 0) {
|
||||
log_info("Initializing machine ID from KVM UUID.");
|
||||
- return 0;
|
||||
+ r = 0;
|
||||
+ goto finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +129,8 @@ static int generate(char id[34]) {
|
||||
r = shorten_uuid(id, e);
|
||||
if (r >= 0) {
|
||||
log_info("Initializing machine ID from container UUID.");
|
||||
- return 0;
|
||||
+ r = 0;
|
||||
+ goto finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,7 +140,7 @@ static int generate(char id[34]) {
|
||||
r = sd_id128_randomize(&buf);
|
||||
if (r < 0) {
|
||||
log_error("Failed to open /dev/urandom: %s", strerror(-r));
|
||||
- return r;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
for (p = buf.bytes, q = id; p < buf.bytes + sizeof(buf); p++, q += 2) {
|
||||
@@ -147,15 +153,27 @@ static int generate(char id[34]) {
|
||||
|
||||
log_info("Initializing machine ID from random generator.");
|
||||
|
||||
- return 0;
|
||||
+finish:
|
||||
+ free(dbus_machine_id);
|
||||
+ return r;
|
||||
}
|
||||
|
||||
-int machine_id_setup(void) {
|
||||
+int machine_id_setup(const char *root) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
- int r;
|
||||
+ int r = 0;
|
||||
bool writable = false;
|
||||
struct stat st;
|
||||
char id[34]; /* 32 + \n + \0 */
|
||||
+ char *etc_machine_id = NULL;
|
||||
+ char *run_machine_id = NULL;
|
||||
+
|
||||
+ if (asprintf(&etc_machine_id, "%s/etc/machine-id", root) < 0)
|
||||
+ return log_oom();
|
||||
+
|
||||
+ if (asprintf(&run_machine_id, "%s/run/machine-id", root) < 0) {
|
||||
+ r = log_oom();
|
||||
+ goto finish;
|
||||
+ }
|
||||
|
||||
RUN_WITH_UMASK(0000) {
|
||||
/* We create this 0444, to indicate that this isn't really
|
||||
@@ -163,14 +181,15 @@ int machine_id_setup(void) {
|
||||
* will be owned by root it doesn't matter much, but maybe
|
||||
* people look. */
|
||||
|
||||
- fd = open("/etc/machine-id", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444);
|
||||
+ fd = open(etc_machine_id, O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444);
|
||||
if (fd >= 0)
|
||||
writable = true;
|
||||
else {
|
||||
- fd = open("/etc/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
||||
+ fd = open(etc_machine_id, O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
||||
if (fd < 0) {
|
||||
- log_error("Cannot open /etc/machine-id: %m");
|
||||
- return -errno;
|
||||
+ log_error("Cannot open %s: %m", etc_machine_id);
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
writable = false;
|
||||
@@ -179,7 +198,8 @@ int machine_id_setup(void) {
|
||||
|
||||
if (fstat(fd, &st) < 0) {
|
||||
log_error("fstat() failed: %m");
|
||||
- return -errno;
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
if (S_ISREG(st.st_mode))
|
||||
@@ -187,21 +207,21 @@ int machine_id_setup(void) {
|
||||
id[32] = 0;
|
||||
|
||||
if (id128_is_valid(id))
|
||||
- return 0;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
/* Hmm, so, the id currently stored is not useful, then let's
|
||||
* generate one */
|
||||
|
||||
- r = generate(id);
|
||||
+ r = generate(id, root);
|
||||
if (r < 0)
|
||||
- return r;
|
||||
+ goto finish;
|
||||
|
||||
if (S_ISREG(st.st_mode) && writable) {
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
|
||||
if (loop_write(fd, id, 33, false) == 33)
|
||||
- return 0;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
close_nointr_nofail(fd);
|
||||
@@ -211,27 +231,31 @@ int machine_id_setup(void) {
|
||||
* /run/machine-id as a replacement */
|
||||
|
||||
RUN_WITH_UMASK(0022) {
|
||||
- r = write_string_file("/run/machine-id", id);
|
||||
+ r = write_string_file(run_machine_id, id);
|
||||
}
|
||||
if (r < 0) {
|
||||
- log_error("Cannot write /run/machine-id: %s", strerror(-r));
|
||||
- unlink("/run/machine-id");
|
||||
- return r;
|
||||
+ log_error("Cannot write %s: %s", run_machine_id, strerror(-r));
|
||||
+ unlink(run_machine_id);
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
/* And now, let's mount it over */
|
||||
- r = mount("/run/machine-id", "/etc/machine-id", NULL, MS_BIND, NULL);
|
||||
+ r = mount(run_machine_id, etc_machine_id, NULL, MS_BIND, NULL);
|
||||
if (r < 0) {
|
||||
- log_error("Failed to mount /etc/machine-id: %m");
|
||||
- unlink_noerrno("/run/machine-id");
|
||||
- return -errno;
|
||||
+ log_error("Failed to mount %s: %m", etc_machine_id);
|
||||
+ unlink_noerrno(run_machine_id);
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
- log_info("Installed transient /etc/machine-id file.");
|
||||
+ log_info("Installed transient %s file.", etc_machine_id);
|
||||
|
||||
/* Mark the mount read-only */
|
||||
- if (mount(NULL, "/etc/machine-id", NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, NULL) < 0)
|
||||
- log_warning("Failed to make transient /etc/machine-id read-only: %m");
|
||||
+ if (mount(NULL, etc_machine_id, NULL, MS_BIND|MS_RDONLY|MS_REMOUNT, NULL) < 0)
|
||||
+ log_warning("Failed to make transient %s read-only: %m", etc_machine_id);
|
||||
|
||||
- return 0;
|
||||
+finish:
|
||||
+ free(etc_machine_id);
|
||||
+ free(run_machine_id);
|
||||
+ return r;
|
||||
}
|
||||
diff --git a/src/core/machine-id-setup.h b/src/core/machine-id-setup.h
|
||||
index b9e6b4d674a6..b0583eefc8fe 100644
|
||||
--- a/src/core/machine-id-setup.h
|
||||
+++ b/src/core/machine-id-setup.h
|
||||
@@ -21,4 +21,4 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
-int machine_id_setup(void);
|
||||
+int machine_id_setup(const char *root);
|
||||
diff --git a/src/core/main.c b/src/core/main.c
|
||||
index f1b06d88803e..cc876efa9c2c 100644
|
||||
--- a/src/core/main.c
|
||||
+++ b/src/core/main.c
|
||||
@@ -1582,7 +1582,7 @@ int main(int argc, char *argv[]) {
|
||||
kmod_setup();
|
||||
#endif
|
||||
hostname_setup();
|
||||
- machine_id_setup();
|
||||
+ machine_id_setup("");
|
||||
loopback_setup();
|
||||
|
||||
test_mtab();
|
||||
diff --git a/src/machine-id-setup/machine-id-setup-main.c b/src/machine-id-setup/machine-id-setup-main.c
|
||||
index 84af925f517e..a67d436dbd7c 100644
|
||||
--- a/src/machine-id-setup/machine-id-setup-main.c
|
||||
+++ b/src/machine-id-setup/machine-id-setup-main.c
|
||||
@@ -29,12 +29,15 @@
|
||||
#include "log.h"
|
||||
#include "build.h"
|
||||
|
||||
+static const char *arg_root = "";
|
||||
+
|
||||
static int help(void) {
|
||||
|
||||
printf("%s [OPTIONS...]\n\n"
|
||||
"Initialize /etc/machine-id from a random source.\n\n"
|
||||
" -h --help Show this help\n"
|
||||
- " --version Show package version\n",
|
||||
+ " --version Show package version\n"
|
||||
+ " --root Filesystem root\n",
|
||||
program_invocation_short_name);
|
||||
|
||||
return 0;
|
||||
@@ -43,12 +46,14 @@ static int help(void) {
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
enum {
|
||||
- ARG_VERSION = 0x100
|
||||
+ ARG_VERSION = 0x100,
|
||||
+ ARG_ROOT,
|
||||
};
|
||||
|
||||
static const struct option options[] = {
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "version", no_argument, NULL, ARG_VERSION },
|
||||
+ { "root", required_argument, NULL, ARG_ROOT },
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -69,6 +74,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
puts(SYSTEMD_FEATURES);
|
||||
return 0;
|
||||
|
||||
+ case ARG_ROOT:
|
||||
+ arg_root = optarg;
|
||||
+ break;
|
||||
+
|
||||
case '?':
|
||||
return -EINVAL;
|
||||
|
||||
@@ -95,5 +104,5 @@ int main(int argc, char *argv[]) {
|
||||
if (r <= 0)
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
|
||||
- return machine_id_setup() < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
+ return machine_id_setup(arg_root) < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
_______________________________________________
|
||||
systemd-devel mailing list
|
||||
systemd-devel@lists.freedesktop.org
|
||||
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
|
||||
|
@ -1,130 +0,0 @@
|
||||
From 06f021a8048583d66202e3ac5cd0a12386d33ac2 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Thu, 13 Mar 2014 20:46:45 +0100
|
||||
Subject: [PATCH] networkd: allow more than one static DNS server
|
||||
|
||||
|
||||
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
|
||||
index 4118fc9b65d4..7609128f3f97 100644
|
||||
--- a/man/systemd.network.xml
|
||||
+++ b/man/systemd.network.xml
|
||||
@@ -221,8 +221,8 @@
|
||||
<term><varname>DNS=</varname></term>
|
||||
<listitem>
|
||||
<para>A DNS server address, which must be in the format described in
|
||||
- <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
- .</para>
|
||||
+ <citerefentry><refentrytitle>inet_pton</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
|
||||
+ This option may be specified repeatedly.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
|
||||
index c92418967b48..414b3bccfa64 100644
|
||||
--- a/src/network/networkd-address.c
|
||||
+++ b/src/network/networkd-address.c
|
||||
@@ -225,7 +225,7 @@ int config_parse_dns(const char *unit,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata) {
|
||||
- Address **dns = data;
|
||||
+ Set **dns = data;
|
||||
_cleanup_address_free_ Address *n = NULL;
|
||||
int r;
|
||||
|
||||
@@ -246,7 +246,7 @@ int config_parse_dns(const char *unit,
|
||||
return 0;
|
||||
}
|
||||
|
||||
- *dns = n;
|
||||
+ set_put(*dns, n);
|
||||
n = NULL;
|
||||
|
||||
return 0;
|
||||
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
|
||||
index 8c2f5efbd341..c730e7148df3 100644
|
||||
--- a/src/network/networkd-manager.c
|
||||
+++ b/src/network/networkd-manager.c
|
||||
@@ -442,10 +442,17 @@ int manager_update_resolv_conf(Manager *m) {
|
||||
}
|
||||
}
|
||||
|
||||
- HASHMAP_FOREACH(link, m->links, i)
|
||||
- if (link->network && link->network->dns)
|
||||
- append_dns(f, &link->network->dns->in_addr.in,
|
||||
- link->network->dns->family, &count);
|
||||
+ HASHMAP_FOREACH(link, m->links, i) {
|
||||
+ if (link->network && link->network->dns) {
|
||||
+ Address *address;
|
||||
+ Iterator j;
|
||||
+
|
||||
+ SET_FOREACH(address, link->network->dns, j) {
|
||||
+ append_dns(f, &address->in_addr.in,
|
||||
+ address->family, &count);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
fflush(f);
|
||||
|
||||
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
|
||||
index 6437ff4230f5..6e9915b75dab 100644
|
||||
--- a/src/network/networkd-network.c
|
||||
+++ b/src/network/networkd-network.c
|
||||
@@ -69,6 +69,10 @@ static int network_load_one(Manager *manager, const char *filename) {
|
||||
if (!network->routes_by_section)
|
||||
return log_oom();
|
||||
|
||||
+ network->dns = set_new(NULL, NULL);
|
||||
+ if (!network->dns)
|
||||
+ return log_oom();
|
||||
+
|
||||
network->filename = strdup(filename);
|
||||
if (!network->filename)
|
||||
return log_oom();
|
||||
@@ -136,6 +140,7 @@ int network_load(Manager *manager) {
|
||||
void network_free(Network *network) {
|
||||
Route *route;
|
||||
Address *address;
|
||||
+ Iterator i;
|
||||
|
||||
if (!network)
|
||||
return;
|
||||
@@ -150,7 +155,10 @@ void network_free(Network *network) {
|
||||
|
||||
free(network->description);
|
||||
|
||||
- address_free(network->dns);
|
||||
+ SET_FOREACH(address, network->dns, i)
|
||||
+ address_free(address);
|
||||
+
|
||||
+ set_free(network->dns);
|
||||
|
||||
hashmap_free(network->vlans);
|
||||
|
||||
diff --git a/src/network/networkd.h b/src/network/networkd.h
|
||||
index 0c0171993d72..311350c1e2e0 100644
|
||||
--- a/src/network/networkd.h
|
||||
+++ b/src/network/networkd.h
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "rtnl-util.h"
|
||||
#include "hashmap.h"
|
||||
#include "list.h"
|
||||
+#include "set.h"
|
||||
#include "condition-util.h"
|
||||
|
||||
typedef struct NetDev NetDev;
|
||||
@@ -130,11 +131,12 @@ struct Network {
|
||||
|
||||
LIST_HEAD(Address, static_addresses);
|
||||
LIST_HEAD(Route, static_routes);
|
||||
- Address *dns;
|
||||
|
||||
Hashmap *addresses_by_section;
|
||||
Hashmap *routes_by_section;
|
||||
|
||||
+ Set *dns;
|
||||
+
|
||||
LIST_FIELDS(Network, networks);
|
||||
};
|
||||
|
@ -1,515 +0,0 @@
|
||||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-apps/systemd/systemd-9999.ebuild,v 1.100 2014/03/03 22:19:31 floppym Exp $
|
||||
|
||||
EAPI=5
|
||||
|
||||
if [[ ${PV} == 9999 ]]; then
|
||||
AUTOTOOLS_AUTORECONF=yes
|
||||
EGIT_REPO_URI="git://anongit.freedesktop.org/${PN}/${PN}
|
||||
http://cgit.freedesktop.org/${PN}/${PN}/"
|
||||
|
||||
inherit git-r3
|
||||
|
||||
elif [[ ${PV} == *9999 ]]; then
|
||||
EGIT_REPO_URI="git://anongit.freedesktop.org/${PN}/${PN}-stable
|
||||
http://cgit.freedesktop.org/${PN}/${PN}-stable/"
|
||||
EGIT_BRANCH=v${PV%%.*}-stable
|
||||
|
||||
inherit git-r3
|
||||
fi
|
||||
|
||||
AUTOTOOLS_PRUNE_LIBTOOL_FILES=all
|
||||
PYTHON_COMPAT=( python{2_7,3_2,3_3} )
|
||||
inherit autotools-utils bash-completion-r1 fcaps linux-info multilib \
|
||||
multilib-minimal pam python-single-r1 systemd toolchain-funcs udev \
|
||||
user
|
||||
|
||||
DESCRIPTION="System and service manager for Linux"
|
||||
HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd"
|
||||
SRC_URI="http://www.freedesktop.org/software/systemd/${P}.tar.xz"
|
||||
|
||||
LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
|
||||
SLOT="0/2"
|
||||
KEYWORDS="~alpha amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"
|
||||
IUSE="acl audit cryptsetup doc +firmware-loader gcrypt gudev http introspection
|
||||
kdbus +kmod lzma pam policykit python qrcode +seccomp selinux tcpd
|
||||
test vanilla xattr openrc"
|
||||
|
||||
MINKV="3.0"
|
||||
|
||||
COMMON_DEPEND=">=sys-apps/util-linux-2.20:0=
|
||||
sys-libs/libcap:0=
|
||||
acl? ( sys-apps/acl:0= )
|
||||
audit? ( >=sys-process/audit-2:0= )
|
||||
cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= )
|
||||
gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0= )
|
||||
gudev? ( dev-libs/glib:2=[${MULTILIB_USEDEP}] )
|
||||
http? ( net-libs/libmicrohttpd:0= )
|
||||
introspection? ( >=dev-libs/gobject-introspection-1.31.1:0= )
|
||||
kmod? ( >=sys-apps/kmod-15:0= )
|
||||
lzma? ( app-arch/xz-utils:0=[${MULTILIB_USEDEP}] )
|
||||
pam? ( virtual/pam:= )
|
||||
python? ( ${PYTHON_DEPS} )
|
||||
qrcode? ( media-gfx/qrencode:0= )
|
||||
seccomp? ( >=sys-libs/libseccomp-2.1:0= )
|
||||
selinux? ( sys-libs/libselinux:0= )
|
||||
tcpd? ( sys-apps/tcp-wrappers:0= )
|
||||
xattr? ( sys-apps/attr:0= )
|
||||
abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r9
|
||||
!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
|
||||
|
||||
# baselayout-2.2 has /run
|
||||
RDEPEND="${COMMON_DEPEND}
|
||||
>=sys-apps/baselayout-2.2
|
||||
|| (
|
||||
>=sys-apps/util-linux-2.22
|
||||
<sys-apps/sysvinit-2.88-r4
|
||||
)
|
||||
!sys-auth/nss-myhostname
|
||||
!<sys-libs/glibc-2.14
|
||||
!sys-fs/udev"
|
||||
|
||||
# sys-apps/daemon: the daemon only (+ build-time lib dep for tests)
|
||||
PDEPEND=">=sys-apps/dbus-1.6.8-r1:0
|
||||
>=sys-apps/hwids-20130717-r1[udev]
|
||||
openrc? ( >=sys-fs/udev-init-scripts-25 )
|
||||
policykit? ( sys-auth/polkit )
|
||||
!vanilla? ( sys-apps/gentoo-systemd-integration )"
|
||||
|
||||
# Newer linux-headers needed by ia64, bug #480218
|
||||
DEPEND="${COMMON_DEPEND}
|
||||
app-arch/xz-utils:0
|
||||
dev-util/gperf
|
||||
>=dev-util/intltool-0.50
|
||||
>=sys-devel/binutils-2.23.1
|
||||
>=sys-devel/gcc-4.6
|
||||
>=sys-kernel/linux-headers-${MINKV}
|
||||
ia64? ( >=sys-kernel/linux-headers-3.9 )
|
||||
virtual/pkgconfig
|
||||
doc? ( >=dev-util/gtk-doc-1.18 )
|
||||
python? ( dev-python/lxml[${PYTHON_USEDEP}] )
|
||||
test? ( >=sys-apps/dbus-1.6.8-r1:0 )"
|
||||
|
||||
# Pull in docbook to rebuild man pages since we are patching them
|
||||
DEPEND="${DEPEND}
|
||||
app-text/docbook-xml-dtd:4.2
|
||||
app-text/docbook-xml-dtd:4.5
|
||||
app-text/docbook-xsl-stylesheets
|
||||
dev-libs/libxslt:0"
|
||||
|
||||
if [[ ${PV} == *9999 ]]; then
|
||||
DEPEND="${DEPEND}
|
||||
dev-libs/gobject-introspection
|
||||
>=dev-libs/libgcrypt-1.4.5:0"
|
||||
|
||||
SRC_URI=
|
||||
KEYWORDS=
|
||||
fi
|
||||
|
||||
src_prepare() {
|
||||
# CoreOs specific hacks^Wfeatures
|
||||
epatch "${FILESDIR}"/211-handle-empty-etc-os-release.patch
|
||||
|
||||
# upstream fixes not yet in the release
|
||||
epatch "${FILESDIR}"/211-0001-gpt-auto-generator-don-t-return-OOM-on-parentless-de.patch
|
||||
epatch "${FILESDIR}"/211-0002-bus-fix-memory-leak-when-kdbus-is-not-enabled.patch
|
||||
epatch "${FILESDIR}"/211-0003-sd-bus-don-t-look-for-a-64bit-value-when-we-only-hav.patch
|
||||
epatch "${FILESDIR}"/211-0004-nspawn-allow-EEXIST-on-mkdir_safe-home-uid.patch
|
||||
epatch "${FILESDIR}"/211-0005-networkd-fix-creation-of-runtime-dirs-at-startup.patch
|
||||
epatch "${FILESDIR}"/211-0006-networkd-lease-store-up-to-one-dhcp-lease-file-per-i.patch
|
||||
epatch "${FILESDIR}"/211-0007-Do-not-return-1-EINVAL-on-allocation-error.patch
|
||||
|
||||
# patch to make journald work at first boot
|
||||
epatch "${FILESDIR}"/211-tmpfiles.patch
|
||||
|
||||
# --root= options to some utilities needed by initramfs
|
||||
epatch "${FILESDIR}"/211-001-shared-add-root-argument-to-search_and_fopen.patch
|
||||
epatch "${FILESDIR}"/211-002-tmpfiles-add-root-option-to-operate-on-an-alternate-fs-tree.patch
|
||||
epatch "${FILESDIR}"/211-003-tmpfiles-add-root-to-the-man-page.patch
|
||||
epatch "${FILESDIR}"/211-004-machine-id-add-root-option-to-operate-on-an-alternate-fs-tree.patch
|
||||
|
||||
# dns feature for more than one server
|
||||
epatch "${FILESDIR}"/211-networkd-allow-more-than-one-static-dns-server.patch
|
||||
|
||||
# patches to fix dhcp on gce
|
||||
epatch "${FILESDIR}"/211-0001-sd-dhcp-client-accept-infinite-lease-lifetime.patch
|
||||
epatch "${FILESDIR}"/0001-network-dhcp-create-explicit-host-route-to-gateway.patch
|
||||
|
||||
if [[ ${PV} == *9999 ]]; then
|
||||
if use doc; then
|
||||
gtkdocize --docdir docs/ || die
|
||||
else
|
||||
echo 'EXTRA_DIST =' > docs/gtk-doc.make
|
||||
fi
|
||||
fi
|
||||
|
||||
# Bug 463376
|
||||
sed -i -e 's/GROUP="dialout"/GROUP="uucp"/' rules/*.rules || die
|
||||
|
||||
autotools-utils_src_prepare
|
||||
}
|
||||
|
||||
pkg_pretend() {
|
||||
local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS ~DEVTMPFS ~DMIID
|
||||
~EPOLL ~FANOTIFY ~FHANDLE ~INOTIFY_USER ~IPV6 ~NET ~PROC_FS
|
||||
~SECCOMP ~SIGNALFD ~SYSFS ~TIMERFD
|
||||
~!IDE ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2
|
||||
~!GRKERNSEC_PROC"
|
||||
|
||||
use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
|
||||
use pam && CONFIG_CHECK+=" ~AUDITSYSCALL"
|
||||
use xattr && CONFIG_CHECK+=" ~TMPFS_XATTR"
|
||||
kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
|
||||
use firmware-loader || CONFIG_CHECK+=" ~!FW_LOADER_USER_HELPER"
|
||||
|
||||
if linux_config_exists; then
|
||||
local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
|
||||
if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then
|
||||
ewarn "It's recommended to set an empty value to the following kernel config option:"
|
||||
ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${MERGE_TYPE} != binary ]]; then
|
||||
if [[ $(gcc-major-version) -lt 4
|
||||
|| ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 6 ) ]]
|
||||
then
|
||||
eerror "systemd requires at least gcc 4.6 to build. Please switch the active"
|
||||
eerror "gcc version using gcc-config."
|
||||
die "systemd requires at least gcc 4.6"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${MERGE_TYPE} != buildonly ]]; then
|
||||
if kernel_is -lt ${MINKV//./ }; then
|
||||
ewarn "Kernel version at least ${MINKV} required"
|
||||
fi
|
||||
|
||||
if ! use firmware-loader && kernel_is -lt 3 8; then
|
||||
ewarn "You seem to be using kernel older than 3.8. Those kernel versions"
|
||||
ewarn "require systemd with USE=firmware-loader to support loading"
|
||||
ewarn "firmware. Missing this flag may cause some hardware not to work."
|
||||
fi
|
||||
|
||||
check_extra_config
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
use python && python-single-r1_pkg_setup
|
||||
}
|
||||
|
||||
multilib_src_configure() {
|
||||
local myeconfargs=(
|
||||
# disable -flto since it is an optimization flag
|
||||
# and makes distcc less effective
|
||||
cc_cv_CFLAGS__flto=no
|
||||
|
||||
--with-pamconfdir=/usr/share/pam.d
|
||||
--with-dbuspolicydir=/usr/share/dbus-1/system.d
|
||||
--disable-maintainer-mode
|
||||
--localstatedir=/var
|
||||
--with-pamlibdir=$(getpam_mod_dir)
|
||||
# avoid bash-completion dep
|
||||
--with-bashcompletiondir="$(get_bashcompdir)"
|
||||
# make sure we get /bin:/sbin in $PATH
|
||||
--enable-split-usr
|
||||
# disable sysv compatibility
|
||||
--with-sysvinit-path=
|
||||
--with-sysvrcnd-path=
|
||||
# no deps
|
||||
--enable-efi
|
||||
--enable-ima
|
||||
# optional components/dependencies
|
||||
$(use_enable acl)
|
||||
$(use_enable audit)
|
||||
$(use_enable cryptsetup libcryptsetup)
|
||||
$(use_enable doc gtk-doc)
|
||||
$(use_enable gcrypt)
|
||||
$(use_enable gudev)
|
||||
$(use_enable http microhttpd)
|
||||
$(use_enable introspection)
|
||||
$(use_enable kdbus)
|
||||
$(use_enable kmod)
|
||||
$(use_enable lzma xz)
|
||||
$(use_enable pam)
|
||||
$(use_enable policykit polkit)
|
||||
$(use_with python)
|
||||
$(use_enable python python-devel)
|
||||
$(use_enable qrcode qrencode)
|
||||
$(use_enable seccomp)
|
||||
$(use_enable selinux)
|
||||
$(use_enable tcpd tcpwrap)
|
||||
$(use_enable test tests)
|
||||
$(use_enable xattr)
|
||||
|
||||
# not supported (avoid automagic deps in the future)
|
||||
--disable-chkconfig
|
||||
|
||||
# hardcode a few paths to spare some deps
|
||||
QUOTAON=/usr/sbin/quotaon
|
||||
QUOTACHECK=/usr/sbin/quotacheck
|
||||
)
|
||||
|
||||
# Keep using the one where the rules were installed.
|
||||
MY_UDEVDIR=$(get_udevdir)
|
||||
|
||||
if use firmware-loader; then
|
||||
myeconfargs+=(
|
||||
--with-firmware-path="/lib/firmware/updates:/lib/firmware"
|
||||
)
|
||||
fi
|
||||
|
||||
if ! multilib_is_native_abi; then
|
||||
myeconfargs+=(
|
||||
ac_cv_search_cap_init=
|
||||
ac_cv_header_sys_capability_h=yes
|
||||
DBUS_CFLAGS=' '
|
||||
DBUS_LIBS=' '
|
||||
|
||||
--disable-acl
|
||||
--disable-audit
|
||||
--disable-gcrypt
|
||||
--disable-gtk-doc
|
||||
--disable-introspection
|
||||
--disable-kmod
|
||||
--disable-libcryptsetup
|
||||
--disable-microhttpd
|
||||
--disable-networkd
|
||||
--disable-pam
|
||||
--disable-polkit
|
||||
--disable-qrencode
|
||||
--disable-seccomp
|
||||
--disable-selinux
|
||||
--disable-tcpwrap
|
||||
--disable-tests
|
||||
--disable-xattr
|
||||
--disable-xz
|
||||
--disable-python-devel
|
||||
)
|
||||
fi
|
||||
|
||||
# Work around bug 463846.
|
||||
tc-export CC
|
||||
|
||||
autotools-utils_src_configure
|
||||
}
|
||||
|
||||
multilib_src_compile() {
|
||||
local mymakeopts=(
|
||||
udevlibexecdir="${MY_UDEVDIR}"
|
||||
)
|
||||
|
||||
if multilib_is_native_abi; then
|
||||
emake "${mymakeopts[@]}"
|
||||
else
|
||||
# prerequisites for gudev
|
||||
use gudev && emake src/gudev/gudev{enumtypes,marshal}.{c,h}
|
||||
|
||||
echo 'gentoo: $(BUILT_SOURCES)' | \
|
||||
emake "${mymakeopts[@]}" -f Makefile -f - gentoo
|
||||
echo 'gentoo: $(lib_LTLIBRARIES) $(pkgconfiglib_DATA)' | \
|
||||
emake "${mymakeopts[@]}" -f Makefile -f - gentoo
|
||||
fi
|
||||
}
|
||||
|
||||
multilib_src_test() {
|
||||
multilib_is_native_abi || continue
|
||||
|
||||
default
|
||||
}
|
||||
|
||||
multilib_src_install() {
|
||||
local mymakeopts=(
|
||||
# automake fails with parallel libtool relinking
|
||||
# https://bugs.gentoo.org/show_bug.cgi?id=491398
|
||||
-j1
|
||||
|
||||
udevlibexecdir="${MY_UDEVDIR}"
|
||||
dist_udevhwdb_DATA=
|
||||
DESTDIR="${D}"
|
||||
)
|
||||
|
||||
if multilib_is_native_abi; then
|
||||
emake "${mymakeopts[@]}" install
|
||||
else
|
||||
mymakeopts+=(
|
||||
install-libLTLIBRARIES
|
||||
install-pkgconfiglibDATA
|
||||
install-includeHEADERS
|
||||
# safe to call unconditionally, 'installs' empty list
|
||||
install-libgudev_includeHEADERS
|
||||
install-pkgincludeHEADERS
|
||||
)
|
||||
|
||||
emake "${mymakeopts[@]}"
|
||||
fi
|
||||
|
||||
# install compat pkg-config files
|
||||
local pcfiles=( src/compat-libs/libsystemd-{daemon,id128,journal,login}.pc )
|
||||
emake "${mymakeopts[@]}" install-pkgconfiglibDATA \
|
||||
pkgconfiglib_DATA="${pcfiles[*]}"
|
||||
}
|
||||
|
||||
multilib_src_install_all() {
|
||||
prune_libtool_files --modules
|
||||
einstalldocs
|
||||
|
||||
# we just keep sysvinit tools, so no need for the mans
|
||||
rm "${D}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 \
|
||||
|| die
|
||||
rm "${D}"/usr/share/man/man1/init.1 || die
|
||||
|
||||
# Disable storing coredumps in journald, bug #433457
|
||||
mv "${D}"/usr/lib/sysctl.d/50-coredump.conf{,.disabled} || die
|
||||
|
||||
# Preserve empty dir /var, bug #437008
|
||||
keepdir /var/lib/systemd
|
||||
|
||||
# Keep /etc clean
|
||||
rmdir "${D}"/etc/{binfmt,modules-load,sysctl,tmpfiles}.d || die
|
||||
|
||||
# Don't default to graphical.target
|
||||
rm "${D}"/usr/lib/systemd/system/default.target || die
|
||||
dosym multi-user.target /usr/lib/systemd/system/default.target
|
||||
|
||||
# Move a few services enabled in /etc to /usr
|
||||
rm "${D}"/etc/systemd/system/getty.target.wants/getty@tty1.service || die
|
||||
rmdir "${D}"/etc/systemd/system/getty.target.wants || die
|
||||
dosym ../getty@.service /usr/lib/systemd/system/getty.target.wants/getty@tty1.service
|
||||
|
||||
rm "${D}"/etc/systemd/system/multi-user.target.wants/remote-fs.target \
|
||||
"${D}"/etc/systemd/system/multi-user.target.wants/systemd-networkd.service \
|
||||
|| die
|
||||
rmdir "${D}"/etc/systemd/system/multi-user.target.wants || die
|
||||
systemd_enable_service multi-user.target remote-fs.target
|
||||
systemd_enable_service multi-user.target systemd-networkd.service
|
||||
}
|
||||
|
||||
migrate_locale() {
|
||||
local envd_locale_def="${EROOT%/}/etc/env.d/02locale"
|
||||
local envd_locale=( "${EROOT%/}"/etc/env.d/??locale )
|
||||
local locale_conf="${EROOT%/}/etc/locale.conf"
|
||||
|
||||
if [[ ! -L ${locale_conf} && ! -e ${locale_conf} ]]; then
|
||||
# If locale.conf does not exist...
|
||||
if [[ -e ${envd_locale} ]]; then
|
||||
# ...either copy env.d/??locale if there's one
|
||||
ebegin "Moving ${envd_locale} to ${locale_conf}"
|
||||
mv "${envd_locale}" "${locale_conf}"
|
||||
eend ${?} || FAIL=1
|
||||
else
|
||||
# ...or create a dummy default
|
||||
ebegin "Creating ${locale_conf}"
|
||||
cat > "${locale_conf}" <<-EOF
|
||||
# This file has been created by the sys-apps/systemd ebuild.
|
||||
# See locale.conf(5) and localectl(1).
|
||||
|
||||
# LANG=${LANG}
|
||||
EOF
|
||||
eend ${?} || FAIL=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -L ${envd_locale} ]]; then
|
||||
# now, if env.d/??locale is not a symlink (to locale.conf)...
|
||||
if [[ -e ${envd_locale} ]]; then
|
||||
# ...warn the user that he has duplicate locale settings
|
||||
ewarn
|
||||
ewarn "To ensure consistent behavior, you should replace ${envd_locale}"
|
||||
ewarn "with a symlink to ${locale_conf}. Please migrate your settings"
|
||||
ewarn "and create the symlink with the following command:"
|
||||
ewarn "ln -s -n -f ../locale.conf ${envd_locale}"
|
||||
ewarn
|
||||
else
|
||||
# ...or just create the symlink if there's nothing here
|
||||
ebegin "Creating ${envd_locale_def} -> ../locale.conf symlink"
|
||||
ln -n -s ../locale.conf "${envd_locale_def}"
|
||||
eend ${?} || FAIL=1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
migrate_net_name_slot() {
|
||||
# If user has disabled 80-net-name-slot.rules using a empty file or a symlink to /dev/null,
|
||||
# do the same for 80-net-setup-link.rules to keep the old behavior
|
||||
local net_move=no
|
||||
local net_name_slot_sym=no
|
||||
local net_rules_path="${EROOT%/}"/etc/udev/rules.d
|
||||
local net_name_slot="${net_rules_path}"/80-net-name-slot.rules
|
||||
local net_setup_link="${net_rules_path}"/80-net-setup-link.rules
|
||||
if [[ -e ${net_setup_link} ]]; then
|
||||
net_move=no
|
||||
elif [[ -f ${net_name_slot} && $(sed -e "/^#/d" -e "/^\W*$/d" ${net_name_slot} | wc -l) == 0 ]]; then
|
||||
net_move=yes
|
||||
elif [[ -L ${net_name_slot} && $(readlink ${net_name_slot}) == /dev/null ]]; then
|
||||
net_move=yes
|
||||
net_name_slot_sym=yes
|
||||
fi
|
||||
if [[ ${net_move} == yes ]]; then
|
||||
ebegin "Copying ${net_name_slot} to ${net_setup_link}"
|
||||
|
||||
if [[ ${net_name_slot_sym} == yes ]]; then
|
||||
ln -nfs /dev/null "${net_setup_link}"
|
||||
else
|
||||
cp "${net_name_slot}" "${net_setup_link}"
|
||||
fi
|
||||
eend $? || FAIL=1
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
enewgroup systemd-journal
|
||||
if use http; then
|
||||
enewgroup systemd-journal-gateway
|
||||
enewuser systemd-journal-gateway -1 -1 -1 systemd-journal-gateway
|
||||
fi
|
||||
systemd_update_catalog
|
||||
|
||||
# Keep this here in case the database format changes so it gets updated
|
||||
# when required. Despite that this file is owned by sys-apps/hwids.
|
||||
if has_version "sys-apps/hwids[udev]"; then
|
||||
udevadm hwdb --update --root="${ROOT%/}"
|
||||
fi
|
||||
|
||||
udev_reload || FAIL=1
|
||||
|
||||
# Bug 468876
|
||||
fcaps cap_dac_override,cap_sys_ptrace=ep usr/bin/systemd-detect-virt
|
||||
|
||||
# Bug 465468, make sure locales are respect, and ensure consistency
|
||||
# between OpenRC & systemd
|
||||
migrate_locale
|
||||
|
||||
# Migrate 80-net-name-slot.rules -> 80-net-setup-link.rules
|
||||
migrate_net_name_slot
|
||||
|
||||
if [[ ${FAIL} ]]; then
|
||||
eerror "One of the postinst commands failed. Please check the postinst output"
|
||||
eerror "for errors. You may need to clean up your system and/or try installing"
|
||||
eerror "systemd again."
|
||||
eerror
|
||||
fi
|
||||
|
||||
if [[ ! -L "${ROOT}"/etc/mtab ]]; then
|
||||
ewarn "Upstream mandates the /etc/mtab file should be a symlink to /proc/mounts."
|
||||
ewarn "Not having it is not supported by upstream and will cause tools like 'df'"
|
||||
ewarn "and 'mount' to not work properly. Please run:"
|
||||
ewarn " # ln -sf '${ROOT}proc/self/mounts' '${ROOT}etc/mtab'"
|
||||
ewarn
|
||||
fi
|
||||
|
||||
if ! has_version sys-apps/systemd-ui; then
|
||||
elog "To get additional features, a number of optional runtime dependencies may"
|
||||
elog "be installed:"
|
||||
elog "- sys-apps/systemd-ui: for GTK+ systemadm UI and gnome-ask-password-agent"
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_prerm() {
|
||||
# If removing systemd completely, remove the catalog database.
|
||||
if [[ ! ${REPLACED_BY_VERSION} ]]; then
|
||||
rm -f -v "${EROOT}"/var/lib/systemd/catalog/database
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue
Block a user