mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-17 18:06:59 +02:00
Merge pull request #432 from gregkh/systemd
sys-apps/systemd : lots of bugfixes and multiple dns server feature
This commit is contained in:
commit
9b3bd7dda3
@ -1,84 +0,0 @@
|
|||||||
From a7ca0f06aaa0e0ae3b5eada2cdece8c9766bff1a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Lennart Poettering <lennart@poettering.net>
|
|
||||||
Date: Fri, 26 Jul 2013 17:32:19 +0200
|
|
||||||
Subject: [PATCH 1/5] logind: update state file after generating the session
|
|
||||||
fifo, not before
|
|
||||||
|
|
||||||
https://bugs.freedesktop.org/show_bug.cgi?id=67273
|
|
||||||
---
|
|
||||||
src/login/logind-dbus.c | 7 ++++++-
|
|
||||||
src/login/logind-session-dbus.c | 4 ++++
|
|
||||||
src/machine/machined-dbus.c | 3 ++-
|
|
||||||
3 files changed, 12 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
|
|
||||||
index 39af637..b5e975a 100644
|
|
||||||
--- a/src/login/logind-dbus.c
|
|
||||||
+++ b/src/login/logind-dbus.c
|
|
||||||
@@ -643,6 +643,10 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message) {
|
|
||||||
|
|
||||||
session->create_message = dbus_message_ref(message);
|
|
||||||
|
|
||||||
+ /* Now, let's wait until the slice unit and stuff got
|
|
||||||
+ * created. We send the reply back from
|
|
||||||
+ * session_send_create_reply().*/
|
|
||||||
+
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
@@ -2356,7 +2360,6 @@ DBusHandlerResult bus_message_filter(
|
|
||||||
if (streq_ptr(path, s->scope_job)) {
|
|
||||||
free(s->scope_job);
|
|
||||||
s->scope_job = NULL;
|
|
||||||
- session_save(s);
|
|
||||||
|
|
||||||
if (s->started) {
|
|
||||||
if (streq(result, "done"))
|
|
||||||
@@ -2366,6 +2369,8 @@ DBusHandlerResult bus_message_filter(
|
|
||||||
session_send_create_reply(s, &error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ session_save(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
session_add_to_gc_queue(s);
|
|
||||||
diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
|
|
||||||
index 62b9ffd..210f756 100644
|
|
||||||
--- a/src/login/logind-session-dbus.c
|
|
||||||
+++ b/src/login/logind-session-dbus.c
|
|
||||||
@@ -535,6 +535,10 @@ int session_send_create_reply(Session *s, DBusError *error) {
|
|
||||||
if (!s->create_message)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
+ /* This is called after the session scope was successfully
|
|
||||||
+ * created, and finishes where bus_manager_create_session()
|
|
||||||
+ * left off. */
|
|
||||||
+
|
|
||||||
if (error) {
|
|
||||||
DBusError buffer;
|
|
||||||
|
|
||||||
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
|
|
||||||
index 1e8bc60..6c4d50b 100644
|
|
||||||
--- a/src/machine/machined-dbus.c
|
|
||||||
+++ b/src/machine/machined-dbus.c
|
|
||||||
@@ -543,7 +543,6 @@ DBusHandlerResult bus_message_filter(
|
|
||||||
if (streq_ptr(path, mm->scope_job)) {
|
|
||||||
free(mm->scope_job);
|
|
||||||
mm->scope_job = NULL;
|
|
||||||
- machine_save(mm);
|
|
||||||
|
|
||||||
if (mm->started) {
|
|
||||||
if (streq(result, "done"))
|
|
||||||
@@ -553,6 +552,8 @@ DBusHandlerResult bus_message_filter(
|
|
||||||
machine_send_create_reply(mm, &error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ machine_save(mm);
|
|
||||||
}
|
|
||||||
|
|
||||||
machine_add_to_gc_queue(mm);
|
|
||||||
--
|
|
||||||
1.8.3.2
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
From 64fa15a7ca9c276d28413567c74a1d360fbdc975 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
|
||||||
Date: Wed, 31 Jul 2013 23:12:17 +0200
|
|
||||||
Subject: [PATCH 2/5] Add /usr/share/keymaps to localectl supported locations.
|
|
||||||
|
|
||||||
This is the standard upstream location where kbd installs keymaps.
|
|
||||||
---
|
|
||||||
src/locale/localectl.c | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
|
|
||||||
index cd7356a..8259c0a 100644
|
|
||||||
--- a/src/locale/localectl.c
|
|
||||||
+++ b/src/locale/localectl.c
|
|
||||||
@@ -538,6 +538,7 @@ static int list_vconsole_keymaps(DBusConnection *bus, char **args, unsigned n) {
|
|
||||||
if (!keymaps)
|
|
||||||
return log_oom();
|
|
||||||
|
|
||||||
+ nftw("/usr/share/keymaps/", nftw_cb, 20, FTW_MOUNT|FTW_PHYS);
|
|
||||||
nftw("/usr/share/kbd/keymaps/", nftw_cb, 20, FTW_MOUNT|FTW_PHYS);
|
|
||||||
nftw("/usr/lib/kbd/keymaps/", nftw_cb, 20, FTW_MOUNT|FTW_PHYS);
|
|
||||||
nftw("/lib/kbd/keymaps/", nftw_cb, 20, FTW_MOUNT|FTW_PHYS);
|
|
||||||
--
|
|
||||||
1.8.3.2
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
|||||||
From 9c26db4da7a474b024fcdc97ea490280d86777e1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Dave Reisner <dreisner@archlinux.org>
|
|
||||||
Date: Wed, 24 Jul 2013 11:10:05 -0400
|
|
||||||
Subject: [PATCH 3/5] tmpfiles: support passing --prefix multiple times
|
|
||||||
|
|
||||||
---
|
|
||||||
man/systemd-tmpfiles.xml | 3 ++-
|
|
||||||
src/tmpfiles/tmpfiles.c | 24 +++++++++++++++++++++---
|
|
||||||
2 files changed, 23 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/man/systemd-tmpfiles.xml b/man/systemd-tmpfiles.xml
|
|
||||||
index 405a9f1..b0f2d9c 100644
|
|
||||||
--- a/man/systemd-tmpfiles.xml
|
|
||||||
+++ b/man/systemd-tmpfiles.xml
|
|
||||||
@@ -121,7 +121,8 @@
|
|
||||||
<term><option>--prefix=PATH</option></term>
|
|
||||||
<listitem><para>Only apply rules that
|
|
||||||
apply to paths with the specified
|
|
||||||
- prefix.</para></listitem>
|
|
||||||
+ prefix. This option can be specified
|
|
||||||
+ multiple times.</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
|
||||||
index eae993e..cb15133 100644
|
|
||||||
--- a/src/tmpfiles/tmpfiles.c
|
|
||||||
+++ b/src/tmpfiles/tmpfiles.c
|
|
||||||
@@ -105,7 +105,7 @@ static bool arg_create = false;
|
|
||||||
static bool arg_clean = false;
|
|
||||||
static bool arg_remove = false;
|
|
||||||
|
|
||||||
-static const char *arg_prefix = NULL;
|
|
||||||
+static char **include_prefixes = NULL;
|
|
||||||
|
|
||||||
static const char conf_file_dirs[] =
|
|
||||||
"/etc/tmpfiles.d\0"
|
|
||||||
@@ -1018,6 +1018,21 @@ static bool item_equal(Item *a, Item *b) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static bool should_include_path(const char *path) {
|
|
||||||
+ char **prefix;
|
|
||||||
+
|
|
||||||
+ /* no explicit paths specified for inclusion, so everything is valid */
|
|
||||||
+ if (strv_length(include_prefixes) == 0)
|
|
||||||
+ return true;
|
|
||||||
+
|
|
||||||
+ STRV_FOREACH(prefix, include_prefixes) {
|
|
||||||
+ if (path_startswith(path, *prefix))
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return false;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
|
||||||
_cleanup_item_free_ Item *i = NULL;
|
|
||||||
Item *existing;
|
|
||||||
@@ -1119,7 +1134,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
|
||||||
|
|
||||||
path_kill_slashes(i->path);
|
|
||||||
|
|
||||||
- if (arg_prefix && !path_startswith(i->path, arg_prefix))
|
|
||||||
+ if (!should_include_path(i->path))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (user && !streq(user, "-")) {
|
|
||||||
@@ -1258,7 +1273,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ARG_PREFIX:
|
|
||||||
- arg_prefix = optarg;
|
|
||||||
+ if (strv_extend(&include_prefixes, optarg) < 0)
|
|
||||||
+ return log_oom();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '?':
|
|
||||||
@@ -1423,6 +1439,8 @@ finish:
|
|
||||||
hashmap_free(items);
|
|
||||||
hashmap_free(globs);
|
|
||||||
|
|
||||||
+ strv_free(include_prefixes);
|
|
||||||
+
|
|
||||||
set_free_free(unix_sockets);
|
|
||||||
|
|
||||||
label_finish();
|
|
||||||
--
|
|
||||||
1.8.3.2
|
|
||||||
|
|
@ -1,138 +0,0 @@
|
|||||||
From 059e02a48e58da81591ebd34e87f928269d77929 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Dave Reisner <dreisner@archlinux.org>
|
|
||||||
Date: Wed, 24 Jul 2013 11:19:24 -0400
|
|
||||||
Subject: [PATCH 4/5] tmpfiles: introduce --exclude-prefix
|
|
||||||
|
|
||||||
The opposite of --prefix, allows specifying path prefixes which should
|
|
||||||
be skipped when processing rules.
|
|
||||||
---
|
|
||||||
man/systemd-tmpfiles.xml | 7 +++++
|
|
||||||
shell-completion/systemd-zsh-completion.zsh | 1 +
|
|
||||||
src/tmpfiles/tmpfiles.c | 44 ++++++++++++++++++-----------
|
|
||||||
3 files changed, 36 insertions(+), 16 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/man/systemd-tmpfiles.xml b/man/systemd-tmpfiles.xml
|
|
||||||
index b0f2d9c..403592d 100644
|
|
||||||
--- a/man/systemd-tmpfiles.xml
|
|
||||||
+++ b/man/systemd-tmpfiles.xml
|
|
||||||
@@ -124,6 +124,13 @@
|
|
||||||
prefix. This option can be specified
|
|
||||||
multiple times.</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
+ <varlistentry>
|
|
||||||
+ <term><option>--exclude-prefix=PATH</option></term>
|
|
||||||
+ <listitem><para>Ignore rules that
|
|
||||||
+ apply to paths with the specified
|
|
||||||
+ prefix. This option can be specified
|
|
||||||
+ multiple times.</para></listitem>
|
|
||||||
+ </varlistentry>
|
|
||||||
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
diff --git a/shell-completion/systemd-zsh-completion.zsh b/shell-completion/systemd-zsh-completion.zsh
|
|
||||||
index c85e00e..7aebbcd 100644
|
|
||||||
--- a/shell-completion/systemd-zsh-completion.zsh
|
|
||||||
+++ b/shell-completion/systemd-zsh-completion.zsh
|
|
||||||
@@ -249,6 +249,7 @@ _ctls()
|
|
||||||
'--clean[Clean up all files and directories with an age parameter configured.]' \
|
|
||||||
'--remove[All files and directories marked with r, R in the configuration files are removed.]' \
|
|
||||||
'--prefix=[Only apply rules that apply to paths with the specified prefix.]' \
|
|
||||||
+ '--exclude-prefix=[Ignore rules that apply to paths with the specified prefix.]' \
|
|
||||||
'--help[Prints a short help text and exits.]' \
|
|
||||||
'*::files:_files'
|
|
||||||
;;
|
|
||||||
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
|
||||||
index cb15133..5eca82a 100644
|
|
||||||
--- a/src/tmpfiles/tmpfiles.c
|
|
||||||
+++ b/src/tmpfiles/tmpfiles.c
|
|
||||||
@@ -106,6 +106,7 @@ static bool arg_clean = false;
|
|
||||||
static bool arg_remove = false;
|
|
||||||
|
|
||||||
static char **include_prefixes = NULL;
|
|
||||||
+static char **exclude_prefixes = NULL;
|
|
||||||
|
|
||||||
static const char conf_file_dirs[] =
|
|
||||||
"/etc/tmpfiles.d\0"
|
|
||||||
@@ -1021,16 +1022,19 @@ static bool item_equal(Item *a, Item *b) {
|
|
||||||
static bool should_include_path(const char *path) {
|
|
||||||
char **prefix;
|
|
||||||
|
|
||||||
- /* no explicit paths specified for inclusion, so everything is valid */
|
|
||||||
- if (strv_length(include_prefixes) == 0)
|
|
||||||
- return true;
|
|
||||||
+ STRV_FOREACH(prefix, exclude_prefixes) {
|
|
||||||
+ if (path_startswith(path, *prefix))
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
STRV_FOREACH(prefix, include_prefixes) {
|
|
||||||
if (path_startswith(path, *prefix))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
- return false;
|
|
||||||
+ /* no matches, so we should include this path only if we
|
|
||||||
+ * have no whitelist at all */
|
|
||||||
+ return strv_length(include_prefixes) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
|
||||||
@@ -1219,11 +1223,12 @@ static int help(void) {
|
|
||||||
|
|
||||||
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n\n"
|
|
||||||
"Creates, deletes and cleans up volatile and temporary files and directories.\n\n"
|
|
||||||
- " -h --help Show this help\n"
|
|
||||||
- " --create Create marked files/directories\n"
|
|
||||||
- " --clean Clean up marked directories\n"
|
|
||||||
- " --remove Remove marked files/directories\n"
|
|
||||||
- " --prefix=PATH Only apply rules that apply to paths with the specified prefix\n",
|
|
||||||
+ " -h --help Show this help\n"
|
|
||||||
+ " --create Create marked files/directories\n"
|
|
||||||
+ " --clean Clean up marked directories\n"
|
|
||||||
+ " --remove Remove marked files/directories\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",
|
|
||||||
program_invocation_short_name);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
@@ -1235,16 +1240,18 @@ static int parse_argv(int argc, char *argv[]) {
|
|
||||||
ARG_CREATE,
|
|
||||||
ARG_CLEAN,
|
|
||||||
ARG_REMOVE,
|
|
||||||
- ARG_PREFIX
|
|
||||||
+ ARG_PREFIX,
|
|
||||||
+ ARG_EXCLUDE_PREFIX,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct option options[] = {
|
|
||||||
- { "help", no_argument, NULL, 'h' },
|
|
||||||
- { "create", no_argument, NULL, ARG_CREATE },
|
|
||||||
- { "clean", no_argument, NULL, ARG_CLEAN },
|
|
||||||
- { "remove", no_argument, NULL, ARG_REMOVE },
|
|
||||||
- { "prefix", required_argument, NULL, ARG_PREFIX },
|
|
||||||
- { NULL, 0, NULL, 0 }
|
|
||||||
+ { "help", no_argument, NULL, 'h' },
|
|
||||||
+ { "create", no_argument, NULL, ARG_CREATE },
|
|
||||||
+ { "clean", no_argument, NULL, ARG_CLEAN },
|
|
||||||
+ { "remove", no_argument, NULL, ARG_REMOVE },
|
|
||||||
+ { "prefix", required_argument, NULL, ARG_PREFIX },
|
|
||||||
+ { "exclude-prefix", required_argument, NULL, ARG_EXCLUDE_PREFIX },
|
|
||||||
+ { NULL, 0, NULL, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
int c;
|
|
||||||
@@ -1277,6 +1284,11 @@ static int parse_argv(int argc, char *argv[]) {
|
|
||||||
return log_oom();
|
|
||||||
break;
|
|
||||||
|
|
||||||
+ case ARG_EXCLUDE_PREFIX:
|
|
||||||
+ if (strv_extend(&exclude_prefixes, optarg) < 0)
|
|
||||||
+ return log_oom();
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
case '?':
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
--
|
|
||||||
1.8.3.2
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
|||||||
From a7b85011f13bf2a90cfcfad1f3d2ca2deebaa2f1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Dave Reisner <dreisner@archlinux.org>
|
|
||||||
Date: Wed, 24 Jul 2013 11:58:35 -0400
|
|
||||||
Subject: [PATCH 5/5] tmpfiles-setup: exclude /dev prefixes files
|
|
||||||
|
|
||||||
Fixes Arch Linux bug: https://bugs.archlinux.org/task/36259
|
|
||||||
---
|
|
||||||
units/systemd-tmpfiles-setup.service.in | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/units/systemd-tmpfiles-setup.service.in b/units/systemd-tmpfiles-setup.service.in
|
|
||||||
index 67c7d4a..6f98063 100644
|
|
||||||
--- a/units/systemd-tmpfiles-setup.service.in
|
|
||||||
+++ b/units/systemd-tmpfiles-setup.service.in
|
|
||||||
@@ -21,4 +21,4 @@ ConditionDirectoryNotEmpty=|/run/tmpfiles.d
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
-ExecStart=@rootbindir@/systemd-tmpfiles --create --remove
|
|
||||||
+ExecStart=@rootbindir@/systemd-tmpfiles --create --remove --exclude-prefix=/dev
|
|
||||||
--
|
|
||||||
1.8.3.2
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From ac4c8d6da8b5ebc35f02c9c6cb7595be7b134a05 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
|
||||||
Date: Thu, 12 Sep 2013 01:50:16 +0000
|
|
||||||
Subject: Allow tabs in environment files
|
|
||||||
|
|
||||||
bash allows them, and so should we.
|
|
||||||
|
|
||||||
string_has_cc is changed to allow tabs, and if they are not wanted,
|
|
||||||
they must be now checked for explicitly. There are two other callers,
|
|
||||||
apart from the env file loaders, and one already checked anyway, and
|
|
||||||
the other is changed to check.
|
|
||||||
|
|
||||||
https://bugs.freedesktop.org/show_bug.cgi?id=68592
|
|
||||||
https://bugs.gentoo.org/show_bug.cgi?id=481554
|
|
||||||
---
|
|
||||||
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
|
|
||||||
index 0437e33..6a43aeb 100644
|
|
||||||
--- a/src/hostname/hostnamed.c
|
|
||||||
+++ b/src/hostname/hostnamed.c
|
|
||||||
@@ -553,7 +553,8 @@ static DBusHandlerResult hostname_message_handler(
|
|
||||||
* safe than sorry */
|
|
||||||
if (k == PROP_ICON_NAME && !filename_is_safe(name))
|
|
||||||
return bus_send_error_reply(connection, message, NULL, -EINVAL);
|
|
||||||
- if (k == PROP_PRETTY_HOSTNAME && string_has_cc(name))
|
|
||||||
+ if (k == PROP_PRETTY_HOSTNAME &&
|
|
||||||
+ (string_has_cc(name) || chars_intersect(name, "\t")))
|
|
||||||
return bus_send_error_reply(connection, message, NULL, -EINVAL);
|
|
||||||
if (k == PROP_CHASSIS && !valid_chassis(name))
|
|
||||||
return bus_send_error_reply(connection, message, NULL, -EINVAL);
|
|
||||||
diff --git a/src/shared/util.c b/src/shared/util.c
|
|
||||||
index 1dde8af..ad463e8 100644
|
|
||||||
--- a/src/shared/util.c
|
|
||||||
+++ b/src/shared/util.c
|
|
||||||
@@ -5311,6 +5311,10 @@ bool string_is_safe(const char *p) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/**
|
|
||||||
+ * Check if a string contains control characters.
|
|
||||||
+ * Spaces and tabs are not considered control characters.
|
|
||||||
+ */
|
|
||||||
bool string_has_cc(const char *p) {
|
|
||||||
const char *t;
|
|
@ -1,22 +0,0 @@
|
|||||||
From da2620a5f878ad5c8d8d51992528cb3e637c7d1f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
|
||||||
Date: Thu, 12 Sep 2013 14:03:16 +0000
|
|
||||||
Subject: Actually allow tabs in environment files
|
|
||||||
|
|
||||||
Fixup for ac4c8d6da8b5e.
|
|
||||||
---
|
|
||||||
diff --git a/src/shared/util.c b/src/shared/util.c
|
|
||||||
index ad463e8..9a075fa 100644
|
|
||||||
--- a/src/shared/util.c
|
|
||||||
+++ b/src/shared/util.c
|
|
||||||
@@ -5321,7 +5321,7 @@ bool string_has_cc(const char *p) {
|
|
||||||
assert(p);
|
|
||||||
|
|
||||||
for (t = p; *t; t++)
|
|
||||||
- if (*t > 0 && *t < ' ')
|
|
||||||
+ if (*t > 0 && *t < ' ' && *t != '\t')
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
--
|
|
||||||
cgit v0.9.0.2-2-gbebe
|
|
@ -0,0 +1,25 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,181 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,28 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,88 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,69 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,148 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,116 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,315 @@
|
|||||||
|
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
|
||||||
|
|
@ -0,0 +1,130 @@
|
|||||||
|
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 +0,0 @@
|
|||||||
systemd-207.ebuild
|
|
@ -1,322 +0,0 @@
|
|||||||
# Copyright 1999-2013 Gentoo Foundation
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
# $Header: /var/cvsroot/gentoo-x86/sys-apps/systemd/systemd-207.ebuild,v 1.2 2013/09/14 18:44:05 floppym Exp $
|
|
||||||
|
|
||||||
EAPI=5
|
|
||||||
|
|
||||||
AUTOTOOLS_PRUNE_LIBTOOL_FILES=all
|
|
||||||
PYTHON_COMPAT=( python2_7 )
|
|
||||||
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"
|
|
||||||
KEYWORDS="amd64 arm ppc ppc64 x86"
|
|
||||||
IUSE="acl audit cryptsetup doc +firmware-loader gcrypt gudev http introspection
|
|
||||||
+kmod lzma openrc pam policykit python qrcode selinux tcpd test
|
|
||||||
vanilla xattr"
|
|
||||||
|
|
||||||
MINKV="3.0"
|
|
||||||
|
|
||||||
COMMON_DEPEND=">=sys-apps/dbus-1.6.8-r1
|
|
||||||
>=sys-apps/util-linux-2.20
|
|
||||||
sys-libs/libcap
|
|
||||||
acl? ( sys-apps/acl )
|
|
||||||
audit? ( >=sys-process/audit-2 )
|
|
||||||
cryptsetup? ( >=sys-fs/cryptsetup-1.6 )
|
|
||||||
gcrypt? ( >=dev-libs/libgcrypt-1.4.5 )
|
|
||||||
gudev? ( >=dev-libs/glib-2[${MULTILIB_USEDEP}] )
|
|
||||||
http? ( net-libs/libmicrohttpd )
|
|
||||||
introspection? ( >=dev-libs/gobject-introspection-1.31.1 )
|
|
||||||
kmod? ( >=sys-apps/kmod-14-r1 )
|
|
||||||
lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
|
|
||||||
pam? ( virtual/pam )
|
|
||||||
python? ( ${PYTHON_DEPS} )
|
|
||||||
qrcode? ( media-gfx/qrencode )
|
|
||||||
selinux? ( sys-libs/libselinux )
|
|
||||||
tcpd? ( sys-apps/tcp-wrappers )
|
|
||||||
xattr? ( sys-apps/attr )
|
|
||||||
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
|
|
||||||
openrc? ( >=sys-fs/udev-init-scripts-25 )
|
|
||||||
|| (
|
|
||||||
>=sys-apps/util-linux-2.22
|
|
||||||
<sys-apps/sysvinit-2.88-r4
|
|
||||||
)
|
|
||||||
!vanilla? ( sys-apps/gentoo-systemd-integration )
|
|
||||||
!sys-auth/nss-myhostname
|
|
||||||
!<sys-libs/glibc-2.10
|
|
||||||
!sys-fs/udev"
|
|
||||||
|
|
||||||
PDEPEND=">=sys-apps/hwids-20130717-r1[udev]
|
|
||||||
policykit? ( sys-auth/polkit )"
|
|
||||||
|
|
||||||
DEPEND="${COMMON_DEPEND}
|
|
||||||
app-arch/xz-utils
|
|
||||||
app-text/docbook-xml-dtd:4.2
|
|
||||||
app-text/docbook-xsl-stylesheets
|
|
||||||
dev-libs/libxslt
|
|
||||||
dev-util/gperf
|
|
||||||
>=dev-util/intltool-0.50
|
|
||||||
>=sys-devel/binutils-2.23.1
|
|
||||||
>=sys-devel/gcc-4.6
|
|
||||||
>=sys-kernel/linux-headers-${MINKV}
|
|
||||||
virtual/pkgconfig
|
|
||||||
doc? ( >=dev-util/gtk-doc-1.18 )"
|
|
||||||
|
|
||||||
pkg_pretend() {
|
|
||||||
local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS ~DEVTMPFS
|
|
||||||
~EPOLL ~FANOTIFY ~FHANDLE ~INOTIFY_USER ~IPV6 ~NET ~PROC_FS
|
|
||||||
~SECCOMP ~SIGNALFD ~SYSFS ~TIMERFD
|
|
||||||
~!IDE ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2"
|
|
||||||
|
|
||||||
use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
|
|
||||||
use pam && CONFIG_CHECK+=" ~AUDITSYSCALL"
|
|
||||||
kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
|
|
||||||
use firmware-loader || CONFIG_CHECK+=" ~!FW_LOADER_USER_HELPER"
|
|
||||||
|
|
||||||
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=(
|
|
||||||
--with-pamconfdir=/usr/share/pam.d
|
|
||||||
--with-dbuspolicydir=/usr/share/dbus-1/system.d
|
|
||||||
--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 kmod)
|
|
||||||
$(use_enable lzma xz)
|
|
||||||
$(use_enable pam)
|
|
||||||
$(use_enable policykit polkit)
|
|
||||||
$(use_enable python python-devel)
|
|
||||||
$(use python && echo PYTHON_CONFIG=/usr/bin/python-config-${EPYTHON#python})
|
|
||||||
$(use_enable qrcode qrencode)
|
|
||||||
$(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-pam
|
|
||||||
--disable-polkit
|
|
||||||
--disable-qrencode
|
|
||||||
--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: $(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=(
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
multilib_src_install_all() {
|
|
||||||
prune_libtool_files --modules
|
|
||||||
|
|
||||||
# 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 || die
|
|
||||||
rmdir "${D}"/etc/systemd/system/multi-user.target.wants || die
|
|
||||||
systemd_enable_service multi-user.target remote-fs.target
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst() {
|
|
||||||
# for udev rules
|
|
||||||
enewgroup dialout
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
if [[ ${ROOT} == "" || ${ROOT} == "/" ]]; then
|
|
||||||
udevadm control --reload
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Bug 468876
|
|
||||||
fcaps cap_dac_override,cap_sys_ptrace=ep usr/bin/systemd-detect-virt
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
@ -109,8 +109,25 @@ src_prepare() {
|
|||||||
epatch "${FILESDIR}"/211-handle-empty-etc-os-release.patch
|
epatch "${FILESDIR}"/211-handle-empty-etc-os-release.patch
|
||||||
|
|
||||||
# upstream fixes not yet in the release
|
# 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
|
epatch "${FILESDIR}"/211-tmpfiles.patch
|
||||||
epatch "${FILESDIR}"/211-0001-nspawn-allow-EEXIST-on-mkdir_safe-home-uid.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
|
||||||
|
|
||||||
if [[ ${PV} == *9999 ]]; then
|
if [[ ${PV} == *9999 ]]; then
|
||||||
if use doc; then
|
if use doc; then
|
Loading…
Reference in New Issue
Block a user