sys-apps/systemd: Bump to 234-r4

* Drop old

Package-Manager: Portage-2.3.5, Repoman-2.3.2
This commit is contained in:
Ettore Di Giacinto
2017-09-10 14:23:38 +02:00
parent 5eaed3c447
commit 8729be45cb
15 changed files with 811 additions and 1067 deletions
-4
View File
@@ -1,7 +1,3 @@
DIST systemd-228.tar.gz 4034401 SHA256 dd124ff561a07e6439ed2b3713f38ca914df7747f110ce86deea17b56d245ae6 SHA512 e54f282f550854dc082a4788709905e5767b75d2057e18d749b54821f2e44e0a8d1349b1a9180036cc854ecccaf5ff86b3b1dba4d3c2ce1b1fc766930ea4c0ea WHIRLPOOL 16b28367edc29a74f5b08691839da39a02d55bf5bcdffef55bfb1a2e8065eeecbe22a2b661e2d5f161f008d05baa000aff60d662d65db380d6c3fe0c1380eea1
DIST systemd-230-man.tar.gz 29191 SHA256 e09ddd909d7aedbf2c1fac7a8f487fd6d0fab0745867c4b948bf8d2cc18fb7a0 SHA512 0ba2f5b0f17ee824df0f6a07d1cbd6fcf7b29d0532a79e2f4cd7cce9e723b14910743badf534cb602729adfc0203e7e8e119bc59beec9fe0f293d5afcfb7cf0c WHIRLPOOL d71fb97e53c08aa4e5d28ca186a417a725d26c287d60372075fa70da9e2ec2796767af55fe4f312e6153566b042b06c02b2e2950eb7188561815a6a3d0b79f9b
DIST systemd-230-patches.tar.gz 11858 SHA256 7a40071ffa2e43dda5ac2dfc91a263b0599b32dd5590d968e1077bebfce5654b SHA512 302420aabedd07b5a0b00b1f2e7500913586e867e548bde4ef6ee81cb3bd1682bdeac061111f9d8e120f4111cde2c709ed02922d56b0940d5603daff18003215 WHIRLPOOL 44f5ecaa5655e8eba3832b662fd30c7c6ca22f5d34f5d538587aa90b437457e149cd8f99bd83aec863991ec9fb5aef867218ad73a333580fe22f322ab4e3746f
DIST systemd-230.tar.gz 4288027 SHA256 46b07568142adcd017c62e6230d39eb10d219ed3b2f13ffc12d9a3a6b1c840cd SHA512 a0057c5258055a6b4000eb762ab2ec3c5329361711540f7124ba5c4b1119a1b531ad336ddef3bbe5d08218c8d7f1fd175c86d61357ac72935a932921cff28a96 WHIRLPOOL 95404535eb85d3b8c20dc13b12427a9da1f92729eb9e66a58d7e990f09fee28762be00088897bf1bf485d9a34619799ff0171a161824cc8f135ac2438e978d1e
DIST systemd-231-man.tar.gz 29466 SHA256 aecf91c13333e1791d026b82360d55b4783f8d281c6e80bfe9d6bbf0bac633e4 SHA512 6c359f88da3e5dc01745f7255c021aafe495d9ca16c74277cbcfa05a6903093ec2c4746a34504d04f2aff464eeaa5518519577c831a08f4336552c6b6e05fdfd WHIRLPOOL 55371b404bfc945abc38d4cef5c555223abbee0993d56b506c896a851ba9ce283f0a020fe24ea273d3674f8a9dbe79b843d32eed93a59b2597b7bad113fbc3e1
DIST systemd-231.tar.gz 4381464 SHA256 899733ad6c157cedbb89aec4efe3bc824dcfd65a1d6f6bebc7b043f7924e39b4 SHA512 199fa33a0494d1d15f7fe3c796fe14913ad386766571d4d3fbb1cb1c446e04f6d06a965213be4c594a7183e810fc2fd4804fe14f64f21b0a1278b717889811c6 WHIRLPOOL 7779291e9fb9873cb1773b8583cf6d4b7dec837363ea89c4a73c1e397a76752b66f8b57d8fc4d9cef768cc1855b5e325ad88a8a69eb5380aa924e0a6dead41b1
DIST systemd-233-man.tar.gz 31386 SHA256 825e62eb82c4e23997061fc8f56f7ec9bb1e6ac1111d279c76c926cc2bfbf1dc SHA512 cc5215d3590ffc3c9203a64c14d6adeb0148c421c1396b8c1e43dcb58763b687ce99bdee327dd8a00abab7198171e73b22109a3f2032e4cec6adf2dcc85acf40 WHIRLPOOL ff1f36beff377f675047271df38503e8b71d615ea73c5fdfebf465edaf1fe29b4f89e3194d65cdf84eec9b7c3156de597627fdaffa4b86018520aaa127a7a159
+31
View File
@@ -0,0 +1,31 @@
From 75b554579b4e962e2c02053129a37611a2dc9133 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Mon, 14 Sep 2015 18:55:09 -0400
Subject: [PATCH] Add fallback for kcmp() in case __NR_kcmp is undefined
IA64 is missing this syscall as of linux-4.2.
This works around it until the necessary kernel patch gets merged.
---
src/basic/missing.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/basic/missing.h b/src/basic/missing.h
index dc1f244..371ef8a 100644
--- a/src/basic/missing.h
+++ b/src/basic/missing.h
@@ -1028,7 +1028,12 @@ static inline int renameat2(int oldfd, const char *oldname, int newfd, const cha
#if !HAVE_DECL_KCMP
static inline int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) {
+#if defined(__NR_kcmp)
return syscall(__NR_kcmp, pid1, pid2, type, idx1, idx2);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
#endif
--
2.6.4
@@ -0,0 +1,28 @@
From 3a44775e2618896526d093f7142934205e46d33a Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 25 Sep 2015 10:26:18 -0400
Subject: [PATCH] tmpfiles: Disable cleaning of /tmp and /var/tmp
Bug: https://bugs.gentoo.org/490676
---
tmpfiles.d/tmp.conf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tmpfiles.d/tmp.conf b/tmpfiles.d/tmp.conf
index ffdd82f..241fad5 100644
--- a/tmpfiles.d/tmp.conf
+++ b/tmpfiles.d/tmp.conf
@@ -8,8 +8,8 @@
# See tmpfiles.d(5) for details
# Clear tmp directories separately, to make them easier to override
-v /tmp 1777 root root 10d
-v /var/tmp 1777 root root 30d
+v /tmp 1777 root root
+v /var/tmp 1777 root root
# Exclude namespace mountpoints created with PrivateTmp=yes
x /tmp/systemd-private-%b-*
--
2.5.3
@@ -0,0 +1,117 @@
From 433e7893c6c0f6cbc98d8911fc5149ee9beedb79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 6 Jul 2017 13:54:42 -0400
Subject: [PATCH 2/3] core/load-fragment: refuse units with errors in
RootDirectory/RootImage/DynamicUser
Behaviour of the service is completely different with the option off, so the
service would probably mess up state on disk and do unexpected things.
---
src/core/load-fragment-gperf.gperf.m4 | 6 +++---
src/core/load-fragment.c | 7 +++++--
src/shared/conf-parser.c | 16 +++++++++++-----
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
index cb9e6fea2..d0868bf40 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -18,8 +18,8 @@ struct ConfigPerfItem;
m4_dnl Define the context options only once
m4_define(`EXEC_CONTEXT_CONFIG_ITEMS',
`$1.WorkingDirectory, config_parse_working_directory, 0, offsetof($1, exec_context)
-$1.RootDirectory, config_parse_unit_path_printf, 0, offsetof($1, exec_context.root_directory)
-$1.RootImage, config_parse_unit_path_printf, 0, offsetof($1, exec_context.root_image)
+$1.RootDirectory, config_parse_unit_path_printf, true, offsetof($1, exec_context.root_directory)
+$1.RootImage, config_parse_unit_path_printf, true, offsetof($1, exec_context.root_image)
$1.User, config_parse_user_group, 0, offsetof($1, exec_context.user)
$1.Group, config_parse_user_group, 0, offsetof($1, exec_context.group)
$1.SupplementaryGroups, config_parse_user_group_strv, 0, offsetof($1, exec_context.supplementary_groups)
@@ -35,7 +35,7 @@ $1.UMask, config_parse_mode, 0,
$1.Environment, config_parse_environ, 0, offsetof($1, exec_context.environment)
$1.EnvironmentFile, config_parse_unit_env_file, 0, offsetof($1, exec_context.environment_files)
$1.PassEnvironment, config_parse_pass_environ, 0, offsetof($1, exec_context.pass_environment)
-$1.DynamicUser, config_parse_bool, 0, offsetof($1, exec_context.dynamic_user)
+$1.DynamicUser, config_parse_bool, true, offsetof($1, exec_context.dynamic_user)
$1.StandardInput, config_parse_exec_input, 0, offsetof($1, exec_context)
$1.StandardOutput, config_parse_exec_output, 0, offsetof($1, exec_context)
$1.StandardError, config_parse_exec_output, 0, offsetof($1, exec_context)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 5b7471c0d..ae4ec5cf0 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -242,6 +242,7 @@ int config_parse_unit_path_printf(
_cleanup_free_ char *k = NULL;
Unit *u = userdata;
int r;
+ bool fatal = ltype;
assert(filename);
assert(lvalue);
@@ -250,8 +251,10 @@ int config_parse_unit_path_printf(
r = unit_full_printf(u, rvalue, &k);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers on %s, ignoring: %m", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to resolve unit specifiers on %s%s: %m",
+ fatal ? "" : ", ignoring", rvalue);
+ return fatal ? -ENOEXEC : 0;
}
return config_parse_path(unit, filename, line, section, section_line, lvalue, ltype, k, data, userdata);
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 265ac83dc..ffb905fb6 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -614,6 +614,7 @@ int config_parse_bool(const char* unit,
int k;
bool *b = data;
+ bool fatal = ltype;
assert(filename);
assert(lvalue);
@@ -622,8 +623,10 @@ int config_parse_bool(const char* unit,
k = parse_boolean(rvalue);
if (k < 0) {
- log_syntax(unit, LOG_ERR, filename, line, k, "Failed to parse boolean value, ignoring: %s", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, k,
+ "Failed to parse boolean value%s: %s",
+ fatal ? "" : ", ignoring", rvalue);
+ return fatal ? -ENOEXEC : 0;
}
*b = !!k;
@@ -714,6 +717,7 @@ int config_parse_path(
void *userdata) {
char **s = data, *n;
+ bool fatal = ltype;
assert(filename);
assert(lvalue);
@@ -722,12 +726,14 @@ int config_parse_path(
if (!utf8_is_valid(rvalue)) {
log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
- return 0;
+ return fatal ? -ENOEXEC : 0;
}
if (!path_is_absolute(rvalue)) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Not an absolute path, ignoring: %s", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, 0,
+ "Not an absolute path%s: %s",
+ fatal ? "" : ", ignoring", rvalue);
+ return fatal ? -ENOEXEC : 0;
}
n = strdup(rvalue);
--
2.13.2
@@ -0,0 +1,339 @@
From f135524cd4cd6b71e7f6073b02389da30c6e94d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 6 Jul 2017 13:28:19 -0400
Subject: [PATCH 3/3] core/load-fragment: refuse units with errors in certain
directives
If an error is encountered in any of the Exec* lines, WorkingDirectory,
SELinuxContext, ApparmorProfile, SmackProcessLabel, Service (in .socket
units), User, or Group, refuse to load the unit. If the config stanza
has support, ignore the failure if '-' is present.
For those configuration directives, even if we started the unit, it's
pretty likely that it'll do something unexpected (like write files
in a wrong place, or with a wrong context, or run with wrong permissions,
etc). It seems better to refuse to start the unit and have the admin
clean up the configuration without giving the service a chance to mess
up stuff.
Note that all "security" options that restrict what the unit can do
(Capabilities, AmbientCapabilities, Restrict*, SystemCallFilter, Limit*,
PrivateDevices, Protect*, etc) are _not_ treated like this. Such options are
only supplementary, and are not always available depending on the architecture
and compilation options, so unit authors have to make sure that the service
runs correctly without them anyway.
Fixes #6237, #6277.
---
src/core/load-fragment.c | 116 ++++++++++++++++++++++++++++------------------
src/test/test-unit-file.c | 14 +++---
2 files changed, 78 insertions(+), 52 deletions(-)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index ae4ec5cf0..f38240af3 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -637,26 +637,36 @@ int config_parse_exec(
r = unit_full_printf(u, f, &path);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers on %s, ignoring: %m", f);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to resolve unit specifiers on %s%s: %m",
+ f, ignore ? ", ignoring" : "");
+ return ignore ? 0 : -ENOEXEC;
}
if (isempty(path)) {
/* First word is either "-" or "@" with no command. */
- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty path in command line, ignoring: \"%s\"", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, 0,
+ "Empty path in command line%s: \"%s\"",
+ ignore ? ", ignoring" : "", rvalue);
+ return ignore ? 0 : -ENOEXEC;
}
if (!string_is_safe(path)) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path contains special characters, ignoring: %s", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, 0,
+ "Executable path contains special characters%s: %s",
+ ignore ? ", ignoring" : "", rvalue);
+ return ignore ? 0 : -ENOEXEC;
}
if (!path_is_absolute(path)) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path is not absolute, ignoring: %s", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, 0,
+ "Executable path is not absolute%s: %s",
+ ignore ? ", ignoring" : "", rvalue);
+ return ignore ? 0 : -ENOEXEC;
}
if (endswith(path, "/")) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path specifies a directory, ignoring: %s", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, 0,
+ "Executable path specifies a directory%s: %s",
+ ignore ? ", ignoring" : "", rvalue);
+ return ignore ? 0 : -ENOEXEC;
}
if (!separate_argv0) {
@@ -709,12 +719,14 @@ int config_parse_exec(
if (r == 0)
break;
if (r < 0)
- return 0;
+ return ignore ? 0 : -ENOEXEC;
r = unit_full_printf(u, word, &resolved);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to resolve unit specifiers on %s, ignoring: %m", word);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to resolve unit specifiers on %s%s: %m",
+ word, ignore ? ", ignoring" : "");
+ return ignore ? 0 : -ENOEXEC;
}
if (!GREEDY_REALLOC(n, nbufsize, nlen + 2))
@@ -725,8 +737,10 @@ int config_parse_exec(
}
if (!n || !n[0]) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty executable name or zeroeth argument, ignoring: %s", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, 0,
+ "Empty executable name or zeroeth argument%s: %s",
+ ignore ? ", ignoring" : "", rvalue);
+ return ignore ? 0 : -ENOEXEC;
}
nce = new0(ExecCommand, 1);
@@ -1333,8 +1347,10 @@ int config_parse_exec_selinux_context(
r = unit_full_printf(u, rvalue, &k);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to resolve specifiers%s: %m",
+ ignore ? ", ignoring" : "");
+ return ignore ? 0 : -ENOEXEC;
}
free(c->selinux_context);
@@ -1381,8 +1397,10 @@ int config_parse_exec_apparmor_profile(
r = unit_full_printf(u, rvalue, &k);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to resolve specifiers%s: %m",
+ ignore ? ", ignoring" : "");
+ return ignore ? 0 : -ENOEXEC;
}
free(c->apparmor_profile);
@@ -1429,8 +1447,10 @@ int config_parse_exec_smack_process_label(
r = unit_full_printf(u, rvalue, &k);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m");
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to resolve specifiers%s: %m",
+ ignore ? ", ignoring" : "");
+ return ignore ? 0 : -ENOEXEC;
}
free(c->smack_process_label);
@@ -1648,19 +1668,19 @@ int config_parse_socket_service(
r = unit_name_printf(UNIT(s), rvalue, &p);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %s", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers: %s", rvalue);
+ return -ENOEXEC;
}
if (!endswith(p, ".service")) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service, ignoring: %s", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service: %s", rvalue);
+ return -ENOEXEC;
}
r = manager_load_unit(UNIT(s)->manager, p, NULL, &error, &x);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s, ignoring: %s", rvalue, bus_error_message(&error, r));
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s: %s", rvalue, bus_error_message(&error, r));
+ return -ENOEXEC;
}
unit_ref_set(&s->service, x);
@@ -1911,13 +1931,13 @@ int config_parse_user_group(
r = unit_full_printf(u, rvalue, &k);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", rvalue);
+ return -ENOEXEC;
}
if (!valid_user_group_name_or_id(k)) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k);
+ return -ENOEXEC;
}
n = k;
@@ -1975,19 +1995,19 @@ int config_parse_user_group_strv(
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
- break;
+ log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax: %s", rvalue);
+ return -ENOEXEC;
}
r = unit_full_printf(u, word, &k);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", word);
- continue;
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", word);
+ return -ENOEXEC;
}
if (!valid_user_group_name_or_id(k)) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k);
- continue;
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k);
+ return -ENOEXEC;
}
r = strv_push(users, k);
@@ -2146,25 +2166,28 @@ int config_parse_working_directory(
r = unit_full_printf(u, rvalue, &k);
if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in working directory path '%s', ignoring: %m", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to resolve unit specifiers in working directory path '%s'%s: %m",
+ rvalue, missing_ok ? ", ignoring" : "");
+ return missing_ok ? 0 : -ENOEXEC;
}
path_kill_slashes(k);
if (!utf8_is_valid(k)) {
log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
- return 0;
+ return missing_ok ? 0 : -ENOEXEC;
}
if (!path_is_absolute(k)) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Working directory path '%s' is not absolute, ignoring.", rvalue);
- return 0;
+ log_syntax(unit, LOG_ERR, filename, line, 0,
+ "Working directory path '%s' is not absolute%s.",
+ rvalue, missing_ok ? ", ignoring" : "");
+ return missing_ok ? 0 : -ENOEXEC;
}
- free_and_replace(c->working_directory, k);
-
c->working_directory_home = false;
+ free_and_replace(c->working_directory, k);
}
c->working_directory_missing_ok = missing_ok;
@@ -4444,8 +4467,11 @@ int unit_load_fragment(Unit *u) {
return r;
r = load_from_path(u, k);
- if (r < 0)
+ if (r < 0) {
+ if (r == -ENOEXEC)
+ log_unit_notice(u, "Unit configuration has fatal error, unit will not be started.");
return r;
+ }
if (u->load_state == UNIT_STUB) {
SET_FOREACH(t, u->names, i) {
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index 12f48bf43..fd797b587 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -146,7 +146,7 @@ static void test_config_parse_exec(void) {
r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, "/RValue/ argv0 r1",
&c, u);
- assert_se(r == 0);
+ assert_se(r == -ENOEXEC);
assert_se(c1->command_next == NULL);
log_info("/* honour_argv0 */");
@@ -161,7 +161,7 @@ static void test_config_parse_exec(void) {
r = config_parse_exec(NULL, "fake", 3, "section", 1,
"LValue", 0, "@/RValue",
&c, u);
- assert_se(r == 0);
+ assert_se(r == -ENOEXEC);
assert_se(c1->command_next == NULL);
log_info("/* no command, whitespace only, reset */");
@@ -220,7 +220,7 @@ static void test_config_parse_exec(void) {
"-@/RValue argv0 r1 ; ; "
"/goo/goo boo",
&c, u);
- assert_se(r >= 0);
+ assert_se(r == -ENOEXEC);
c1 = c1->command_next;
check_execcommand(c1, "/RValue", "argv0", "r1", NULL, true);
@@ -374,7 +374,7 @@ static void test_config_parse_exec(void) {
r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, path,
&c, u);
- assert_se(r == 0);
+ assert_se(r == -ENOEXEC);
assert_se(c1->command_next == NULL);
}
@@ -401,21 +401,21 @@ static void test_config_parse_exec(void) {
r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, "/path\\",
&c, u);
- assert_se(r == 0);
+ assert_se(r == -ENOEXEC);
assert_se(c1->command_next == NULL);
log_info("/* missing ending ' */");
r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, "/path 'foo",
&c, u);
- assert_se(r == 0);
+ assert_se(r == -ENOEXEC);
assert_se(c1->command_next == NULL);
log_info("/* missing ending ' with trailing backslash */");
r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, "/path 'foo\\",
&c, u);
- assert_se(r == 0);
+ assert_se(r == -ENOEXEC);
assert_se(c1->command_next == NULL);
log_info("/* invalid space between modifiers */");
--
2.13.2
@@ -0,0 +1,84 @@
From 3e7d14d78c4d15ec7789299216cbf5c58e61547b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 3 Jun 2017 05:41:17 -0400
Subject: [PATCH] sd-bus: silence format warnings in kdbus code (#6072)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The code is mostly correct, but gcc is trying to outsmart us, and emits a
warning for a "llu vs lu" mismatch, even though they are the same size (on alpha):
src/libsystemd/sd-bus/bus-control.c: In function kernel_get_list:
src/libsystemd/sd-bus/bus-control.c:267:42: error: format %llu expects argument of type long long unsigned int, but argument 3 has type __u64 {aka long unsigned int} [-Werror=format=]
if (asprintf(&n, ":1.%llu", name->id) < 0) {
^
src/libsystemd/sd-bus/bus-control.c: In function bus_get_name_creds_kdbus:
src/libsystemd/sd-bus/bus-control.c:714:47: error: format %llu expects argument of type long long unsigned int, but argument 3 has type __u64 {aka long unsigned int} [-Werror=format=]
if (asprintf(&c->unique_name, ":1.%llu", conn_info->id) < 0) {
^
This is hard to work around properly, because kdbus.h uses __u64 which is
defined-differently-despite-being-the-same-size then uint64_t. Thus the simple
solution of using %PRIu64 fails on amd64:
src/libsystemd/sd-bus/bus-control.c:714:47: error: format %lu expects argument of type long unsigned int, but argument 3 has type __u64 {aka long long unsigned int} [-Werror=format=]
if (asprintf(&c->unique_name, ":1.%"PRIu64, conn_info->id) < 0) {
^~~~~~
Let's just avoid the whole issue for now by silencing the warning.
After the next release, we should just get rid of the kdbus code.
Fixes #5561.
---
src/libsystemd/sd-bus/bus-control.c | 6 ++++++
src/libsystemd/sd-bus/bus-kernel.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 9e58ffbd8..303ae0f23 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -264,10 +264,13 @@ static int kernel_get_list(sd_bus *bus, uint64_t flags, char ***x) {
if ((flags & KDBUS_LIST_UNIQUE) && name->id != previous_id && !(name->flags & KDBUS_HELLO_ACTIVATOR)) {
char *n;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat"
if (asprintf(&n, ":1.%llu", name->id) < 0) {
r = -ENOMEM;
goto fail;
}
+#pragma GCC diagnostic pop
r = strv_consume(x, n);
if (r < 0)
@@ -711,10 +714,13 @@ int bus_get_name_creds_kdbus(
}
if (mask & SD_BUS_CREDS_UNIQUE_NAME) {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat"
if (asprintf(&c->unique_name, ":1.%llu", conn_info->id) < 0) {
r = -ENOMEM;
goto fail;
}
+#pragma GCC diagnostic pop
c->mask |= SD_BUS_CREDS_UNIQUE_NAME;
}
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index c82caeb3f..ca6aee7c0 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -51,6 +51,8 @@
#include "user-util.h"
#include "util.h"
+#pragma GCC diagnostic ignored "-Wformat"
+
#define UNIQUE_NAME_MAX (3+DECIMAL_STR_MAX(uint64_t))
int bus_kernel_parse_unique_name(const char *s, uint64_t *id) {
--
2.13.2
@@ -1,7 +1,7 @@
From d9287b10d714175521e3bcd6c53de4819b1357c5 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Mon, 17 Jul 2017 11:21:25 -0400
Subject: [PATCH] path-lookup: look for generators in
Subject: [PATCH 1/3] path-lookup: look for generators in
{,/usr}/lib/systemd/system-generators
Bug: https://bugs.gentoo.org/625402
@@ -23,5 +23,5 @@ index e2b3f8b74..1ee0e1cdb 100644
NULL);
--
2.13.3
2.14.0
@@ -0,0 +1,43 @@
From 793c786f470aeedf443686cff30f97acaff23a04 Mon Sep 17 00:00:00 2001
From: Andrew Soutar <andrew@andrewsoutar.com>
Date: Mon, 31 Jul 2017 02:19:16 -0400
Subject: [PATCH 2/3] cryptsetup: fix infinite timeout (#6486)
0004f698d causes `arg_timeout` to be infinity instead of 0 when timeout=0. The
logic here now matches this change.
Fixes #6381
---
src/cryptsetup/cryptsetup.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 3b4c08616..08ed7e53b 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -56,7 +56,7 @@ static bool arg_tcrypt_veracrypt = false;
static char **arg_tcrypt_keyfiles = NULL;
static uint64_t arg_offset = 0;
static uint64_t arg_skip = 0;
-static usec_t arg_timeout = 0;
+static usec_t arg_timeout = USEC_INFINITY;
/* Options Debian's crypttab knows we don't:
@@ -670,10 +670,10 @@ int main(int argc, char *argv[]) {
if (arg_discards)
flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
- if (arg_timeout > 0)
- until = now(CLOCK_MONOTONIC) + arg_timeout;
- else
+ if (arg_timeout == USEC_INFINITY)
until = 0;
+ else
+ until = now(CLOCK_MONOTONIC) + arg_timeout;
arg_key_size = (arg_key_size > 0 ? arg_key_size : (256 / 8));
--
2.14.0
@@ -0,0 +1,92 @@
From 47d36aeaebc3083795de40c80e75f0fda48c3053 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 21 Jul 2017 07:51:07 -0400
Subject: [PATCH 3/3] resolved: make sure idn2 conversions are roundtrippable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
While working on the gateway→_gateway conversion, I noticed that
libidn2 strips the leading underscore in some names.
https://gitlab.com/libidn/libidn2/issues/30 was resolved in
https://gitlab.com/libidn/libidn2/commit/05d753ea69e2308cd02436d0511f4b844071dc79,
which disabled "STD3 ASCII rules" by default, i.e. disabled stripping
of underscores. So the situation is that with previously released libidn2
versions we would get incorrect behaviour, and once new libidn2 is released,
we should be OK.
Let's implement a simple test which checks that the name survives the
roundtrip, and if it doesn't, skip IDN resolution. Under old libidn2 this will
fail in more cases, and under new libidn2 in fewer, but should be the right
thing to do also under new libidn2.
---
src/shared/dns-domain.c | 29 ++++++++++++++++++++++++++---
src/test/test-dns-domain.c | 6 ++++++
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index 12c4d65dd..139d286af 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -1274,15 +1274,38 @@ int dns_name_apply_idna(const char *name, char **ret) {
#if defined(HAVE_LIBIDN2)
int r;
+ _cleanup_free_ char *t = NULL;
assert(name);
assert(ret);
- r = idn2_lookup_u8((uint8_t*) name, (uint8_t**) ret,
+ r = idn2_lookup_u8((uint8_t*) name, (uint8_t**) &t,
IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL);
- if (r == IDN2_OK)
+ log_debug("idn2_lookup_u8: %s → %s", name, t);
+ if (r == IDN2_OK) {
+ if (!startswith(name, "xn--")) {
+ _cleanup_free_ char *s = NULL;
+
+ r = idn2_to_unicode_8z8z(t, &s, 0);
+ if (r != IDN2_OK) {
+ log_debug("idn2_to_unicode_8z8z(\"%s\") failed: %d/%s",
+ t, r, idn2_strerror(r));
+ return 0;
+ }
+
+ if (!streq_ptr(name, s)) {
+ log_debug("idn2 roundtrip failed: \"%s\" → \"%s\" → \"%s\", ignoring.",
+ name, t, s);
+ return 0;
+ }
+ }
+
+ *ret = t;
+ t = NULL;
return 1; /* *ret has been written */
- log_debug("idn2_lookup_u8(\"%s\") failed: %s", name, idn2_strerror(r));
+ }
+
+ log_debug("idn2_lookup_u8(\"%s\") failed: %d/%s", name, r, idn2_strerror(r));
if (r == IDN2_2HYPHEN)
/* The name has two hypens — forbidden by IDNA2008 in some cases */
return 0;
diff --git a/src/test/test-dns-domain.c b/src/test/test-dns-domain.c
index 11cf0b1f0..cbd2d1e65 100644
--- a/src/test/test-dns-domain.c
+++ b/src/test/test-dns-domain.c
@@ -652,6 +652,12 @@ static void test_dns_name_apply_idna(void) {
test_dns_name_apply_idna_one("föö.bär.", ret, "xn--f-1gaa.xn--br-via");
test_dns_name_apply_idna_one("xn--f-1gaa.xn--br-via", ret, "xn--f-1gaa.xn--br-via");
+ test_dns_name_apply_idna_one("_443._tcp.fedoraproject.org", ret2,
+ "_443._tcp.fedoraproject.org");
+ test_dns_name_apply_idna_one("_443", ret2, "_443");
+ test_dns_name_apply_idna_one("gateway", ret, "gateway");
+ test_dns_name_apply_idna_one("_gateway", ret2, "_gateway");
+
test_dns_name_apply_idna_one("r3---sn-ab5l6ne7.googlevideo.com", ret2,
ret2 ? "r3---sn-ab5l6ne7.googlevideo.com" : "");
}
--
2.14.0
@@ -0,0 +1,29 @@
From f7d27d130eaac222b2d11c4d4415c9b599934da8 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sat, 26 Aug 2017 15:19:26 +0200
Subject: [PATCH] logind: make sure we don't process the same method call twice
(#6583)
Tiny mistake, big effect.
Fixes: #6375
---
src/login/logind-session-dbus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
index 22e5349a6..649f3c155 100644
--- a/src/login/logind-session-dbus.c
+++ b/src/login/logind-session-dbus.c
@@ -457,7 +457,7 @@ static int method_take_device(sd_bus_message *message, void *userdata, sd_bus_er
goto error;
session_save(s);
- return 0;
+ return 1;
error:
session_device_free(sd);
--
2.14.1
@@ -0,0 +1,11 @@
--- a/rules/50-udev-default.rules.in
+++ b/rules/50-udev-default.rules.in
@@ -22,7 +22,7 @@
SUBSYSTEM=="tty", KERNEL=="ttysclp[0-9]*", GROUP="tty", MODE="0620"
SUBSYSTEM=="tty", KERNEL=="3270/tty[0-9]*", GROUP="tty", MODE="0620"
SUBSYSTEM=="vc", KERNEL=="vcs*|vcsa*", GROUP="tty"
-KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"
+KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="uucp"
SUBSYSTEM=="mem", KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640"
+25 -21
View File
@@ -1,32 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer>
<maintainer type="project">
<email>systemd@gentoo.org</email>
<name>Gentoo systemd team</name>
</maintainer>
<slots>
<subslots>Incremented for ABI breaks in libudev or libsystemd</subslots>
</slots>
<use>
<flag name='apparmor'>Enable AppArmor support</flag>
<flag name='audit'>Enable support for <pkg>sys-process/audit</pkg></flag>
<flag name="apparmor">Enable AppArmor support</flag>
<flag name="audit">Enable support for <pkg>sys-process/audit</pkg></flag>
<!-- TODO: drop reference to systemd-import once the oldest release in tree is >218 -->
<flag name='curl'>Enable support for uploading journals; required to build systemd-import/systemd-pull</flag>
<flag name='cryptsetup'>Enable cryptsetup tools (includes unit generator for crypttab)</flag>
<flag name='firmware-loader'>Enable user-space firmware loader (for kernels prior to 3.8)</flag>
<flag name='gnuefi'>Enable EFI boot manager and stub loader (built using <pkg>sys-boot/gnu-efi</pkg>)</flag>
<flag name='elfutils'>Enable coredump stacktraces in the journal</flag>
<flag name="curl">Enable support for uploading journals; required to build systemd-import/systemd-pull</flag>
<flag name="cryptsetup">Enable cryptsetup tools (includes unit generator for crypttab)</flag>
<flag name="doc">Generate systemd.index.7 and systemd.directives.7</flag>
<flag name="gnuefi">Enable EFI boot manager and stub loader (built using <pkg>sys-boot/gnu-efi</pkg>)</flag>
<flag name="elfutils">Enable coredump stacktraces in the journal</flag>
<!-- TODO: drop reference to systemd-import once the oldest release in tree is >218 -->
<flag name='gcrypt'>Enable sealing of journal files using gcrypt; required to build systemd-import/systemd-pull</flag>
<flag name="gudev">enable libudev gobject interface</flag>
<flag name='http'>Enable embedded HTTP server in journald</flag>
<flag name='importd'>Enable import daemon</flag>
<flag name='kdbus'>Connect to kernel dbus (KDBUS) instead of userspace dbus if available</flag>
<flag name='kmod'>Enable kernel module loading via <pkg>sys-apps/kmod</pkg></flag>
<flag name='lz4'>Enable lz4 compression for the journal</flag>
<flag name='nat'>Enable support for network address translation in networkd</flag>
<flag name='qrcode'>Enable qrcode output support in journal</flag>
<flag name='sysv-utils'>Install sysvinit compatibility symlinks and manpages for init, telinit, halt, poweroff, reboot, runlevel, and shutdown</flag>
<flag name='terminal'>Enable experimental userspace virtual terminal support</flag>
<flag name='vanilla'>Disable Gentoo-specific behavior and compatibility quirks</flag>
<flag name='xkb'>Validate XKB keymap in logind</flag>
<flag name="gcrypt">Enable sealing of journal files using gcrypt; required to build systemd-import/systemd-pull</flag>
<flag name="http">Enable embedded HTTP server in journald</flag>
<flag name="importd">Enable import daemon</flag>
<flag name="kmod">Enable kernel module loading via <pkg>sys-apps/kmod</pkg></flag>
<flag name="libidn2">If IDN support is enabled, use <pkg>net-dns/libidn2</pkg> instead of <pkg>net-dns/libidn</pkg></flag>
<flag name="lz4">Enable lz4 compression for the journal</flag>
<flag name="nat">Enable support for network address translation in networkd</flag>
<flag name="qrcode">Enable qrcode output support in journal</flag>
<flag name="sysv-utils">Install sysvinit compatibility symlinks and manpages for init, telinit, halt, poweroff, reboot, runlevel, and shutdown</flag>
<flag name="vanilla">Disable Gentoo-specific behavior and compatibility quirks</flag>
<flag name="xkb">Depend on <pkg>x11-libs/libxkbcommon</pkg> to allow logind to control the X11 keymap</flag>
</use>
<upstream>
<remote-id type="github">systemd/systemd</remote-id>
</upstream>
</pkgmetadata>
-507
View File
@@ -1,507 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://github.com/systemd/systemd.git"
inherit git-r3
else
SRC_URI="https://github.com/systemd/systemd/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"
fi
inherit autotools bash-completion-r1 linux-info multilib \
multilib-minimal pam systemd toolchain-funcs udev user
DESCRIPTION="System and service manager for Linux"
HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd"
LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
SLOT="0/2"
IUSE="acl apparmor audit cryptsetup curl elfutils gcrypt gnuefi http
idn importd +kdbus +kmod +lz4 lzma nat pam policykit
qrcode +seccomp selinux ssl sysv-utils test vanilla xkb"
REQUIRED_USE="importd? ( curl gcrypt lzma )"
MINKV="3.11"
COMMON_DEPEND=">=sys-apps/util-linux-2.27.1:0=[${MULTILIB_USEDEP}]
sys-libs/libcap:0=[${MULTILIB_USEDEP}]
!<sys-libs/glibc-2.16
acl? ( sys-apps/acl:0= )
apparmor? ( sys-libs/libapparmor:0= )
audit? ( >=sys-process/audit-2:0= )
cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= )
curl? ( net-misc/curl:0= )
elfutils? ( >=dev-libs/elfutils-0.158:0= )
gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] )
http? (
>=net-libs/libmicrohttpd-0.9.33:0=
ssl? ( >=net-libs/gnutls-3.1.4:0= )
)
idn? ( net-dns/libidn:0= )
importd? (
app-arch/bzip2:0=
sys-libs/zlib:0=
)
kmod? ( >=sys-apps/kmod-15:0= )
lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] )
lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] )
nat? ( net-firewall/iptables:0= )
pam? ( virtual/pam:= )
qrcode? ( media-gfx/qrencode:0= )
seccomp? ( sys-libs/libseccomp:0= )
selinux? ( sys-libs/libselinux:0= )
sysv-utils? (
!sys-apps/systemd-sysv-utils
!sys-apps/sysvinit )
xkb? ( >=x11-libs/libxkbcommon-0.4.1: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-auth/nss-myhostname
!sys-fs/eudev
!sys-fs/udev"
# sys-apps/dbus: the daemon only (+ build-time lib dep for tests)
PDEPEND=">=sys-apps/dbus-1.6.8-r1:0[systemd]
>=sys-apps/hwids-20150417[udev]
>=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-apps/coreutils-8.16
>=sys-devel/binutils-2.23.1
>=sys-devel/gcc-4.6
>=sys-kernel/linux-headers-${MINKV}
virtual/pkgconfig
gnuefi? ( >=sys-boot/gnu-efi-3.0.2 )
test? ( >=sys-apps/dbus-1.6.8-r1:0 )
app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-libs/libxslt:0
"
pkg_pretend() {
local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS
~DEVTMPFS ~DMIID ~EPOLL ~FANOTIFY ~FHANDLE
~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SECCOMP ~SIGNALFD ~SYSFS
~TIMERFD ~TMPFS_XATTR
~!FW_LOADER_USER_HELPER ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED
~!SYSFS_DEPRECATED_V2"
use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
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
check_extra_config
fi
}
pkg_setup() {
:
}
src_unpack() {
default
[[ ${PV} != 9999 ]] || git-r3_src_unpack
}
src_prepare() {
# Bug 463376
sed -i -e 's/GROUP="dialout"/GROUP="uucp"/' rules/*.rules || die
epatch "${FILESDIR}/218-Dont-enable-audit-by-default.patch"
epatch "${FILESDIR}/228-noclean-tmp.patch"
epatch "${FILESDIR}/226-no-udevd-start-loginfo.patch"
epatch_user
# Avoid the log bloat to the user
sed -i -e 's/#SystemMaxUse=/SystemMaxUse=500M/' src/journal/journald.conf || die
eautoreconf
}
src_configure() {
# Keep using the one where the rules were installed.
MY_UDEVDIR=$(get_udevdir)
# Fix systems broken by bug #509454.
[[ ${MY_UDEVDIR} ]] || MY_UDEVDIR=/lib/udev
# Prevent conflicts with i686 cross toolchain, bug 559726
tc-export AR CC NM OBJCOPY RANLIB
multilib-minimal_src_configure
}
multilib_src_configure() {
local myeconfargs=(
# disable -flto since it is an optimization flag
# and makes distcc less effective
cc_cv_CFLAGS__flto=no
# Workaround for gcc-4.7, bug 554454.
cc_cv_CFLAGS__Werror_shadow=no
# Workaround for bug 516346
--enable-dependency-tracking
--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
# For testing.
--with-rootprefix="${ROOTPREFIX-/usr}"
--with-rootlibdir="${ROOTPREFIX-/usr}/$(get_libdir)"
# disable sysv compatibility
--with-sysvinit-path=
--with-sysvrcnd-path=
# no deps
--enable-efi
--enable-ima
--without-python
# Optional components/dependencies
$(multilib_native_use_enable acl)
$(multilib_native_use_enable apparmor)
$(multilib_native_use_enable audit)
$(multilib_native_use_enable cryptsetup libcryptsetup)
$(multilib_native_use_enable curl libcurl)
$(multilib_native_use_enable elfutils)
$(use_enable gcrypt)
$(multilib_native_use_enable gnuefi)
$(multilib_native_use_enable http microhttpd)
$(usex http $(multilib_native_use_enable ssl gnutls) --disable-gnutls)
$(multilib_native_use_enable idn libidn)
$(multilib_native_use_enable importd)
$(multilib_native_use_enable importd bzip2)
$(multilib_native_use_enable importd zlib)
$(use_enable kdbus)
$(multilib_native_use_enable kmod)
$(use_enable lz4)
$(use_enable lzma xz)
$(multilib_native_use_enable nat libiptc)
$(multilib_native_use_enable pam)
$(multilib_native_use_enable policykit polkit)
$(multilib_native_use_enable qrcode qrencode)
$(multilib_native_use_enable seccomp)
$(multilib_native_use_enable selinux)
$(multilib_native_use_enable test tests)
$(multilib_native_use_enable test dbus)
$(multilib_native_use_enable xkb xkbcommon)
# hardcode a few paths to spare some deps
QUOTAON=/usr/sbin/quotaon
QUOTACHECK=/usr/sbin/quotacheck
# TODO: we may need to restrict this to gcc
EFI_CC="$(tc-getCC)"
# dbus paths
--with-dbuspolicydir="${EPREFIX}/etc/dbus-1/system.d"
--with-dbussessionservicedir="${EPREFIX}/usr/share/dbus-1/services"
--with-dbussystemservicedir="${EPREFIX}/usr/share/dbus-1/system-services"
--with-ntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
)
# Work around bug 463846.
tc-export CC
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
}
multilib_src_compile() {
local mymakeopts=(
udevlibexecdir="${MY_UDEVDIR}"
)
if multilib_is_native_abi; then
emake "${mymakeopts[@]}"
else
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
# Needed for bus-related tests
local -x SANDBOX_WRITE=${SANDBOX_WRITE}
addwrite /sys/fs/kdbus
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-pkgincludeHEADERS
)
emake "${mymakeopts[@]}"
fi
# install compat pkg-config files
# Change dbus to >=sys-apps/dbus-1.8.8 if/when this is dropped.
local pcfiles=( src/compat-libs/libsystemd-{daemon,id128,journal,login}.pc )
emake "${mymakeopts[@]}" install-pkgconfiglibDATA \
pkgconfiglib_DATA="${pcfiles[*]}"
# Sabayon: create systemd-run symlink in /bin. lvm2 lvmetad has a
# udev rule that expects systemd-run to be in /bin. And lvmetad is
# used by Anaconda.
dosym "../usr/bin/systemd-run" "/bin/systemd-run"
}
multilib_src_install_all() {
prune_libtool_files --modules
einstalldocs
if use sysv-utils; then
for app in halt poweroff reboot runlevel shutdown telinit; do
dosym "..${ROOTPREFIX-/usr}/bin/systemctl" /sbin/${app}
done
dosym "..${ROOTPREFIX-/usr}/lib/systemd/systemd" /sbin/init
else
# 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
fi
# Disable storing coredumps in journald, bug #433457
mv "${D}"/usr/lib/sysctl.d/50-coredump.conf{,.disabled} || die
# Preserve empty dirs in /etc & /var, bug #437008
keepdir /etc/binfmt.d /etc/modules-load.d /etc/tmpfiles.d \
/etc/systemd/ntp-units.d /etc/systemd/user /var/lib/systemd \
/var/log/journal/remote
# Symlink /etc/sysctl.conf for easy migration.
dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf
# If we install these symlinks, there is no way for the sysadmin to remove them
# permanently.
rm "${D}"/etc/systemd/system/multi-user.target.wants/systemd-networkd.service || die
rm "${D}"/etc/systemd/system/multi-user.target.wants/systemd-resolved.service || die
rm -r "${D}"/etc/systemd/system/network-online.target.wants || die
rm -r "${D}"/etc/systemd/system/sockets.target.wants || die
rm -r "${D}"/etc/systemd/system/sysinit.target.wants || die
# Offer a default blacklist that should cover the most
# common use cases.
insinto /etc/modprobe.d
newins "${FILESDIR}"/blacklist-146 blacklist.conf
}
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
}
reenable_unit() {
if systemctl is-enabled --root="${ROOT}" "$1" &> /dev/null; then
ebegin "Re-enabling $1"
systemctl reenable --root="${ROOT}" "$1"
eend $? || FAIL=1
fi
}
pkg_postinst() {
newusergroup() {
enewgroup "$1"
enewuser "$1" -1 -1 -1 "$1"
}
enewgroup input
enewgroup systemd-journal
newusergroup systemd-bus-proxy
newusergroup systemd-journal-gateway
newusergroup systemd-journal-remote
newusergroup systemd-journal-upload
newusergroup systemd-network
newusergroup systemd-resolve
newusergroup systemd-timesync
use http && newusergroup systemd-journal-gateway
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 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
# Re-enable systemd-networkd for socket activation
reenable_unit systemd-networkd.service
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 [[ $(readlink "${ROOT}"/etc/resolv.conf) == */run/systemd/network/resolv.conf ]]; then
ewarn "resolv.conf is now generated by systemd-resolved. To use it, enable"
ewarn "systemd-resolved.service, and create a symlink from /etc/resolv.conf"
ewarn "to /run/systemd/resolve/resolv.conf"
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
if has_version sys-apps/openrc &&
! has_version sys-fs/udev-init-scripts; then
elog "If you plan to boot using OpenRC and udev or eudev, you"
elog "need to install the udev-init-scripts package."
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
}
-528
View File
@@ -1,528 +0,0 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://github.com/systemd/systemd.git"
inherit git-r3
else
SRC_URI="https://github.com/systemd/systemd/archive/v${PV}.tar.gz -> ${P}.tar.gz
!doc? ( https://dev.gentoo.org/~floppym/dist/${P}-man.tar.gz )
https://dev.gentoo.org/~floppym/dist/${P}-patches.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
fi
PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} )
inherit autotools bash-completion-r1 linux-info multilib-minimal pam python-any-r1 systemd toolchain-funcs udev user
DESCRIPTION="System and service manager for Linux"
HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
SLOT="0/2"
IUSE="acl apparmor audit cryptsetup curl doc elfutils +gcrypt gnuefi http
idn importd +kdbus +kmod +lz4 lzma nat pam policykit
qrcode +seccomp selinux ssl sysv-utils test vanilla xkb"
REQUIRED_USE="importd? ( curl gcrypt lzma )"
MINKV="3.11"
COMMON_DEPEND=">=sys-apps/util-linux-2.27.1:0=[${MULTILIB_USEDEP}]
sys-libs/libcap:0=[${MULTILIB_USEDEP}]
!<sys-libs/glibc-2.16
acl? ( sys-apps/acl:0= )
apparmor? ( sys-libs/libapparmor:0= )
audit? ( >=sys-process/audit-2:0= )
cryptsetup? ( >=sys-fs/cryptsetup-1.6:0= )
curl? ( net-misc/curl:0= )
elfutils? ( >=dev-libs/elfutils-0.158:0= )
gcrypt? ( >=dev-libs/libgcrypt-1.4.5:0=[${MULTILIB_USEDEP}] )
http? (
>=net-libs/libmicrohttpd-0.9.33:0=
ssl? ( >=net-libs/gnutls-3.1.4:0= )
)
idn? ( net-dns/libidn:0= )
importd? (
app-arch/bzip2:0=
sys-libs/zlib:0=
)
kmod? ( >=sys-apps/kmod-15:0= )
lz4? ( >=app-arch/lz4-0_p131:0=[${MULTILIB_USEDEP}] )
lzma? ( >=app-arch/xz-utils-5.0.5-r1:0=[${MULTILIB_USEDEP}] )
nat? ( net-firewall/iptables:0= )
pam? ( virtual/pam:= )
qrcode? ( media-gfx/qrencode:0= )
seccomp? ( sys-libs/libseccomp:0= )
selinux? ( sys-libs/libselinux:0= )
sysv-utils? (
!sys-apps/systemd-sysv-utils
!sys-apps/sysvinit )
xkb? ( >=x11-libs/libxkbcommon-0.4.1: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
selinux? ( sec-policy/selinux-systemd )
!sys-auth/nss-myhostname
!<sys-kernel/dracut-044
!sys-fs/eudev
!sys-fs/udev"
# sys-apps/dbus: the daemon only (+ build-time lib dep for tests)
PDEPEND=">=sys-apps/dbus-1.8.8:0[systemd]
>=sys-apps/hwids-20150417[udev]
>=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-apps/coreutils-8.16
>=sys-devel/binutils-2.23.1
>=sys-devel/gcc-4.6
>=sys-kernel/linux-headers-${MINKV}
virtual/pkgconfig
gnuefi? ( >=sys-boot/gnu-efi-3.0.2 )
test? ( >=sys-apps/dbus-1.6.8-r1:0 )
app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5
app-text/docbook-xsl-stylesheets
dev-libs/libxslt:0
doc? ( $(python_gen_any_dep 'dev-python/lxml[${PYTHON_USEDEP}]') )
"
python_check_deps() {
has_version --host-root "dev-python/lxml[${PYTHON_USEDEP}]"
}
pkg_pretend() {
local CONFIG_CHECK="~AUTOFS4_FS ~BLK_DEV_BSG ~CGROUPS
~DEVTMPFS ~DMIID ~EPOLL ~FANOTIFY ~FHANDLE
~INOTIFY_USER ~IPV6 ~NET ~NET_NS ~PROC_FS ~SECCOMP ~SIGNALFD ~SYSFS
~TIMERFD ~TMPFS_XATTR
~!FW_LOADER_USER_HELPER ~!GRKERNSEC_PROC ~!IDE ~!SYSFS_DEPRECATED
~!SYSFS_DEPRECATED_V2"
use acl && CONFIG_CHECK+=" ~TMPFS_POSIX_ACL"
kernel_is -lt 3 7 && CONFIG_CHECK+=" ~HOTPLUG"
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
check_extra_config
fi
}
pkg_setup() {
:
}
src_unpack() {
default
[[ ${PV} != 9999 ]] || git-r3_src_unpack
}
src_prepare() {
# Bug 463376
sed -i -e 's/GROUP="dialout"/GROUP="uucp"/' rules/*.rules || die
# Avoid the log bloat to the user
sed -i -e 's/#SystemMaxUse=/SystemMaxUse=500M/' src/journal/journald.conf || die
local PATCHES=(
"${FILESDIR}/218-Dont-enable-audit-by-default.patch"
"${FILESDIR}/228-noclean-tmp.patch"
)
[[ -d "${WORKDIR}"/patches ]] && PATCHES+=( "${WORKDIR}"/patches )
default
eautoreconf
}
src_configure() {
# Keep using the one where the rules were installed.
MY_UDEVDIR=$(get_udevdir)
# Fix systems broken by bug #509454.
[[ ${MY_UDEVDIR} ]] || MY_UDEVDIR=/lib/udev
# Prevent conflicts with i686 cross toolchain, bug 559726
tc-export AR CC NM OBJCOPY RANLIB
use doc && python_setup
multilib-minimal_src_configure
}
multilib_src_configure() {
local myeconfargs=(
# disable -flto since it is an optimization flag
# and makes distcc less effective
cc_cv_CFLAGS__flto=no
# disable -fuse-ld=gold since Gentoo supports explicit linker
# choice and forcing gold is undesired, #539998
# ld.gold may collide with user's LDFLAGS, #545168
# ld.gold breaks sparc, #573874
cc_cv_LDFLAGS__Wl__fuse_ld_gold=no
# Workaround for gcc-4.7, bug 554454.
cc_cv_CFLAGS__Werror_shadow=no
# Workaround for bug 516346
--enable-dependency-tracking
--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
# For testing.
--with-rootprefix="${ROOTPREFIX-/usr}"
--with-rootlibdir="${ROOTPREFIX-/usr}/$(get_libdir)"
# disable sysv compatibility
--with-sysvinit-path=
--with-sysvrcnd-path=
# no deps
--enable-efi
--enable-ima
# Optional components/dependencies
$(multilib_native_use_enable acl)
$(multilib_native_use_enable apparmor)
$(multilib_native_use_enable audit)
$(multilib_native_use_enable cryptsetup libcryptsetup)
$(multilib_native_use_enable curl libcurl)
$(multilib_native_use_enable elfutils)
$(use_enable gcrypt)
$(multilib_native_use_enable gnuefi)
$(multilib_native_use_enable http microhttpd)
$(usex http $(multilib_native_use_enable ssl gnutls) --disable-gnutls)
$(multilib_native_use_enable idn libidn)
$(multilib_native_use_enable importd)
$(multilib_native_use_enable importd bzip2)
$(multilib_native_use_enable importd zlib)
$(use_enable kdbus)
$(multilib_native_use_enable kmod)
$(use_enable lz4)
$(use_enable lzma xz)
$(multilib_native_use_enable nat libiptc)
$(multilib_native_use_enable pam)
$(multilib_native_use_enable policykit polkit)
$(multilib_native_use_enable qrcode qrencode)
$(multilib_native_use_enable seccomp)
$(multilib_native_use_enable selinux)
$(multilib_native_use_enable test tests)
$(multilib_native_use_enable test dbus)
$(multilib_native_use_enable xkb xkbcommon)
$(multilib_native_use_with doc python)
# hardcode a few paths to spare some deps
KILL=/bin/kill
QUOTAON=/usr/sbin/quotaon
QUOTACHECK=/usr/sbin/quotacheck
# TODO: we may need to restrict this to gcc
EFI_CC="$(tc-getCC)"
# dbus paths
--with-dbuspolicydir="${EPREFIX}/etc/dbus-1/system.d"
--with-dbussessionservicedir="${EPREFIX}/usr/share/dbus-1/services"
--with-dbussystemservicedir="${EPREFIX}/usr/share/dbus-1/system-services"
--with-ntp-servers="0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
# Breaks screen, tmux, etc.
--without-kill-user-processes
)
# Work around bug 463846.
tc-export CC
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
}
multilib_src_compile() {
local mymakeopts=(
udevlibexecdir="${MY_UDEVDIR}"
)
if multilib_is_native_abi; then
emake "${mymakeopts[@]}"
else
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
# Needed for bus-related tests
local -x SANDBOX_WRITE=${SANDBOX_WRITE}
addwrite /sys/fs/kdbus
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-pkgincludeHEADERS
)
emake "${mymakeopts[@]}"
fi
# Sabayon: create systemd-run symlink in /bin. lvm2 lvmetad has a
# udev rule that expects systemd-run to be in /bin. And lvmetad is
# used by Anaconda.
dosym "../usr/bin/systemd-run" "/bin/systemd-run"
}
multilib_src_install_all() {
prune_libtool_files --modules
einstalldocs
if [[ ${PV} != 9999 ]]; then
use doc || doman "${WORKDIR}"/man/systemd.{directives,index}.7
fi
if use sysv-utils; then
for app in halt poweroff reboot runlevel shutdown telinit; do
dosym "..${ROOTPREFIX-/usr}/bin/systemctl" /sbin/${app}
done
dosym "..${ROOTPREFIX-/usr}/lib/systemd/systemd" /sbin/init
else
# 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
fi
# Preserve empty dirs in /etc & /var, bug #437008
keepdir /etc/binfmt.d /etc/modules-load.d /etc/tmpfiles.d \
/etc/systemd/ntp-units.d /etc/systemd/user /var/lib/systemd \
/var/log/journal/remote
# Symlink /etc/sysctl.conf for easy migration.
dosym ../sysctl.conf /etc/sysctl.d/99-sysctl.conf
# If we install these symlinks, there is no way for the sysadmin to remove them
# permanently.
rm "${D}"/etc/systemd/system/multi-user.target.wants/systemd-networkd.service || die
rm -f "${D}"/etc/systemd/system/multi-user.target.wants/systemd-resolved.service || die
rm -r "${D}"/etc/systemd/system/network-online.target.wants || die
rm -r "${D}"/etc/systemd/system/sockets.target.wants || die
rm -r "${D}"/etc/systemd/system/sysinit.target.wants || die
# Offer a default blacklist that should cover the most
# common use cases.
insinto /etc/modprobe.d
newins "${FILESDIR}"/blacklist-146 blacklist.conf
}
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
}
reenable_unit() {
if systemctl is-enabled --root="${ROOT}" "$1" &> /dev/null; then
ebegin "Re-enabling $1"
systemctl reenable --root="${ROOT}" "$1"
eend $? || FAIL=1
fi
}
pkg_postinst() {
newusergroup() {
enewgroup "$1"
enewuser "$1" -1 -1 -1 "$1"
}
enewgroup input
enewgroup systemd-journal
newusergroup systemd-bus-proxy
newusergroup systemd-coredump
newusergroup systemd-journal-gateway
newusergroup systemd-journal-remote
newusergroup systemd-journal-upload
newusergroup systemd-network
newusergroup systemd-resolve
newusergroup systemd-timesync
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 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
# Re-enable systemd-networkd for socket activation
reenable_unit systemd-networkd.service
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 [[ $(readlink "${ROOT}"/etc/resolv.conf) == */run/systemd/network/resolv.conf ]]; then
ewarn "resolv.conf is now generated by systemd-resolved. To use it, enable"
ewarn "systemd-resolved.service, and create a symlink from /etc/resolv.conf"
ewarn "to /run/systemd/resolve/resolv.conf"
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
if has_version sys-apps/openrc &&
! has_version sys-fs/udev-init-scripts; then
elog "If you plan to boot using OpenRC and udev or eudev, you"
elog "need to install the udev-init-scripts package."
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
}
@@ -147,14 +147,15 @@ src_unpack() {
}
src_prepare() {
# Bug 463376
sed -i -e 's/GROUP="dialout"/GROUP="uucp"/' rules/*.rules || die
# Avoid the log bloat to the user
# Sabayon: Avoid the log bloat to the user
sed -i -e 's/#SystemMaxUse=/SystemMaxUse=500M/' src/journal/journald.conf || die
local PATCHES=(
"${FILESDIR}"/234-0001-path-lookup-look-for-generators-in-usr-lib-systemd-s.patch
"${FILESDIR}"/234-0002-cryptsetup-fix-infinite-timeout-6486.patch
"${FILESDIR}"/234-0003-resolved-make-sure-idn2-conversions-are-roundtrippab.patch
"${FILESDIR}"/234-0004-logind-make-sure-we-don-t-process-the-same-method-ca.patch
)
if ! use vanilla; then
@@ -162,6 +163,7 @@ src_prepare() {
"${FILESDIR}/218-Dont-enable-audit-by-default.patch"
"${FILESDIR}/228-noclean-tmp.patch"
"${FILESDIR}/233-systemd-user-pam.patch"
"${FILESDIR}/234-uucp-group.patch"
)
fi
@@ -262,7 +264,7 @@ multilib_src_configure() {
-Dquotacheck=$(meson_multilib)
-Drandomseed=$(meson_multilib)
-Drfkill=$(meson_multilib)
-Dsysysers=$(meson_multilib)
-Dsysusers=$(meson_multilib)
-Dtimedated=$(meson_multilib)
-Dtimesyncd=$(meson_multilib)
-Dtmpfiles=$(meson_multilib)
@@ -343,7 +345,8 @@ multilib_src_install_all() {
dosym "../../..${ROOTPREFIX%/}/lib/systemd/systemd" /usr/lib/systemd/systemd
dosym "../../..${ROOTPREFIX%/}/lib/systemd/systemd-shutdown" /usr/lib/systemd/systemd-shutdown
fi
# Offer a default blacklist that should cover the most
# Sabayon: Offer a default blacklist that should cover the most
# common use cases.
insinto /etc/modprobe.d
newins "${FILESDIR}"/blacklist-146 blacklist.conf
@@ -438,6 +441,8 @@ pkg_postinst() {
# between OpenRC & systemd
migrate_locale
systemd_reenable systemd-networkd.service systemd-resolved.service
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"