Accepting request 43879 from Base:System

Copy from Base:System/systemd based on submit request 43879 from user kay_sievers

OBS-URL: https://build.opensuse.org/request/show/43879
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=1
This commit is contained in:
OBS User autobuild 2010-07-30 11:59:59 +00:00 committed by Git OBS Bridge
parent bf4c044ab9
commit 1912898ec4
85 changed files with 107 additions and 22889 deletions

View File

@ -1,180 +0,0 @@
---
rules/99-systemd.rules.in | 2 -
src/basic/terminal-util.c | 55 ++++++++++++++++++++++++++++++++++++++++++++--
src/basic/terminal-util.h | 1
src/core/manager.c | 24 +++++++++++++++-----
4 files changed, 74 insertions(+), 8 deletions(-)
Index: systemd-228/rules/99-systemd.rules.in
===================================================================
--- systemd-228.orig/rules/99-systemd.rules.in
+++ systemd-228/rules/99-systemd.rules.in
@@ -7,7 +7,7 @@
ACTION=="remove", GOTO="systemd_end"
-SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty[0-9]*", TAG+="systemd"
+SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty*", TAG+="systemd"
KERNEL=="vport*", TAG+="systemd"
SUBSYSTEM=="block", TAG+="systemd"
Index: systemd-228/src/basic/terminal-util.c
===================================================================
--- systemd-228.orig/src/basic/terminal-util.c
+++ systemd-228/src/basic/terminal-util.c
@@ -717,10 +717,47 @@ bool tty_is_vc_resolve(const char *tty)
return tty_is_vc(tty);
}
+bool ansi_console(int fd) {
+ static int cached_ansi_console = -1;
+
+ if (_likely_(cached_ansi_console >= 0))
+ return cached_ansi_console;
+
+ cached_ansi_console = isatty(fd) > 0;
+#if defined(__s390__) || defined(__s390x__)
+ if (cached_ansi_console) {
+ const char *e = getenv("TERM");
+ if (e != NULL && (streq(e, "dumb") || strneq(e, "ibm3", 4))) {
+ _cleanup_free_ char *mode = NULL;
+ int r = parse_env_file("/proc/cmdline", WHITESPACE,
+ "conmode", &mode, NULL);
+ if (r < 0 || mode == NULL || !streq(mode, "3270"))
+ cached_ansi_console = 0;
+ }
+ }
+#endif
+ return cached_ansi_console;
+}
+
const char *default_term_for_tty(const char *tty) {
assert(tty);
- return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt220";
+ if (tty_is_vc_resolve(tty))
+ return "TERM=linux";
+ if (startswith(tty, "/dev/"))
+ tty += 5;
+#if defined (__s390__) || defined (__s390x__)
+ if (streq(tty, "ttyS0")) {
+ _cleanup_free_ char *mode = NULL;
+ int r = parse_env_file("/proc/cmdline", WHITESPACE, "conmode",
+ &mode, NULL);
+ if (r < 0 || mode == NULL || !streq(mode, "3270"))
+ return "TERM=dumb";
+ if (streq(mode, "3270"))
+ return "TERM=ibm327x";
+ }
+#endif
+ return "TERM=vt220";
}
int fd_columns(int fd) {
@@ -800,8 +837,22 @@ void columns_lines_cache_reset(int signu
bool on_tty(void) {
static int cached_on_tty = -1;
- if (_unlikely_(cached_on_tty < 0))
+ if (_unlikely_(cached_on_tty < 0)) {
cached_on_tty = isatty(STDOUT_FILENO) > 0;
+#if defined (__s390__) || defined (__s390x__)
+ if (cached_on_tty) {
+ const char *e = getenv("TERM");
+ if (!e)
+ return cached_on_tty;
+ if (streq(e, "dumb") || strneq(e, "ibm3", 4)) {
+ char *mode = NULL;
+ int r = parse_env_file("/proc/cmdline", WHITESPACE, "conmode", &mode, NULL);
+ if (r < 0 || !mode || !streq(mode, "3270"))
+ cached_on_tty = 0;
+ }
+ }
+#endif
+ }
return cached_on_tty;
}
Index: systemd-228/src/basic/terminal-util.h
===================================================================
--- systemd-228.orig/src/basic/terminal-util.h
+++ systemd-228/src/basic/terminal-util.h
@@ -78,6 +78,7 @@ unsigned lines(void);
void columns_lines_cache_reset(int _unused_ signum);
bool on_tty(void);
+bool ansi_console(int fd);
static inline const char *ansi_underline(void) {
return on_tty() ? ANSI_UNDERLINE : "";
Index: systemd-228/src/core/manager.c
===================================================================
--- systemd-228.orig/src/core/manager.c
+++ systemd-228/src/core/manager.c
@@ -126,7 +126,7 @@ static void manager_watch_jobs_in_progre
#define CYLON_BUFFER_EXTRA (2*(sizeof(ANSI_RED)-1) + sizeof(ANSI_HIGHLIGHT_RED)-1 + 2*(sizeof(ANSI_NORMAL)-1))
-static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned pos) {
+static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned pos, bool ansi_console) {
char *p = buffer;
assert(buflen >= CYLON_BUFFER_EXTRA + width + 1);
@@ -135,12 +135,14 @@ static void draw_cylon(char buffer[], si
if (pos > 1) {
if (pos > 2)
p = mempset(p, ' ', pos-2);
- p = stpcpy(p, ANSI_RED);
+ if (ansi_console)
+ p = stpcpy(p, ANSI_RED);
*p++ = '*';
}
if (pos > 0 && pos <= width) {
- p = stpcpy(p, ANSI_HIGHLIGHT_RED);
+ if (ansi_console)
+ p = stpcpy(p, ANSI_HIGHLIGHT_RED);
*p++ = '*';
}
@@ -151,7 +153,8 @@ static void draw_cylon(char buffer[], si
*p++ = '*';
if (pos < width-1)
p = mempset(p, ' ', width-1-pos);
- strcpy(p, ANSI_NORMAL);
+ if (ansi_console)
+ strcpy(p, ANSI_NORMAL);
}
}
@@ -168,6 +171,7 @@ void manager_flip_auto_status(Manager *m
}
static void manager_print_jobs_in_progress(Manager *m) {
+ static int is_ansi_console = -1;
_cleanup_free_ char *job_of_n = NULL;
Iterator i;
Job *j;
@@ -193,10 +197,20 @@ static void manager_print_jobs_in_progre
assert(counter == print_nr + 1);
assert(j);
+ if (_unlikely_(is_ansi_console < 0)) {
+ int fd = open_terminal("/dev/console", O_RDONLY|O_NOCTTY|O_CLOEXEC);
+ if (fd < 0)
+ is_ansi_console = 0;
+ else {
+ is_ansi_console = (int)ansi_console(fd);
+ close(fd);
+ }
+ }
+
cylon_pos = m->jobs_in_progress_iteration % 14;
if (cylon_pos >= 8)
cylon_pos = 14 - cylon_pos;
- draw_cylon(cylon, sizeof(cylon), 6, cylon_pos);
+ draw_cylon(cylon, sizeof(cylon), 6, cylon_pos, (bool)is_ansi_console);
m->jobs_in_progress_iteration++;

View File

@ -1,84 +0,0 @@
---
src/core/shutdown.c | 4 ++++
src/systemctl/systemctl.c | 18 ++++++++++++------
2 files changed, 16 insertions(+), 6 deletions(-)
Index: systemd-227/src/core/shutdown.c
===================================================================
--- systemd-227.orig/src/core/shutdown.c
+++ systemd-227/src/core/shutdown.c
@@ -418,6 +418,10 @@ int main(int argc, char *argv[]) {
}
reboot(cmd);
+
+ if (cmd == (int)RB_POWER_OFF)
+ reboot(RB_HALT_SYSTEM);
+
if (errno == EPERM && in_container) {
/* If we are in a container, and we lacked
* CAP_SYS_BOOT just exit, this will kill our
Index: systemd-227/src/systemctl/systemctl.c
===================================================================
--- systemd-227.orig/src/systemctl/systemctl.c
+++ systemd-227/src/systemctl/systemctl.c
@@ -94,6 +94,7 @@ static bool arg_no_pager = false;
static bool arg_no_wtmp = false;
static bool arg_no_wall = false;
static bool arg_no_reload = false;
+static bool arg_no_sync = false;
static bool arg_show_types = false;
static bool arg_ignore_inhibitors = false;
static bool arg_dry = false;
@@ -6938,6 +6939,7 @@ static int halt_parse_argv(int argc, cha
{ "reboot", no_argument, NULL, ARG_REBOOT },
{ "force", no_argument, NULL, 'f' },
{ "wtmp-only", no_argument, NULL, 'w' },
+ { "no-sync", no_argument, NULL, 'n' },
{ "no-wtmp", no_argument, NULL, 'd' },
{ "no-wall", no_argument, NULL, ARG_NO_WALL },
{}
@@ -6990,10 +6992,13 @@ static int halt_parse_argv(int argc, cha
case 'i':
case 'h':
- case 'n':
/* Compatibility nops */
break;
+ case 'n':
+ arg_no_sync = true;
+ break;
+
case '?':
return -EINVAL;
@@ -7506,7 +7511,8 @@ static int halt_now(enum action a) {
/* The kernel will automaticall flush ATA disks and suchlike
* on reboot(), but the file systems need to be synce'd
* explicitly in advance. */
- (void) sync();
+ if (!arg_no_sync)
+ (void) sync();
/* Make sure C-A-D is handled by the kernel from this point
* on... */
@@ -7514,14 +7520,13 @@ static int halt_now(enum action a) {
switch (a) {
- case ACTION_HALT:
- log_info("Halting.");
- (void) reboot(RB_HALT_SYSTEM);
- return -errno;
-
case ACTION_POWEROFF:
log_info("Powering off.");
(void) reboot(RB_POWER_OFF);
+ /* fall-through */
+ case ACTION_HALT:
+ log_info("Halting.");
+ (void) reboot(RB_HALT_SYSTEM);
return -errno;
case ACTION_KEXEC:

View File

@ -1,315 +0,0 @@
Avoid possible race on NFS shares in which may that the network devices disappears
before the associated NFS share becomes unmounted (bug #861489).
To do this make sure that sys-subsystem-net-devices-<iface>.device used for the
NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
---
Makefile.am | 2
src/core/mount-iface.c | 173 +++++++++++++++++++++++++++++++++++++++++++++++++
src/core/mount-iface.h | 25 +++++++
src/core/mount.c | 35 +++++++++
4 files changed, 233 insertions(+), 2 deletions(-)
Index: systemd-228/Makefile.am
===================================================================
--- systemd-228.orig/Makefile.am
+++ systemd-228/Makefile.am
@@ -1223,6 +1223,8 @@ libcore_la_SOURCES = \
src/core/machine-id-setup.h \
src/core/mount-setup.c \
src/core/mount-setup.h \
+ src/core/mount-iface.c \
+ src/core/mount-iface.h \
src/core/kmod-setup.c \
src/core/kmod-setup.h \
src/core/loopback-setup.h \
Index: systemd-228/src/core/mount-iface.c
===================================================================
--- /dev/null
+++ systemd-228/src/core/mount-iface.c
@@ -0,0 +1,173 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2014 Werner Fink
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+/*
+ * Find the name of the network interface to which a IP address belongs to.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <ifaddrs.h>
+#include <net/if.h>
+#include <assert.h>
+
+#include "log.h"
+#include "def.h"
+#include "mount-iface.h"
+
+static struct ifaddrs *ifa_list;
+
+_pure_ static unsigned int mask2prefix(const void* ipv6)
+{
+ unsigned int nippels = 0;
+ unsigned int i;
+
+ assert(ipv6);
+
+ for (i = 0; i < sizeof(struct in6_addr); i++) {
+ uint8_t byte = ((const uint8_t*)ipv6)[i];
+ if (byte == 0xFF) {
+ nippels += sizeof(uint8_t);
+ continue;
+ }
+ while (byte & 0x80) {
+ nippels++;
+ byte <<= 1;
+ }
+ break;
+ }
+
+ return nippels;
+}
+
+static void netmask(unsigned int prefix, const void* in6, void* out6)
+{
+ unsigned int nippels;
+ unsigned int i;
+
+ assert(in6);
+ assert(out6);
+
+ for (i = 0; i < sizeof(struct in6_addr); i++) {
+ nippels = (prefix < sizeof(uint8_t)) ? prefix : sizeof(uint8_t);
+ ((uint8_t*)out6)[i] = ((const uint8_t*)in6)[i] & (0xFF00>>nippels);
+ prefix -= nippels;
+ }
+}
+
+char *host2iface(const char *ip)
+{
+ const struct ifaddrs *ifa;
+ uint32_t ip4 = 0;
+ char *ret = NULL;
+ struct search {
+ union {
+ struct in_addr addr;
+ struct in6_addr addr6;
+ };
+ int family;
+ } host;
+ int r;
+
+ if (!ifa_list && (getifaddrs(&ifa_list) < 0)) {
+ log_oom();
+ goto err;
+ }
+
+ if (strchr(ip, ':')) {
+ r = inet_pton(AF_INET6, ip, &host.addr6);
+ host.family = AF_INET6;
+ } else {
+ r = inet_pton(AF_INET, ip, &host.addr);
+ host.family = AF_INET;
+ }
+
+ if (r < 0) {
+ log_error("Failed to convert IP address %s from text to binary: %m", ip);
+ goto err;
+ }
+
+ for (ifa = ifa_list; ifa != NULL; ifa = ifa->ifa_next) {
+
+ if (!ifa->ifa_addr)
+ continue;
+ if (ifa->ifa_flags & IFF_POINTOPOINT)
+ continue;
+ if (!ifa->ifa_addr)
+ continue;
+ if (!ifa->ifa_netmask)
+ continue;
+
+ if (ifa->ifa_addr->sa_family == AF_INET) {
+ uint32_t addr, dest, mask;
+
+ if (host.family != AF_INET)
+ continue;
+ if (!ifa->ifa_broadaddr)
+ continue;
+
+ if (!ip4)
+ ip4 = (uint32_t)ntohl(host.addr.s_addr);
+
+ addr = (uint32_t)ntohl(((struct sockaddr_in*)ifa->ifa_addr)->sin_addr.s_addr);
+ if ((addr & 0xFF000000) == 0x7F000000) /* IPV4 loopback */
+ continue;
+
+ mask = (uint32_t)ntohl(((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr.s_addr);
+ dest = (uint32_t)ntohl(((struct sockaddr_in*)ifa->ifa_broadaddr)->sin_addr.s_addr);
+ if ((ip4 & mask) != (dest & mask))
+ continue;
+
+ ret = ifa->ifa_name;
+ break;
+ } else if (ifa->ifa_addr->sa_family == AF_INET6) {
+ struct in6_addr *addr, *mask, dest, ip6;
+ unsigned int prefix;
+
+ if (host.family != AF_INET6)
+ continue;
+
+ addr = &((struct sockaddr_in6*)ifa->ifa_addr)->sin6_addr;
+ mask = &((struct sockaddr_in6*)ifa->ifa_netmask)->sin6_addr;
+ prefix = mask2prefix(mask);
+
+ netmask(prefix, addr, &dest);
+ netmask(prefix, &host.addr6, &ip6);
+
+ if (memcmp(&dest, &ip6, sizeof(struct in6_addr)) != 0)
+ continue;
+
+ ret = ifa->ifa_name;
+ break;
+ }
+ }
+err:
+ return ret;
+}
+
+void freeroutes(void)
+{
+ if (ifa_list)
+ freeifaddrs(ifa_list);
+ ifa_list = NULL;
+}
Index: systemd-228/src/core/mount-iface.h
===================================================================
--- /dev/null
+++ systemd-228/src/core/mount-iface.h
@@ -0,0 +1,25 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+ This file is part of systemd.
+
+ Copyright 2014 Werner Fink
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+char *host2iface(const char *ip);
+void freeroutes(void);
Index: systemd-228/src/core/mount.c
===================================================================
--- systemd-228.orig/src/core/mount.c
+++ systemd-228/src/core/mount.c
@@ -36,6 +36,7 @@
#include "manager.h"
#include "mkdir.h"
#include "mount-setup.h"
+#include "mount-iface.h"
#include "mount-util.h"
#include "mount.h"
#include "parse-util.h"
@@ -1344,8 +1345,9 @@ static int mount_setup_unit(
_cleanup_free_ char *e = NULL, *w = NULL, *o = NULL, *f = NULL;
bool load_extras = false;
MountParameters *p;
- bool delete, changed = false;
+ bool delete, changed = false, isnetwork;
Unit *u;
+ char *c;
int r;
assert(m);
@@ -1370,6 +1372,8 @@ static int mount_setup_unit(
if (r < 0)
return r;
+ isnetwork = fstype_is_network(fstype);
+
u = manager_get_unit(m, e);
if (!u) {
delete = true;
@@ -1397,7 +1401,7 @@ static int mount_setup_unit(
if (m->running_as == MANAGER_SYSTEM) {
const char* target;
- target = mount_needs_network(options, fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
+ target = isnetwork ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true);
if (r < 0)
goto fail;
@@ -1483,6 +1487,32 @@ static int mount_setup_unit(
goto fail;
}
+ if (isnetwork && (c = strrchr(p->what, ':')) && *(c+1) == '/') {
+ _cleanup_free_ char *opt = strdup(p->options);
+ char *addr;
+
+ if (opt && (addr = strstr(opt, ",addr="))) {
+ char *colon, *iface;
+
+ addr += 6;
+ if ((colon = strchr(addr, ',')))
+ *colon = '\0';
+
+ iface = host2iface(addr);
+ if (iface) {
+ _cleanup_free_ char* target = NULL;
+ if (asprintf(&target, "sys-subsystem-net-devices-%s.device", iface) < 0)
+ log_oom();
+ else {
+ r = unit_add_dependency_by_name(u, UNIT_AFTER, target, NULL, true);
+ if (r < 0)
+ log_unit_error(u, "Failed to add dependency on %s, ignoring: %s",
+ target, strerror(-r));
+ }
+ }
+ }
+ }
+
if (changed)
unit_add_to_dbus_queue(u);
@@ -1549,6 +1579,7 @@ static int mount_load_proc_self_mountinf
if (r == 0 && k < 0)
r = k;
}
+ freeroutes(); /* Just in case of using the routing table with host2iface() */
return r;
}

View File

@ -1,21 +0,0 @@
---
src/login/logind-session.c | 6 ++++++
1 file changed, 6 insertions(+)
Index: systemd-221/src/login/logind-session.c
===================================================================
--- systemd-221.orig/src/login/logind-session.c
+++ systemd-221/src/login/logind-session.c
@@ -548,6 +548,12 @@ int session_start(Session *s) {
if (r < 0)
return r;
+ if (!s->user->slice) {
+ if (errno)
+ return -errno;
+ return -ESTALE;
+ }
+
/* Create cgroup */
r = session_start_scope(s);
if (r < 0)

View File

@ -1,101 +0,0 @@
---
src/login/logind-action.c | 5 +++++
src/login/logind-dbus.c | 31 +++++++++++++++++++++++--------
2 files changed, 28 insertions(+), 8 deletions(-)
Index: systemd-227/src/login/logind-action.c
===================================================================
--- systemd-227.orig/src/login/logind-action.c
+++ systemd-227/src/login/logind-action.c
@@ -85,6 +85,11 @@ int manager_handle_action(
/* If the key handling is inhibited, don't do anything */
if (inhibit_key > 0) {
+ if (inhibit_key == INHIBIT_HANDLE_POWER_KEY) {
+ int fd;
+ fd = open("/run/systemd/acpi-shutdown", O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR);
+ close(fd);
+ }
if (manager_is_inhibited(m, inhibit_key, INHIBIT_BLOCK, NULL, true, false, 0, NULL)) {
log_debug("Refusing operation, %s is inhibited.", inhibit_what_to_string(inhibit_key));
return 0;
Index: systemd-227/src/login/logind-dbus.c
===================================================================
--- systemd-227.orig/src/login/logind-dbus.c
+++ systemd-227/src/login/logind-dbus.c
@@ -1646,12 +1646,13 @@ static int verify_shutdown_creds(
const char *action,
const char *action_multiple_sessions,
const char *action_ignore_inhibit,
- sd_bus_error *error) {
+ sd_bus_error *error, const char *sleep_verb) {
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
- bool multiple_sessions, blocked;
+ bool multiple_sessions, blocked, shutdown_through_acpi;
uid_t uid;
- int r;
+ int r, fd;
+ struct stat buf;
assert(m);
assert(message);
@@ -1673,7 +1674,19 @@ static int verify_shutdown_creds(
multiple_sessions = r > 0;
blocked = manager_is_inhibited(m, w, INHIBIT_BLOCK, NULL, false, true, uid, NULL);
- if (multiple_sessions && action_multiple_sessions) {
+ fd = open ("/run/systemd/acpi-shutdown", O_NOFOLLOW|O_PATH|O_CLOEXEC);
+ if (fd >= 0) {
+ shutdown_through_acpi = fstat(fd, &buf) == 0 &&
+ time(NULL) - buf.st_mtime <= 65 &&
+ sleep_verb == NULL;
+ close(fd);
+ unlink ("/run/systemd/acpi-shutdown");
+ }
+ else
+ shutdown_through_acpi = false;
+
+ if (multiple_sessions && action_multiple_sessions &&
+ !shutdown_through_acpi) {
r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action_multiple_sessions, NULL, interactive, UID_INVALID, &m->polkit_registry, error);
if (r < 0)
return r;
@@ -1681,7 +1694,7 @@ static int verify_shutdown_creds(
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
}
- if (blocked && action_ignore_inhibit) {
+ if (blocked && action_ignore_inhibit && !shutdown_through_acpi) {
r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action_ignore_inhibit, NULL, interactive, UID_INVALID, &m->polkit_registry, error);
if (r < 0)
return r;
@@ -1689,7 +1702,8 @@ static int verify_shutdown_creds(
return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */
}
- if (!multiple_sessions && !blocked && action) {
+ if (!multiple_sessions && !blocked && action &&
+ !shutdown_through_acpi) {
r = bus_verify_polkit_async(message, CAP_SYS_BOOT, action, NULL, interactive, UID_INVALID, &m->polkit_registry, error);
if (r < 0)
return r;
@@ -1737,7 +1751,7 @@ static int method_do_shutdown_or_sleep(
}
r = verify_shutdown_creds(m, message, w, interactive, action, action_multiple_sessions,
- action_ignore_inhibit, error);
+ action_ignore_inhibit, error, sleep_verb);
if (r != 0)
return r;
@@ -1931,7 +1945,8 @@ static int method_schedule_shutdown(sd_b
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unsupported shutdown type");
r = verify_shutdown_creds(m, message, INHIBIT_SHUTDOWN, false,
- action, action_multiple_sessions, action_ignore_inhibit, error);
+ action, action_multiple_sessions,
+ action_ignore_inhibit, error, "UNUSED");
if (r != 0)
return r;

View File

@ -1,17 +0,0 @@
---
shell-completion/bash/systemctl.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-221/shell-completion/bash/systemctl.in
===================================================================
--- systemd-221.orig/shell-completion/bash/systemctl.in
+++ systemd-221/shell-completion/bash/systemctl.in
@@ -43,7 +43,7 @@ __filter_units_by_property () {
local units=("$@")
local props
IFS=$'\n' read -rd '' -a props < \
- <(__systemctl $mode show --property "$property" -- "${units[@]}")
+ <(__systemctl $mode show --property "$property" -- "${units[@]}" 2> /dev/null)
for ((i=0; $i < ${#units[*]}; i++)); do
if [[ "${props[i]}" = "$property=$value" ]]; then
echo " ${units[i]}"

View File

@ -1,37 +0,0 @@
From cb31827d62066a04b02111df3052949fda4b6888 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 23 Nov 2015 13:59:43 -0500
Subject: [PATCH] nss-mymachines: do not allow overlong machine names
https://github.com/systemd/systemd/issues/2002
---
src/nss-mymachines/nss-mymachines.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
index 969fa96..c98a959 100644
--- a/src/nss-mymachines/nss-mymachines.c
+++ b/src/nss-mymachines/nss-mymachines.c
@@ -416,6 +416,9 @@ enum nss_status _nss_mymachines_getpwnam_r(
if (!e || e == p)
goto not_found;
+ if (e - p > HOST_NAME_MAX - 1) /* -1 for the last dash */
+ goto not_found;
+
r = parse_uid(e + 1, &uid);
if (r < 0)
goto not_found;
@@ -573,6 +576,9 @@ enum nss_status _nss_mymachines_getgrnam_r(
if (!e || e == p)
goto not_found;
+ if (e - p > HOST_NAME_MAX - 1) /* -1 for the last dash */
+ goto not_found;
+
r = parse_gid(e + 1, &gid);
if (r < 0)
goto not_found;
--
2.1.4

View File

@ -1,43 +0,0 @@
From: Werner Fink <werner@suse.de>
Date: Wed Feb 26 14:36:27 UTC 2014
Subject: Do not clobber XDG_RUNTIME_DIR if su command preserve environment
Make sure that even if a su command without option -l or with option -m
is used, the XDG_RUNTIME_DIR will not be clobbered by the new uid.
This belongs to BNC#852015 and also to BNC#855160
---
src/login/pam_systemd.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
Index: systemd-221/src/login/pam_systemd.c
===================================================================
--- systemd-221.orig/src/login/pam_systemd.c
+++ systemd-221/src/login/pam_systemd.c
@@ -445,6 +445,25 @@ _public_ PAM_EXTERN int pam_sm_open_sess
r = export_legacy_dbus_address(handle, pw->pw_uid, runtime_path);
if (r != PAM_SUCCESS)
return r;
+ } else if (getenv("XDG_RUNTIME_DIR")) {
+ _cleanup_free_ char *p = NULL;
+
+ /* Make sure that after running YaST2 or the xdg-su scripts
+ * the runtime directory is not clobbered. Even a normal su
+ * command without -l or with -m may clobber. */
+
+ if ((r = asprintf(&p, "/run/user/%lu", (unsigned long)pw->pw_uid)) < 0)
+ return PAM_BUF_ERR;
+
+ r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", p, 0);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
+ return r;
+ }
+
+ r = export_legacy_dbus_address(handle, pw->pw_uid, p);
+ if (r != PAM_SUCCESS)
+ return r;
}
if (!isempty(seat)) {

View File

@ -1,19 +0,0 @@
|
| Belongs to bnc#849071 that is do not install console-shell.service
| in any system target as this will cause automatic poweroff at boot.
|
---
units/console-shell.service.m4.in | 3 ---
1 file changed, 3 deletions(-)
Index: systemd-221/units/console-shell.service.m4.in
===================================================================
--- systemd-221.orig/units/console-shell.service.m4.in
+++ systemd-221/units/console-shell.service.m4.in
@@ -28,6 +28,3 @@ StandardError=inherit
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes
-
-[Install]
-WantedBy=getty.target

View File

@ -1,75 +0,0 @@
From: werner@suse.de
Upstream: marked as openSUSE-specific fix originally, but may well
worth be to be sent upstream.
Original description:
(none)
Augmented description [jengelh@inai.de]:
Disable COW on journal files, as that is naturally leading to a lot
of unwanted fragmentation on btrfs.
No word on compression…
---
src/journal/journald-server.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
Index: systemd-227/src/journal/journald-server.c
===================================================================
--- systemd-227.orig/src/journal/journald-server.c
+++ systemd-227/src/journal/journald-server.c
@@ -24,6 +24,7 @@
#include <selinux/selinux.h>
#endif
#include <sys/ioctl.h>
+#include <linux/fs.h>
#include <sys/mman.h>
#include <sys/signalfd.h>
#include <sys/statvfs.h>
@@ -861,6 +862,39 @@ void server_driver_message(Server *s, sd
dispatch_message_real(s, iovec, n, ELEMENTSOF(iovec), &ucred, NULL, NULL, 0, NULL, LOG_INFO, 0);
}
+/*
+ * On journaling and/or compressing file systems, avoid doubling the efforts
+ * for the system, that is, set NOCOW and NOCOMP inode flags. Check for every
+ * single flag, as otherwise, some of the file systems may return EOPNOTSUPP on
+ * a single unkown flag (like Btrfs does).
+ *
+ * …but src/journal/journal-file.c already sets NOCOW too…⸘
+ */
+static void disable_cow(const char *dir, const Server *serv)
+{
+ unsigned long flags;
+ int fd = open(dir, O_DIRECTORY);
+
+ if (fd < 0)
+ return;
+ if (ioctl(fd, FS_IOC_GETFLAGS, &flags) == 0) {
+ unsigned long old = flags;
+ if (!(flags & FS_NOATIME_FL) &&
+ ioctl(fd, FS_IOC_SETFLAGS, flags | FS_NOATIME_FL) == 0)
+ flags |= FS_NOATIME_FL;
+ if (!(flags & FS_NOCOW_FL) &&
+ ioctl(fd, FS_IOC_SETFLAGS, flags | FS_NOCOW_FL) == 0)
+ flags |= FS_NOCOW_FL;
+ if (!(flags & FS_NOCOMP_FL) && serv->compress) {
+ flags &= ~FS_COMPR_FL;
+ flags |= FS_NOCOMP_FL;
+ }
+ if (old != flags)
+ ioctl(fd, FS_IOC_SETFLAGS, flags);
+ }
+ close(fd);
+}
+
void server_dispatch_message(
Server *s,
struct iovec *iovec, unsigned n, unsigned m,
@@ -948,6 +982,7 @@ static int system_journal_open(Server *s
fn = strjoina("/var/log/journal/", SERVER_MACHINE_ID(s));
(void) mkdir(fn, 0755);
+ disable_cow(fn, s);
fn = strjoina(fn, "/system.journal");
r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, NULL, &s->system_journal);

View File

@ -1,272 +0,0 @@
---
shell-completion/bash/coredumpctl | 6 +++++-
shell-completion/bash/hostnamectl | 6 +++++-
shell-completion/bash/journalctl | 6 +++++-
shell-completion/bash/kernel-install | 13 ++++++++++++-
shell-completion/bash/localectl | 6 +++++-
shell-completion/bash/loginctl | 6 +++++-
shell-completion/bash/systemctl.in | 6 +++++-
shell-completion/bash/systemd-analyze | 6 +++++-
shell-completion/bash/systemd-run | 14 +++++++++++++-
shell-completion/bash/timedatectl | 6 +++++-
shell-completion/bash/udevadm | 6 +++++-
11 files changed, 70 insertions(+), 11 deletions(-)
Index: systemd-228/shell-completion/bash/coredumpctl
===================================================================
--- systemd-228.orig/shell-completion/bash/coredumpctl
+++ systemd-228/shell-completion/bash/coredumpctl
@@ -44,6 +44,10 @@ _coredumpctl() {
[DUMP]='dump gdb'
)
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
if __contains_word "$prev" '--output -o'; then
comps=$( compgen -A file -- "$cur" )
compopt -o filenames
@@ -82,4 +86,4 @@ _coredumpctl() {
return 0
}
-complete -F _coredumpctl coredumpctl
+complete -o default -o bashdefault -F _coredumpctl coredumpctl
Index: systemd-228/shell-completion/bash/hostnamectl
===================================================================
--- systemd-228.orig/shell-completion/bash/hostnamectl
+++ systemd-228/shell-completion/bash/hostnamectl
@@ -30,6 +30,10 @@ _hostnamectl() {
local OPTS='-h --help --version --transient --static --pretty
--no-ask-password -H --host --machine'
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
if [[ $cur = -* ]]; then
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
return 0
@@ -61,4 +65,4 @@ _hostnamectl() {
return 0
}
-complete -F _hostnamectl hostnamectl
+complete -o default -o bashdefault -F _hostnamectl hostnamectl
Index: systemd-228/shell-completion/bash/journalctl
===================================================================
--- systemd-228.orig/shell-completion/bash/journalctl
+++ systemd-228/shell-completion/bash/journalctl
@@ -56,6 +56,10 @@ _journalctl() {
--root -M --machine'
)
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then
case $prev in
--boot|--this-boot|-b)
@@ -121,4 +125,4 @@ _journalctl() {
fi
}
-complete -F _journalctl journalctl
+complete -o default -o bashdefault -F _journalctl journalctl
Index: systemd-228/shell-completion/bash/kernel-install
===================================================================
--- systemd-228.orig/shell-completion/bash/kernel-install
+++ systemd-228/shell-completion/bash/kernel-install
@@ -18,11 +18,22 @@
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+__contains_word () {
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
+}
+
_kernel_install() {
local comps
local MACHINE_ID
local cur=${COMP_WORDS[COMP_CWORD]}
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
case $COMP_CWORD in
1)
comps="add remove"
@@ -47,4 +58,4 @@ _kernel_install() {
return 0
}
-complete -F _kernel_install kernel-install
+complete -o default -o bashdefault -F _kernel_install kernel-install
Index: systemd-228/shell-completion/bash/localectl
===================================================================
--- systemd-228.orig/shell-completion/bash/localectl
+++ systemd-228/shell-completion/bash/localectl
@@ -36,6 +36,10 @@ _localectl() {
local OPTS='-h --help --version --no-convert --no-pager --no-ask-password
-H --host --machine'
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
if __contains_word "$prev" $OPTS; then
case $prev in
--host|-H)
@@ -89,4 +93,4 @@ _localectl() {
return 0
}
-complete -F _localectl localectl
+complete -o default -o bashdefault -F _localectl localectl
Index: systemd-228/shell-completion/bash/loginctl
===================================================================
--- systemd-228.orig/shell-completion/bash/loginctl
+++ systemd-228/shell-completion/bash/loginctl
@@ -38,6 +38,10 @@ _loginctl () {
[ARG]='--host -H --kill-who --property -p --signal -s --machine'
)
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
if __contains_word "$prev" ${OPTS[ARG]}; then
case $prev in
--signal|-s)
@@ -107,4 +111,4 @@ _loginctl () {
return 0
}
-complete -F _loginctl loginctl
+complete -o default -o bashdefault -F _loginctl loginctl
Index: systemd-228/shell-completion/bash/systemctl.in
===================================================================
--- systemd-228.orig/shell-completion/bash/systemctl.in
+++ systemd-228/shell-completion/bash/systemctl.in
@@ -104,6 +104,10 @@ _systemctl () {
--preset-mode -n --lines -o --output -M --machine'
)
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
if __contains_word "--user" ${COMP_WORDS[*]}; then
mode=--user
elif __contains_word "--global" ${COMP_WORDS[*]}; then
@@ -280,4 +284,4 @@ _systemctl () {
return 0
}
-complete -F _systemctl systemctl
+complete -o default -o bashdefault -F _systemctl systemctl
Index: systemd-228/shell-completion/bash/systemd-analyze
===================================================================
--- systemd-228.orig/shell-completion/bash/systemd-analyze
+++ systemd-228/shell-completion/bash/systemd-analyze
@@ -47,6 +47,10 @@ _systemd_analyze() {
[VERIFY]='verify'
)
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
_init_completion || return
for ((i=0; i < COMP_CWORD; i++)); do
@@ -114,4 +118,4 @@ _systemd_analyze() {
return 0
}
-complete -F _systemd_analyze systemd-analyze
+complete -o default -o bashdefault -F _systemd_analyze systemd-analyze
Index: systemd-228/shell-completion/bash/systemd-run
===================================================================
--- systemd-228.orig/shell-completion/bash/systemd-run
+++ systemd-228/shell-completion/bash/systemd-run
@@ -17,6 +17,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+__contains_word () {
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
+}
+
__systemctl() {
local mode=$1; shift 1
systemctl $mode --full --no-legend "$@"
@@ -40,6 +47,11 @@ _systemd_run() {
local mode=--system
local i
+
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
local opts_with_values=(
--unit --description --slice --service-type -H --host -M --machine -p --property --on-active
--on-boot --on-startup --on-unit-active --on-unit-inactive --on-calendar --timer-property
@@ -114,4 +126,4 @@ _systemd_run() {
return 0
}
-complete -F _systemd_run systemd-run
+complete -o default -o bashdefault -F _systemd_run systemd-run
Index: systemd-228/shell-completion/bash/timedatectl
===================================================================
--- systemd-228.orig/shell-completion/bash/timedatectl
+++ systemd-228/shell-completion/bash/timedatectl
@@ -30,6 +30,10 @@ _timedatectl() {
local OPTS='-h --help --version --adjust-system-clock --no-pager
--no-ask-password -H --host --machine'
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
if __contains_word "$prev" $OPTS; then
case $prev in
--host|-H)
@@ -73,4 +77,4 @@ _timedatectl() {
return 0
}
-complete -F _timedatectl timedatectl
+complete -o default -o bashdefault -F _timedatectl timedatectl
Index: systemd-228/shell-completion/bash/udevadm
===================================================================
--- systemd-228.orig/shell-completion/bash/udevadm
+++ systemd-228/shell-completion/bash/udevadm
@@ -36,6 +36,10 @@ _udevadm() {
local verbs=(info trigger settle control monitor hwdb test-builtin test)
+ if __contains_word ">" ${COMP_WORDS[*]:0:COMP_CWORD}; then
+ return 0
+ fi
+
for ((i=0; i < COMP_CWORD; i++)); do
if __contains_word "${COMP_WORDS[i]}" "${verbs[@]}" &&
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
@@ -94,4 +98,4 @@ _udevadm() {
return 0
}
-complete -F _udevadm udevadm
+complete -o default -o bashdefault -F _udevadm udevadm

View File

@ -1,24 +0,0 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Wed, 27 Jun 2012 08:55:59 +0000
Subject: rules create by id scsi links for ATA devices
Re-enable creation of by-id scsi links for ATA devices. (bnc#769002)
---
rules/60-persistent-storage.rules | 4 ++++
1 file changed, 4 insertions(+)
Index: systemd-221/rules/60-persistent-storage.rules
===================================================================
--- systemd-221.orig/rules/60-persistent-storage.rules
+++ systemd-221/rules/60-persistent-storage.rules
@@ -36,6 +36,10 @@ KERNEL=="cciss*", ENV{DEVTYPE}=="disk",
KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
+# scsi compat links for ATA devices
+KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d $devnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}"
+KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n"
+
# FireWire
KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}"
KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n"

View File

@ -1,22 +0,0 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Mon, 6 Aug 2012 13:35:34 +0000
Subject: udev netlink null rules
udevd race for netlink events (bnc#774646)
---
src/udev/udevd.c | 2 ++
1 file changed, 2 insertions(+)
Index: systemd-221/src/udev/udevd.c
===================================================================
--- systemd-221.orig/src/udev/udevd.c
+++ systemd-221/src/udev/udevd.c
@@ -917,6 +917,8 @@ static int on_uevent(sd_event_source *s,
dev = udev_monitor_receive_device(manager->monitor);
if (dev) {
udev_device_ensure_usec_initialized(dev, NULL);
+ if (manager->rules == NULL)
+ manager->rules = udev_rules_new(manager->udev, arg_resolve_names);
r = event_queue_insert(manager, dev);
if (r < 0)
udev_device_unref(dev);

View File

@ -1,24 +0,0 @@
From: Robert Milasan <rmilasan@suse.com>
Date: Tue, 12 Feb 2013 09:16:23 +0000
Subject: create default links for primary cd_dvd drive
cdrom_id: created links for the default cd/dvd drive (bnc#783054).
---
rules/60-cdrom_id.rules | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: systemd-221/rules/60-cdrom_id.rules
===================================================================
--- systemd-221.orig/rules/60-cdrom_id.rules
+++ systemd-221/rules/60-cdrom_id.rules
@@ -20,6 +20,9 @@ IMPORT{program}="cdrom_id --lock-media $
# stale mounts after ejecting
ENV{DISK_MEDIA_CHANGE}=="?*", ENV{ID_CDROM_MEDIA}!="?*", ENV{SYSTEMD_READY}="0"
-KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM}=="1", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_CD_RW}=="1", SYMLINK+="cdrw", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd", OPTIONS+="link_priority=-100"
+KERNEL=="sr0", ENV{ID_CDROM_DVD_RW}=="1", SYMLINK+="dvdrw", OPTIONS+="link_priority=-100"
LABEL="cdrom_end"

View File

@ -1,77 +0,0 @@
From: Robert Milasan <rmilasan@suse.com>
Cc: Werner Fink <werner@suse.de>
Subject: udev always rename network
Date: Thu, 28 Mar 2013 09:24:43 +0000
udev: ensure that the network interfaces are renamed even if they exist (bnc#809843).
Date: Tue, 4 Mar 2014 10:29:21 +0000
Port the patch of Robert to systemd v210 and test it out.
---
src/udev/udev-event.c | 41 +++++++++++++++++++++++++++++++++++++----
1 file changed, 37 insertions(+), 4 deletions(-)
Index: systemd-221/src/udev/udev-event.c
===================================================================
--- systemd-221.orig/src/udev/udev-event.c
+++ systemd-221/src/udev/udev-event.c
@@ -796,20 +796,53 @@ out:
static int rename_netif(struct udev_event *event) {
struct udev_device *dev = event->dev;
char name[IFNAMSIZ];
+ char interim[IFNAMSIZ], *ptr = &interim[0];
const char *oldname;
- int r;
+ int r, loop;
oldname = udev_device_get_sysname(dev);
strscpy(name, IFNAMSIZ, event->name);
r = rtnl_set_link_name(&event->rtnl, udev_device_get_ifindex(dev), name);
- if (r < 0)
+ if (r == 0) {
+ log_info("renamed network interface %s to %s\n", oldname, name);
+ return r;
+ } else if (r != -EEXIST) {
return log_error_errno(r, "Error changing net interface name '%s' to '%s': %m", oldname, name);
+ }
- log_debug("renamed network interface '%s' to '%s'", oldname, name);
+ /* free our own name, another process may wait for us */
+ strpcpyf(&ptr, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev));
- return 0;
+ r = rtnl_set_link_name(&event->rtnl, udev_device_get_ifindex(dev), interim);
+ if (r < 0) {
+ log_error("error changing net interface name %s to %s: %s",
+ oldname, interim, strerror(-r));
+ return r;
+ }
+
+ /* log temporary name */
+ log_info("renamed network interface %s to %s\n", oldname, interim);
+
+ loop = 90 * 20;
+ while (loop--) {
+ const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
+ nanosleep(&duration, NULL);
+
+ r = rtnl_set_link_name(&event->rtnl, udev_device_get_ifindex(dev), name);
+ if (r == 0) {
+ log_info("renamed network interface %s to %s\n", interim, name);
+ break;
+ }
+
+ if (r != -EEXIST) {
+ log_error("error changing net interface name %s to %s: %s",
+ interim, name, strerror(-r));
+ break;
+ }
+ }
+ return r;
}
void udev_event_execute_rules(struct udev_event *event,

View File

@ -1,37 +0,0 @@
---
Makefile.am | 4 ++++
rules/80-hotplug-cpu-mem.rules | 12 ++++++++++++
2 files changed, 16 insertions(+)
Index: systemd-221/Makefile.am
===================================================================
--- systemd-221.orig/Makefile.am
+++ systemd-221/Makefile.am
@@ -3841,6 +3841,10 @@ dist_udevrules_DATA += \
rules/73-seat-numlock.rules
# ------------------------------------------------------------------------------
+dist_udevrules_DATA += \
+ rules/80-hotplug-cpu-mem.rules
+
+# ------------------------------------------------------------------------------
mtd_probe_SOURCES = \
src/udev/mtd_probe/mtd_probe.c \
src/udev/mtd_probe/mtd_probe.h \
Index: systemd-221/rules/80-hotplug-cpu-mem.rules
===================================================================
--- /dev/null
+++ systemd-221/rules/80-hotplug-cpu-mem.rules
@@ -0,0 +1,12 @@
+# do not edit this file, it will be overwritten on update
+
+# Hotplug physical CPU
+SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", \
+ ATTR{online}="1"
+
+# Hotplug physical memory
+SUBSYSTEM=="memory", ACTION=="add", TEST=="state", ATTR{state}=="offline", \
+ ATTR{state}="online", TAG+="tmpfs"
+
+#
+TAG=="tmpfs", RUN+="/usr/lib/udev/remount-tmpfs"

View File

@ -1,24 +0,0 @@
From e26a5bb50b8aa741c5b2e57749d576c488e7ab32 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 10 Apr 2014 11:10:41 +0200
Subject: [PATCH 1/2] 64-btrfs.rules: skip btrfs check if devices are not ready
If any devices are marked with 'SYSTEMD_READY=0' then
we shouldn't run any btrfs check on them.
---
rules/64-btrfs.rules | 1 +
1 file changed, 1 insertion(+)
Index: systemd-221/rules/64-btrfs.rules
===================================================================
--- systemd-221.orig/rules/64-btrfs.rules
+++ systemd-221/rules/64-btrfs.rules
@@ -3,6 +3,7 @@
SUBSYSTEM!="block", GOTO="btrfs_end"
ACTION=="remove", GOTO="btrfs_end"
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
+ENV{SYSTEMD_READY}=="0", GOTO="btrfs_end"
# let the kernel know about this btrfs filesystem, and check if it is complete
IMPORT{builtin}="btrfs ready $devnode"

View File

@ -1,40 +0,0 @@
From f9e1ee09fadbd4fb146d4f7bb45a6212773dff63 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 10 Apr 2014 11:14:20 +0200
Subject: [PATCH 2/2] Skip persistent device link creation on multipath device
paths
When a device is marked as a multipath device path by setting
DM_MULTIPATH_DEVICE_PATH="1" udev should not create any
persistent symlinks to that device.
Otherwise systemd will get confused about which device to use.
---
rules/60-persistent-storage.rules | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: systemd-221/rules/60-persistent-storage.rules
===================================================================
--- systemd-221.orig/rules/60-persistent-storage.rules
+++ systemd-221/rules/60-persistent-storage.rules
@@ -33,8 +33,8 @@ KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!
# SCSI devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="scsi"
KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="cciss"
-KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
-KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
+KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{DM_MULTIPATH_DEVICE_PATH}!="1", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{DM_MULTIPATH_DEVICE_PATH}!="1", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
# scsi compat links for ATA devices
KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d $devnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}"
@@ -66,6 +66,9 @@ KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!=
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \
IMPORT{builtin}="blkid --noraid"
+# Skip blkid on multipath device paths
+ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="persistent_storage_end"
+
# probe filesystem metadata of disks
KERNEL!="sr*", IMPORT{builtin}="blkid"

View File

@ -1,29 +0,0 @@
From c9af1be90db5a29ac86605c67bc2bb4bc5780520 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 12 Jun 2014 12:25:03 +0200
Subject: [PATCH] 99-systemd.rules: Ignore devices with 'SYSTEMD_READY=0'
Whenever a rule sets 'SYSTEMD_READY=0' it tries to indicate
that systemd should ignore this device. So we should not
set the 'systemd' tag in these cases; otherwise systemd
will pick up the device.
References: bnc#881942
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
rules/99-systemd.rules.in | 1 +
1 file changed, 1 insertion(+)
Index: systemd-221/rules/99-systemd.rules.in
===================================================================
--- systemd-221.orig/rules/99-systemd.rules.in
+++ systemd-221/rules/99-systemd.rules.in
@@ -10,6 +10,7 @@ ACTION=="remove", GOTO="systemd_end"
SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty*", TAG+="systemd"
KERNEL=="vport*", TAG+="systemd"
+SUBSYSTEM=="block", ENV{SYSTEMD_READY}=="0", GOTO="systemd_end"
SUBSYSTEM=="block", TAG+="systemd"
SUBSYSTEM=="block", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"

View File

@ -1,20 +0,0 @@
Exclude cd/dvd as well (bnc#882714)
---
src/udev/udevd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: systemd-221/src/udev/udevd.c
===================================================================
--- systemd-221.orig/src/udev/udevd.c
+++ systemd-221/src/udev/udevd.c
@@ -1022,7 +1022,8 @@ static int synthesize_change(struct udev
if (streq_ptr("block", udev_device_get_subsystem(dev)) &&
streq_ptr("disk", udev_device_get_devtype(dev)) &&
- !startswith(udev_device_get_sysname(dev), "dm-")) {
+ !startswith(udev_device_get_sysname(dev), "dm-") &&
+ !startswith(udev_device_get_sysname(dev), "sr")) {
bool part_table_read = false;
bool has_partitions = false;
int fd;

View File

@ -1,45 +0,0 @@
From: Jeff Mahoney <jeffm@suse.com>
Subject: udev: use device mapper target name for btrfs device ready
References: bnc#888215
When udev gets a change event for a block device, it calls the builtin
btrfs helper to scan it for a btrfs file system. If the file system was
mounted using a device mapper node, mount(8) will have looked up the
device mapper table and used the /dev/mapper/<name> node for mount.
If something like partprobe runs, and then causes change events to be
handled, the btrfs ready event is handled using /dev/dm-N instead of
the device mapper named node. Btrfs caches the last name passed to
the scanning ioctl and uses that to report the device name for
things like /proc/mounts.
So, after running partprobe we go from:
/dev/mapper/test-test on /mnt type btrfs (rw,relatime,space_cache)
... to ...
/dev/dm-0 on /mnt type btrfs (rw,relatime,space_cache)
This doesn't apply only to LVM device, but multipath as well.
If the device is a DM device, udev will have already cached the table name
from sysfs and we can use that to pass /dev/mapper/<name> to the builtin
so that the correct name is used.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
rules/64-btrfs.rules | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: systemd-221/rules/64-btrfs.rules
===================================================================
--- systemd-221.orig/rules/64-btrfs.rules
+++ systemd-221/rules/64-btrfs.rules
@@ -6,7 +6,8 @@ ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_en
ENV{SYSTEMD_READY}=="0", GOTO="btrfs_end"
# let the kernel know about this btrfs filesystem, and check if it is complete
-IMPORT{builtin}="btrfs ready $devnode"
+ENV{DM_NAME}=="", IMPORT{builtin}="btrfs ready $devnode"
+ENV{DM_NAME}=="?*", IMPORT{builtin}="btrfs ready /dev/mapper/$env{DM_NAME}"
# mark the device as not ready to be used by the system
ENV{ID_BTRFS_READY}=="0", ENV{SYSTEMD_READY}="0"

View File

@ -1,15 +0,0 @@
---
rules/50-udev-default.rules | 2 ++
1 file changed, 2 insertions(+)
Index: systemd-221/rules/50-udev-default.rules
===================================================================
--- systemd-221.orig/rules/50-udev-default.rules
+++ systemd-221/rules/50-udev-default.rules
@@ -74,4 +74,6 @@ KERNEL=="tun", MODE="0666", OPTIONS+="st
KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse"
+KERNEL=="genwqe*", MODE="0666"
+
LABEL="default_end"

View File

@ -1,175 +0,0 @@
From: Jeff Mahoney <jeffm@suse.com>
Subject: udev: add option to generate old 'buggy' serials
References: bnc#886852
Prior to udev 184, scsi_id would truncate the last character of the model
string when generating the ID_SERIAL value. If a system was installed
prior to that fix being available in udev, there may be configuration
information that refers to the truncated link.
This patch adds a --truncated-serial option and a udev rule will created
the old truncated links.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
rules/60-persistent-storage.rules | 4 ++++
src/udev/scsi_id/scsi_id.c | 15 ++++++++++++++-
src/udev/scsi_id/scsi_id.h | 1 +
src/udev/scsi_id/scsi_serial.c | 19 +++++++++++++------
4 files changed, 32 insertions(+), 7 deletions(-)
Index: systemd-221/rules/60-persistent-storage.rules
===================================================================
--- systemd-221.orig/rules/60-persistent-storage.rules
+++ systemd-221/rules/60-persistent-storage.rules
@@ -40,6 +40,10 @@ KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="par
KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d $devnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}"
KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n"
+# scsi compat links for ATA devices (for compatibility with udev < 184)
+KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --truncated-serial --whitelisted --replace-whitespace -p0x80 -d$tempnode", RESULT=="?*", ENV{ID_SCSI_COMPAT_TRUNCATED}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT_TRUNCATED}"
+KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT_TRUNCATED}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT_TRUNCATED}-part%n"
+
# FireWire
KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}"
KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n"
Index: systemd-221/src/udev/scsi_id/scsi_id.c
===================================================================
--- systemd-221.orig/src/udev/scsi_id/scsi_id.c
+++ systemd-221/src/udev/scsi_id/scsi_id.c
@@ -43,6 +43,7 @@ static const struct option options[] = {
{ "replace-whitespace", no_argument, NULL, 'u' },
{ "sg-version", required_argument, NULL, 's' },
{ "verbose", no_argument, NULL, 'v' },
+ { "truncated-serial", no_argument, NULL, '9' },
{ "version", no_argument, NULL, 'V' }, /* don't advertise -V */
{ "export", no_argument, NULL, 'x' },
{ "help", no_argument, NULL, 'h' },
@@ -54,6 +55,7 @@ static bool dev_specified = false;
static char config_file[MAX_PATH_LEN] = "/etc/scsi_id.config";
static enum page_code default_page_code = PAGE_UNSPECIFIED;
static int sg_version = 4;
+static bool compat_truncated = false;
static bool reformat_serial = false;
static bool export = false;
static char vendor_str[64];
@@ -316,6 +318,7 @@ static void help(void) {
" -g --whitelisted Treat device as whitelisted\n"
" -u --replace-whitespace Replace all whitespace by underscores\n"
" -v --verbose Verbose logging\n"
+ " --truncated-serial truncated serial for compatibility with systems configured with by-id links created by udev < 184\n"
" -x --export Print values as environment keys\n"
, program_invocation_short_name);
@@ -387,6 +390,10 @@ static int set_options(struct udev *udev
log_open();
break;
+ case '9':
+ compat_truncated = true;
+ break;
+
case 'V':
printf("%s\n", VERSION);
exit(0);
@@ -528,6 +535,9 @@ static int scsi_id(struct udev *udev, ch
util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str));
util_replace_chars(serial_str, NULL);
printf("ID_SERIAL=%s\n", serial_str);
+ util_replace_whitespace(dev_scsi.serial_compat, serial_str, sizeof(serial_str));
+ util_replace_chars(serial_str, NULL);
+ printf("ID_SERIAL_COMPAT=%s\n", serial_str);
util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str));
util_replace_chars(serial_str, NULL);
printf("ID_SERIAL_SHORT=%s\n", serial_str);
@@ -558,7 +568,10 @@ static int scsi_id(struct udev *udev, ch
if (reformat_serial) {
char serial_str[MAX_SERIAL_LEN];
- util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str));
+ if (compat_truncated)
+ util_replace_whitespace(dev_scsi.serial_compat, serial_str, sizeof(serial_str));
+ else
+ util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str));
util_replace_chars(serial_str, NULL);
printf("%s\n", serial_str);
goto out;
Index: systemd-221/src/udev/scsi_id/scsi_id.h
===================================================================
--- systemd-221.orig/src/udev/scsi_id/scsi_id.h
+++ systemd-221/src/udev/scsi_id/scsi_id.h
@@ -45,6 +45,7 @@ struct scsi_id_device {
char kernel[64];
char serial[MAX_SERIAL_LEN];
char serial_short[MAX_SERIAL_LEN];
+ char serial_compat[MAX_SERIAL_LEN];
int use_sg;
/* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */
Index: systemd-221/src/udev/scsi_id/scsi_serial.c
===================================================================
--- systemd-221.orig/src/udev/scsi_id/scsi_serial.c
+++ systemd-221/src/udev/scsi_id/scsi_serial.c
@@ -97,7 +97,8 @@ static const char hex_str[]="0123456789a
static int do_scsi_page80_inquiry(struct udev *udev,
struct scsi_id_device *dev_scsi, int fd,
- char *serial, char *serial_short, int max_len);
+ char *serial, char *serial_short,
+ char *serial_compat, int max_len);
static int sg_err_category_new(struct udev *udev,
int scsi_status, int msg_status, int
@@ -620,7 +621,7 @@ static int do_scsi_page83_inquiry(struct
unsigned char page_83[SCSI_INQ_BUFF_LEN];
/* also pick up the page 80 serial number */
- do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN);
+ do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, NULL, MAX_SERIAL_LEN);
memzero(page_83, SCSI_INQ_BUFF_LEN);
retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83,
@@ -765,7 +766,8 @@ static int do_scsi_page83_prespc3_inquir
/* Get unit serial number VPD page */
static int do_scsi_page80_inquiry(struct udev *udev,
struct scsi_id_device *dev_scsi, int fd,
- char *serial, char *serial_short, int max_len)
+ char *serial, char *serial_short,
+ char *serial_compat, int max_len)
{
int retval;
int ser_ind;
@@ -799,9 +801,14 @@ static int do_scsi_page80_inquiry(struct
ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]);
if (ser_ind < 0)
return 1;
+ if (serial_compat)
+ strcpy(serial_compat, serial);
ser_ind++; /* for the leading 'S' */
- for (i = 4; i < len + 4; i++, ser_ind++)
+ for (i = 4; i < len + 4; i++, ser_ind++) {
serial[ser_ind] = buf[i];
+ if (serial_compat)
+ serial_compat[ser_ind - 1] = buf[i];
+ }
}
if (serial_short != NULL) {
memcpy(serial_short, &buf[4], len);
@@ -877,7 +884,7 @@ int scsi_get_serial(struct udev *udev,
return 1;
if (page_code == PAGE_80) {
- if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) {
+ if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, dev_scsi->serial_compat, len)) {
retval = 1;
goto completed;
} else {
@@ -951,7 +958,7 @@ int scsi_get_serial(struct udev *udev,
for (ind = 4; ind <= page0[3] + 3; ind++)
if (page0[ind] == PAGE_80)
if (!do_scsi_page80_inquiry(udev, dev_scsi, fd,
- dev_scsi->serial, dev_scsi->serial_short, len)) {
+ dev_scsi->serial, dev_scsi->serial_short, dev_scsi->serial_compat, len)) {
/*
* Success
*/

View File

@ -1,33 +0,0 @@
---
Makefile.am | 1 +
rules/60-ssd-scheduler.rules | 11 +++++++++++
2 files changed, 12 insertions(+)
Index: systemd-221/Makefile.am
===================================================================
--- systemd-221.orig/Makefile.am
+++ systemd-221/Makefile.am
@@ -3501,6 +3501,7 @@ dist_udevrules_DATA += \
rules/60-persistent-input.rules \
rules/60-persistent-alsa.rules \
rules/60-persistent-storage.rules \
+ rules/60-ssd-scheduler.rules \
rules/60-serial.rules \
rules/64-btrfs.rules \
rules/70-mouse.rules \
Index: systemd-221/rules/60-ssd-scheduler.rules
===================================================================
--- /dev/null
+++ systemd-221/rules/60-ssd-scheduler.rules
@@ -0,0 +1,11 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add", GOTO="ssd_scheduler_end"
+SUBSYSTEM!="block", GOTO="ssd_scheduler_end"
+
+IMPORT{cmdline}="elevator"
+ENV{elevator}=="*?", GOTO="ssd_scheduler_end"
+
+KERNEL=="sd*[!0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"
+
+LABEL="ssd_scheduler_end"

View File

@ -1,108 +0,0 @@
---
Makefile.am | 19 +++++
src/udev/rootsymlink_generator/rootsymlink_generator.c | 57 +++++++++++++++++
units/systemd-udev-root-symlink.service | 10 ++
units/systemd-udev-root-symlink.service.in | 10 ++
4 files changed, 96 insertions(+)
--- systemd-222.orig/Makefile.am
+++ systemd-222/Makefile.am
@@ -3759,6 +3759,25 @@ EXTRA_DIST += \
test/mocks/fsck
# ------------------------------------------------------------------------------
+rootsymlink_generator_SOURCES = \
+ src/udev/rootsymlink_generator/rootsymlink_generator.c
+
+rootsymlink_generator_CFLAGS = \
+ $(AM_CFLAGS)
+
+udevlibexec_PROGRAMS += \
+ rootsymlink-generator
+
+nodist_systemunit_DATA += \
+ units/systemd-udev-root-symlink.service
+
+SYSINIT_TARGET_WANTS += \
+ systemd-udev-root-symlink.service
+
+EXTRA_DIST += \
+ units/systemd-udev-root-symlink.service.in
+
+# ------------------------------------------------------------------------------
ata_id_SOURCES = \
src/udev/ata_id/ata_id.c
--- /dev/null
+++ systemd-222/src/udev/rootsymlink_generator/rootsymlink_generator.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014-2015 Robert Milasan <rmilasan@suse.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#define BUFFER_SIZE 128
+
+#define _ROOTDEV_ "/"
+#define _PATH_ "/run/udev/rules.d"
+#define _FILE_ "10-root-symlink.rules"
+
+int main(void)
+{
+ char filename[BUFFER_SIZE], buf[BUFFER_SIZE];
+ struct stat statbuf;
+ int fd;
+
+ if (stat(_ROOTDEV_, &statbuf) < 0)
+ return 1;
+ if (major(statbuf.st_dev) <= 0)
+ return 0;
+ if (mkdir(_PATH_, 0755) < 0 && errno != EEXIST)
+ return errno;
+ snprintf(filename, BUFFER_SIZE, "%s/%s", _PATH_, _FILE_);
+ fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644);
+ if (fd < 0)
+ return errno;
+ snprintf(buf, BUFFER_SIZE,
+ "ACTION==\"add|change\", SUBSYSTEM==\"block\", "
+ "ENV{MAJOR}==\"%d\", ENV{MINOR}==\"%d\", SYMLINK+=\"root\"\n",
+ major(statbuf.st_dev), minor(statbuf.st_dev));
+ if (write(fd, buf, strlen(buf)) < 0)
+ return errno;
+ if (close(fd) < 0)
+ return errno;
+ return 0;
+}
--- /dev/null
+++ systemd-222/units/systemd-udev-root-symlink.service.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=Rule generator for /dev/root symlink
+Before=systemd-udevd.service
+DefaultDependencies=no
+ConditionPathIsReadWrite=/run/udev
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=@udevlibexecdir@/rootsymlink-generator

View File

@ -1,26 +0,0 @@
---
src/udev/udevd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: systemd-227/src/udev/udevd.c
===================================================================
--- systemd-227.orig/src/udev/udevd.c
+++ systemd-227/src/udev/udevd.c
@@ -568,7 +568,7 @@ static void event_run(Manager *manager,
if (hashmap_size(manager->workers) >= arg_children_max) {
if (arg_children_max > 1)
- log_debug("maximum number (%i) of children reached", hashmap_size(manager->workers));
+ log_error("maximum number (%i) of children reached", hashmap_size(manager->workers));
return;
}
@@ -1672,7 +1672,7 @@ int main(int argc, char *argv[]) {
arg_children_max = 8;
if (sched_getaffinity(0, sizeof(cpu_set), &cpu_set) == 0)
- arg_children_max += CPU_COUNT(&cpu_set) * 2;
+ arg_children_max += CPU_COUNT(&cpu_set) * 64;
log_debug("set children_max to %u", arg_children_max);
}

View File

@ -1,14 +0,0 @@
---
units/systemd-networkd.service.m4.in | 1 +
1 file changed, 1 insertion(+)
Index: systemd-221/units/systemd-networkd.service.m4.in
===================================================================
--- systemd-221.orig/units/systemd-networkd.service.m4.in
+++ systemd-221/units/systemd-networkd.service.m4.in
@@ -34,4 +34,5 @@ WatchdogSec=1min
[Install]
WantedBy=multi-user.target
+Alias=network.service
Also=systemd-networkd.socket

View File

@ -1,21 +0,0 @@
---
src/login/pam_systemd.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: systemd-228/src/login/pam_systemd.c
===================================================================
--- systemd-228.orig/src/login/pam_systemd.c
+++ systemd-228/src/login/pam_systemd.c
@@ -515,7 +515,11 @@ _public_ PAM_EXTERN int pam_sm_open_sess
r = pam_set_data(handle, "systemd.session-fd", FD_TO_PTR(session_fd), NULL);
if (r != PAM_SUCCESS) {
pam_syslog(handle, LOG_ERR, "Failed to install session fd.");
- safe_close(session_fd);
+ if (session_fd >= 0) {
+ PROTECT_ERRNO;
+ if (_unlikely_(!(close_nointr(session_fd) != -EBADF)))
+ pam_syslog(handle, LOG_ERR, "Unexpected error code on closing session fd: %m");
+ }
return r;
}
}

View File

@ -1,40 +0,0 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 7 Dec 2011 15:15:07 +0000
Subject: Fix /run/lock directories permissions to follow openSUSE policy
disable /var/lock/{subsys,lockdev} and change default permissions on
/var/lock (bnc#733523).
---
tmpfiles.d/legacy.conf | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: systemd-221/tmpfiles.d/legacy.conf
===================================================================
--- systemd-221.orig/tmpfiles.d/legacy.conf
+++ systemd-221/tmpfiles.d/legacy.conf
@@ -10,13 +10,14 @@
# These files are considered legacy and are unnecessary on legacy-free
# systems.
-d /run/lock 0755 root root -
+# changed for openSUSE: only /run/lock should be available.
+d /run/lock 0775 root lock -
L /var/lock - - - - ../run/lock
# /run/lock/subsys is used for serializing SysV service execution, and
# hence without use on SysV-less systems.
-d /run/lock/subsys 0755 root root -
+#d /run/lock/subsys 0755 root root -
# /run/lock/lockdev is used to serialize access to tty devices via
# LCK..xxx style lock files, For more information see:
@@ -24,7 +25,7 @@ d /run/lock/subsys 0755 root root -
# On modern systems a BSD file lock is a better choice if
# serialization is needed on those devices.
-d /run/lock/lockdev 0775 root lock -
+#d /run/lock/lockdev 0775 root lock -
# /forcefsck, /fastboot and /forcequotacheck are deprecated in favor of the
# kernel command line options 'fsck.mode=force', 'fsck.mode=skip' and

View File

@ -1,17 +0,0 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=/etc/init.d/after.local Compatibility
ConditionFileIsExecutable=/etc/init.d/after.local
After=getty.target
[Service]
Type=idle
ExecStart=/etc/init.d/after.local
TimeoutSec=0
RemainAfterExit=yes

View File

@ -1,47 +0,0 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 10 Jan 2013 15:43:25 +0000
Subject: allow multiple sulogin to be started
allows multiple sulogin instance (bnc#793182).
---
units/getty@.service.m4 | 1 +
units/rescue.target | 1 +
units/serial-getty@.service.m4 | 1 +
3 files changed, 3 insertions(+)
Index: systemd-221/units/getty@.service.m4
===================================================================
--- systemd-221.orig/units/getty@.service.m4
+++ systemd-221/units/getty@.service.m4
@@ -9,6 +9,7 @@
Description=Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
+Conflicts=rescue.service
After=systemd-user-sessions.service plymouth-quit-wait.service
m4_ifdef(`HAVE_SYSV_COMPAT',
After=rc-local.service
Index: systemd-221/units/rescue.target
===================================================================
--- systemd-221.orig/units/rescue.target
+++ systemd-221/units/rescue.target
@@ -10,6 +10,7 @@ Description=Rescue Mode
Documentation=man:systemd.special(7)
Requires=sysinit.target rescue.service
After=sysinit.target rescue.service
+Conflicts=getty.target
AllowIsolate=yes
[Install]
Index: systemd-221/units/serial-getty@.service.m4
===================================================================
--- systemd-221.orig/units/serial-getty@.service.m4
+++ systemd-221/units/serial-getty@.service.m4
@@ -10,6 +10,7 @@ Description=Serial Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
BindsTo=dev-%i.device
+Conflicts=rescue.service
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
m4_ifdef(`HAVE_SYSV_COMPAT',
After=rc-local.service

View File

@ -1,31 +0,0 @@
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Mon, 8 Apr 2013 14:51:47 +0200
Subject: apply ACL for nvidia device nodes
set ACL on nvidia devices (bnc#808319).
---
src/login/logind-acl.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Index: systemd-221/src/login/logind-acl.c
===================================================================
--- systemd-221.orig/src/login/logind-acl.c
+++ systemd-221/src/login/logind-acl.c
@@ -285,5 +285,17 @@ int devnode_acl_all(struct udev *udev,
r = k;
}
+ /* only apply ACL on nvidia* if /dev/nvidiactl exists */
+ if (devnode_acl("/dev/nvidiactl", flush, del, old_uid, add, new_uid) >= 0) {
+ int j;
+ for (j = 0; j <= 256 ; j++) {
+ _cleanup_free_ char *devname = NULL;
+ if (asprintf(&devname, "/dev/nvidia%d", j) < 0)
+ break;
+ if (devnode_acl(devname, flush, del, old_uid, add, new_uid) < 0)
+ break;
+ }
+ }
+
return r;
}

View File

@ -1,23 +0,0 @@
From c79437b7967cf5a23faa881bc5da6b88b63a1ada Mon Sep 17 00:00:00 2001
From: Stefan Dirsch <sndirsch@suse.de>
Date: Tue, 3 Jun 2014 15:05:55 +0200
Subject: [PATCH] apply ACL for nvidia-uvm device node
set ACL on nvidia-uvm device (bnc#879767).
---
src/login/logind-acl.c | 2 ++
1 file changed, 2 insertions(+)
Index: systemd-221/src/login/logind-acl.c
===================================================================
--- systemd-221.orig/src/login/logind-acl.c
+++ systemd-221/src/login/logind-acl.c
@@ -295,6 +295,8 @@ int devnode_acl_all(struct udev *udev,
if (devnode_acl(devname, flush, del, old_uid, add, new_uid) < 0)
break;
}
+ /* required for additional CUDA support (nvidia-uvm module with appropriate device), bnc#879767 */
+ devnode_acl("/dev/nvidia-uvm", flush, del, old_uid, add, new_uid);
}
return r;

View File

@ -1,34 +0,0 @@
Nasty bug reported on boo#867663
---
src/basic/def.h | 2 +-
src/core/manager.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
Index: systemd-228/src/basic/def.h
===================================================================
--- systemd-228.orig/src/basic/def.h
+++ systemd-228/src/basic/def.h
@@ -40,7 +40,7 @@
#define SYSTEMD_CGROUP_CONTROLLER "name=systemd"
-#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
+#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT,SIGTRAP,SIGSYS
#define SIGNALS_IGNORE SIGPIPE
#define REBOOT_PARAM_FILE "/run/systemd/reboot-param"
Index: systemd-228/src/core/manager.c
===================================================================
--- systemd-228.orig/src/core/manager.c
+++ systemd-228/src/core/manager.c
@@ -2003,7 +2003,8 @@ static int manager_dispatch_jobs_in_prog
assert(m);
assert(source);
- manager_print_jobs_in_progress(m);
+ if (m->n_running_jobs > 0)
+ manager_print_jobs_in_progress(m);
next = now(CLOCK_MONOTONIC) + JOBS_IN_PROGRESS_PERIOD_USEC;
r = sd_event_source_set_time(source, next);

View File

@ -1,29 +0,0 @@
Found this during debugging an other problem. The issue was that
after ``sudo -i'' and a ``cd /usr/lib/systemd/system/'' followed
later by a shutdown may fail with (journalctl -b -1):
systemd-exit.service: Failed at step CHDIR spawning: /usr/bin/kill
which then caused the subsequent fault that umounting the users
home directories done by automount are busy.
---
units/user/systemd-exit.service.in | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: systemd-221/units/user/systemd-exit.service.in
===================================================================
--- systemd-221.orig/units/user/systemd-exit.service.in
+++ systemd-221/units/user/systemd-exit.service.in
@@ -10,8 +10,9 @@ Description=Exit the Session
Documentation=man:systemd.special(7)
DefaultDependencies=no
Requires=shutdown.target
-After=shutdown.target
+After=shutdown.target multi-user.target
[Service]
Type=oneshot
-ExecStart=@KILL@ -s 58 $MANAGERPID
+WorkingDirectory=/
+ExecStart=@KILL@ -s SIGRTMIN+24 $MANAGERPID

View File

@ -1,8 +0,0 @@
systemd
supplements "packageand(systemd:pam-<targettype>)"
-/lib/systemd/system/
post "<prefix>%{_sbindir}/pam-config -a --systemd || :"
libsystemd0
libudev1
nss-myhostname
nss-mymachines

View File

@ -1,17 +0,0 @@
---
units/rc-local.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-221/units/rc-local.service.in
===================================================================
--- systemd-221.orig/units/rc-local.service.in
+++ systemd-221/units/rc-local.service.in
@@ -10,7 +10,7 @@
[Unit]
Description=@RC_LOCAL_SCRIPT_PATH_START@ Compatibility
ConditionFileIsExecutable=@RC_LOCAL_SCRIPT_PATH_START@
-After=network.target
+After=basic.target
[Service]
Type=forking

View File

@ -1,25 +0,0 @@
From: Frederic Crozat <fcrozat@suse.com>
Cc: Werner Fink <werner@suse.de>
Date: Wed, 24 Aug 2011 13:02:12 +0000
Subject: ensure ask-password-wall starts after getty@tty1
ensure passphrase is handled before starting getty on tty1.
---
units/systemd-ask-password-wall.service.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: systemd-221/units/systemd-ask-password-wall.service.in
===================================================================
--- systemd-221.orig/units/systemd-ask-password-wall.service.in
+++ systemd-221/units/systemd-ask-password-wall.service.in
@@ -8,7 +8,8 @@
[Unit]
Description=Forward Password Requests to Wall
Documentation=man:systemd-ask-password-console.service(8)
-After=systemd-user-sessions.service
+Wants=getty.target
+After=systemd-user-sessions.service getty.target
[Service]
ExecStartPre=-@SYSTEMCTL@ stop systemd-ask-password-console.path systemd-ask-password-console.service systemd-ask-password-plymouth.path systemd-ask-password-plymouth.service

View File

@ -1,31 +0,0 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 28 May 2013 15:17:35 +0200
Subject: ensure shortname is set as hostname (bnc#820213)
strip hostname so the domain part isn't set as part of the hostname
---
src/core/hostname-setup.c | 4 ++++
1 file changed, 4 insertions(+)
Index: systemd-221/src/core/hostname-setup.c
===================================================================
--- systemd-221.orig/src/core/hostname-setup.c
+++ systemd-221/src/core/hostname-setup.c
@@ -34,6 +34,7 @@ int hostname_setup(void) {
int r;
_cleanup_free_ char *b = NULL;
const char *hn;
+ char *domain;
bool enoent = false;
r = read_hostname_config("/etc/hostname", &b);
@@ -46,6 +47,9 @@ int hostname_setup(void) {
hn = NULL;
} else
hn = b;
+ /* strip any leftover of a domain name */
+ if ((domain = strchr(hn, '.')) != NULL)
+ *domain = '\0';
if (isempty(hn)) {
/* Don't override the hostname if it is already set

View File

@ -1,38 +0,0 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 23 Aug 2012 11:08:25 +0200
Subject: fix support for boot prefixed initscript (bnc#746506)
---
src/systemctl/systemctl.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
Index: systemd-221/src/systemctl/systemctl.c
===================================================================
--- systemd-221.orig/src/systemctl/systemctl.c
+++ systemd-221/src/systemctl/systemctl.c
@@ -5165,8 +5165,24 @@ static int enable_sysv_units(const char
p[strlen(p) - strlen(".service")] = 0;
found_sysv = access(p, F_OK) >= 0;
- if (!found_sysv)
+ if (!found_sysv) {
+#ifdef HAVE_SYSV_COMPAT
+ free(p);
+ p = NULL;
+ if (!isempty(arg_root))
+ asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/boot.%s", arg_root, name);
+ else
+ asprintf(&p, SYSTEM_SYSVINIT_PATH "/boot.%s", name);
+ if (!p)
+ return -ENOMEM;
+ p[strlen(p) - sizeof(".service") + 1] = 0;
+ found_sysv = access(p, F_OK) >= 0;
+ if (!found_sysv)
+ continue;
+#else
continue;
+#endif
+ }
if (found_native)
log_info("Synchronizing state of %s with SysV init with %s...", name, argv[0]);

View File

@ -1,216 +0,0 @@
Original-From: Frederic Crozat <fcrozat@suse.com>
Original-Date: Fri, 19 Aug 2011 15:29:49 +0000
Subject: handle disable_caplock and compose_table and kbd_rate
References: https://bugzilla.opensuse.org/746595
Last-Editor: Jan Engelhardt <jengelh@inai.de>
Date: Fri Jun 19 21:36:27 CEST 2015
---
src/vconsole/vconsole-setup.c | 151 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 147 insertions(+), 4 deletions(-)
Index: systemd-228/src/vconsole/vconsole-setup.c
===================================================================
--- systemd-228.orig/src/vconsole/vconsole-setup.c
+++ systemd-228/src/vconsole/vconsole-setup.c
@@ -34,6 +34,8 @@
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
+#include "macro.h"
+#include "strv.h"
#include "io-util.h"
#include "locale-util.h"
#include "log.h"
@@ -104,8 +106,10 @@ static int enable_utf8(int fd) {
return r;
}
-static int keyboard_load_and_wait(const char *vc, const char *map, const char *map_toggle, bool utf8) {
- const char *args[8];
+static int keyboard_load_and_wait(const char *vc, const char *map,
+ const char *map_toggle, bool utf8, bool disable_capslock)
+{
+ const char *args[9];
int i = 0, r;
pid_t pid;
@@ -122,6 +126,8 @@ static int keyboard_load_and_wait(const
args[i++] = map;
if (map_toggle)
args[i++] = map_toggle;
+ if (disable_capslock)
+ args[i++] = "disable.capslock";
args[i++] = NULL;
pid = fork();
@@ -251,11 +257,117 @@ static void font_copy_to_all_vcs(int fd)
}
}
+#ifdef HAVE_SYSV_COMPAT
+static int compose_load_and_wait(const char *vc, const char *compose_table)
+{
+ const char *args[1024];
+ unsigned int i = 0, j = 0;
+ int ret;
+ pid_t pid;
+ char **strv_compose_table = NULL;
+ char *to_free[1024];
+
+ if (isempty(compose_table))
+ /* An empty map means no compose table */
+ return 1;
+
+ args[i++] = KBD_LOADKEYS;
+ args[i++] = "-q";
+ args[i++] = "-C";
+ args[i++] = vc;
+
+ strv_compose_table = strv_split(compose_table, WHITESPACE);
+ if (strv_compose_table) {
+ bool compose_loaded = false;
+ bool compose_clear = false;
+ char **name;
+ char *arg;
+
+ STRV_FOREACH(name, strv_compose_table) {
+ if (streq(*name, "-c") || streq(*name, "clear")) {
+ compose_clear = true;
+ continue;
+ }
+ if (!compose_loaded && compose_clear)
+ args[i++] = "-c";
+ asprintf(&arg, "compose.%s", *name);
+ compose_loaded = true;
+ args[i++] = to_free[j++] = arg;
+ if (i >= ELEMENTSOF(args) - 1)
+ break;
+ }
+ strv_free(strv_compose_table);
+ }
+ args[i++] = NULL;
+
+ pid = fork();
+ if (pid < 0)
+ return log_error_errno(errno, "Failed to fork: %m");
+ if (pid == 0) {
+ reset_all_signal_handlers();
+ reset_signal_mask();
+ execv(args[0], (char **) args);
+ _exit(EXIT_FAILURE);
+ }
+
+ ret = wait_for_terminate_and_warn(args[0], pid, true);
+ for (i = 0; i < j; ++i)
+ free(to_free[i]);
+ if (ret < 0)
+ return ret;
+ return ret == 0;
+}
+#endif
+
+static int kbdrate_set_and_wait(const char *vc, const char *kbd_rate,
+ const char *kbd_delay)
+{
+ const char *args[7];
+ int i = 0, ret;
+ pid_t pid;
+
+ if (isempty(kbd_rate) && isempty(kbd_delay))
+ return 1;
+
+ args[i++] = "/bin/kbdrate";
+ if (!isempty(kbd_rate)) {
+ args[i++] = "-r";
+ args[i++] = kbd_rate;
+ }
+ if (!isempty(kbd_delay)) {
+ args[i++] = "-d";
+ args[i++] = kbd_delay;
+ }
+ args[i++] = "-s";
+ args[i++] = NULL;
+
+ pid = fork();
+ if (pid < 0)
+ return log_error_errno(errno, "Failed to fork: %m");
+ if (pid == 0) {
+ reset_all_signal_handlers();
+ reset_signal_mask();
+ execv(args[0], (char **) args);
+ _exit(EXIT_FAILURE);
+ }
+ ret = wait_for_terminate_and_warn(args[0], pid, true);
+ if (ret < 0)
+ return ret;
+ return ret == 0;
+}
+
int main(int argc, char **argv) {
const char *vc;
_cleanup_free_ char
*vc_keymap = NULL, *vc_keymap_toggle = NULL,
*vc_font = NULL, *vc_font_map = NULL, *vc_font_unimap = NULL;
+#ifdef HAVE_SYSV_COMPAT
+ _cleanup_free_ char
+ *vc_kbd_delay = NULL, *vc_kbd_rate = NULL,
+ *vc_kbd_disable_caps_lock = NULL, *vc_compose_table = NULL;
+#endif
+ bool disable_capslock = false;
+ bool comp_ok, rate_ok;
_cleanup_close_ int fd = -1;
bool utf8, font_copy = false, font_ok, keyboard_ok;
int r = EXIT_FAILURE;
@@ -286,6 +398,31 @@ int main(int argc, char **argv) {
utf8 = is_locale_utf8();
+#ifdef HAVE_SYSV_COMPAT
+ r = parse_env_file("/etc/sysconfig/keyboard", NEWLINE,
+ "KEYTABLE", &vc_keymap,
+ "KBD_DELAY", &vc_kbd_delay,
+ "KBD_RATE", &vc_kbd_rate,
+ "KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock,
+ "COMPOSETABLE", &vc_compose_table,
+ NULL);
+ if (r < 0 && r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/keyboard: %s",
+ strerror(-r));
+
+ r = parse_env_file("/etc/sysconfig/console", NEWLINE,
+ "CONSOLE_FONT", &vc_font,
+ "CONSOLE_SCREENMAP", &vc_font_map,
+ "CONSOLE_UNICODEMAP", &vc_font_unimap,
+ NULL);
+ if (r < 0 && r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/console: %s",
+ strerror(-r));
+
+ disable_capslock = vc_kbd_disable_caps_lock &&
+ strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0;
+#endif /* HAVE_SYSV_COMPAT */
+
r = parse_env_file("/etc/vconsole.conf", NEWLINE,
"KEYMAP", &vc_keymap,
"KEYMAP_TOGGLE", &vc_keymap_toggle,
@@ -317,11 +454,17 @@ int main(int argc, char **argv) {
(void) disable_utf8(fd);
font_ok = font_load_and_wait(vc, vc_font, vc_font_map, vc_font_unimap) > 0;
- keyboard_ok = keyboard_load_and_wait(vc, vc_keymap, vc_keymap_toggle, utf8) > 0;
+ keyboard_ok = keyboard_load_and_wait(vc, vc_keymap, vc_keymap_toggle,
+ utf8, disable_capslock) > 0;
+#ifdef HAVE_SYSV_COMPAT
+ comp_ok = compose_load_and_wait(vc, vc_compose_table);
+ rate_ok = kbdrate_set_and_wait(vc, vc_kbd_rate, vc_kbd_delay);
+#endif
/* Only copy the font when we executed setfont successfully */
if (font_copy && font_ok)
(void) font_copy_to_all_vcs(fd);
- return font_ok && keyboard_ok ? EXIT_SUCCESS : EXIT_FAILURE;
+ return font_ok && keyboard_ok && comp_ok && rate_ok ?
+ EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@ -1,193 +0,0 @@
Set NumLock according to /etc/sysconfig/keyboard.
https://bugzilla.novell.com/show_bug.cgi?id=746595
Authors:
Stanislav Brabec <sbrabec@suse.cz>
Cristian Rodríguez <crrodriguez@opensuse.org>
---
Makefile.am | 13 ++++++++++
rules/73-seat-numlock.rules | 8 ++++++
src/login/numlock-on.c | 34 ++++++++++++++++++++++++++
src/vconsole/vconsole-setup.c | 41 ++++++++++++++++++++++++++++++--
units/systemd-vconsole-setup.service.in | 2 -
5 files changed, 95 insertions(+), 3 deletions(-)
Index: systemd-228/Makefile.am
===================================================================
--- systemd-228.orig/Makefile.am
+++ systemd-228/Makefile.am
@@ -3825,6 +3825,19 @@ dist_udevrules_DATA += \
rules/60-persistent-v4l.rules
# ------------------------------------------------------------------------------
+numlock_on_SOURCES = \
+ src/login/numlock-on.c
+
+numlock_on_CFLAGS = \
+ $(AM_CFLAGS)
+
+udevlibexec_PROGRAMS += \
+ numlock-on
+
+dist_udevrules_DATA += \
+ rules/73-seat-numlock.rules
+
+# ------------------------------------------------------------------------------
mtd_probe_SOURCES = \
src/udev/mtd_probe/mtd_probe.c \
src/udev/mtd_probe/mtd_probe.h \
Index: systemd-228/rules/73-seat-numlock.rules
===================================================================
--- /dev/null
+++ systemd-228/rules/73-seat-numlock.rules
@@ -0,0 +1,8 @@
+# This file is part of SUSE customization of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+SUBSYSTEM=="tty", ACTION=="add", KERNEL=="tty[0-9]|tty1[0-2]", TEST=="/run/numlock-on", RUN+="numlock-on $env{DEVNAME}"
Index: systemd-228/src/login/numlock-on.c
===================================================================
--- /dev/null
+++ systemd-228/src/login/numlock-on.c
@@ -0,0 +1,34 @@
+/*
+ * numlock-on.c: Turn numlock-on
+ *
+ * This file may be freely copied under the terms of the GNU General
+ * Public License (GPL), version 2, or at your option any later
+ * version.
+
+ * Copyright (C) 2013 Stanislav Brabec, SUSE
+ *
+ * based on setleds.c, which is
+ * Copyright (C) 1994-1999 Andries E. Brouwer
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+
+int
+main(int argc, char **argv) {
+ char flags;
+
+ if (ioctl(0, KDGKBLED, &flags)) {
+ perror("KDGKBLED");
+ exit(1);
+ }
+
+ if (ioctl(0, KDSKBLED, flags | LED_NUM | (LED_NUM << 4))) {
+ perror("KDSKBLED");
+ exit(1);
+ }
+
+ exit(0);
+}
Index: systemd-228/src/vconsole/vconsole-setup.c
===================================================================
--- systemd-228.orig/src/vconsole/vconsole-setup.c
+++ systemd-228/src/vconsole/vconsole-setup.c
@@ -36,6 +36,7 @@
#include "fileio.h"
#include "macro.h"
#include "strv.h"
+#include "fs-util.h"
#include "io-util.h"
#include "locale-util.h"
#include "log.h"
@@ -46,6 +47,10 @@
#include "util.h"
#include "virt.h"
+#define BIOS_DATA_AREA 0x400
+#define BDA_KEYBOARD_STATUS_FLAGS_4 0x97
+#define BDA_KSF4_NUMLOCK_MASK 0x02
+
static bool is_vconsole(int fd) {
unsigned char data[1];
@@ -364,9 +369,10 @@ int main(int argc, char **argv) {
#ifdef HAVE_SYSV_COMPAT
_cleanup_free_ char
*vc_kbd_delay = NULL, *vc_kbd_rate = NULL,
- *vc_kbd_disable_caps_lock = NULL, *vc_compose_table = NULL;
+ *vc_kbd_disable_caps_lock = NULL, *vc_compose_table = NULL,
+ *vc_kbd_numlock = NULL;
#endif
- bool disable_capslock = false;
+ bool disable_capslock = false, numlock = false;
bool comp_ok, rate_ok;
_cleanup_close_ int fd = -1;
bool utf8, font_copy = false, font_ok, keyboard_ok;
@@ -404,6 +410,7 @@ int main(int argc, char **argv) {
"KBD_DELAY", &vc_kbd_delay,
"KBD_RATE", &vc_kbd_rate,
"KBD_DISABLE_CAPS_LOCK", &vc_kbd_disable_caps_lock,
+ "KBD_NUMLOCK", &vc_kbd_numlock,
"COMPOSETABLE", &vc_compose_table,
NULL);
if (r < 0 && r != -ENOENT)
@@ -421,6 +428,32 @@ int main(int argc, char **argv) {
disable_capslock = vc_kbd_disable_caps_lock &&
strcasecmp(vc_kbd_disable_caps_lock, "YES") == 0;
+ numlock = vc_kbd_numlock && strcaseeq(vc_kbd_numlock, "yes");
+#if defined(__i386__) || defined(__x86_64__)
+ if (vc_kbd_numlock && strcaseeq(vc_kbd_numlock, "bios")) {
+ int _cleanup_close_ fdmem;
+ char c;
+
+ fdmem = open ("/dev/mem", O_RDONLY);
+ if (fdmem < 0) {
+ log_error("Failed to open /dev/mem: %m");
+ return EXIT_FAILURE;
+ }
+
+ if (lseek(fdmem, BIOS_DATA_AREA + BDA_KEYBOARD_STATUS_FLAGS_4, SEEK_SET) == (off_t) -1) {
+ log_error("Failed to seek /dev/mem: %m");
+ return EXIT_FAILURE;
+ }
+
+ if (read(fdmem, &c, sizeof(char)) == -1) {
+ log_error("Failed to read /dev/mem: %m");
+ return EXIT_FAILURE;
+ }
+
+ if (c & BDA_KSF4_NUMLOCK_MASK)
+ numlock = true;
+ }
+#endif /* x86 */
#endif /* HAVE_SYSV_COMPAT */
r = parse_env_file("/etc/vconsole.conf", NEWLINE,
@@ -456,6 +489,10 @@ int main(int argc, char **argv) {
font_ok = font_load_and_wait(vc, vc_font, vc_font_map, vc_font_unimap) > 0;
keyboard_ok = keyboard_load_and_wait(vc, vc_keymap, vc_keymap_toggle,
utf8, disable_capslock) > 0;
+ if (numlock)
+ touch("/run/numlock-on");
+ else
+ unlink("/run/numlock-on");
#ifdef HAVE_SYSV_COMPAT
comp_ok = compose_load_and_wait(vc, vc_compose_table);
rate_ok = kbdrate_set_and_wait(vc, vc_kbd_rate, vc_kbd_delay);
Index: systemd-228/units/systemd-vconsole-setup.service.in
===================================================================
--- systemd-228.orig/units/systemd-vconsole-setup.service.in
+++ systemd-228/units/systemd-vconsole-setup.service.in
@@ -10,7 +10,7 @@ Description=Setup Virtual Console
Documentation=man:systemd-vconsole-setup.service(8) man:vconsole.conf(5)
DefaultDependencies=no
Conflicts=shutdown.target
-Before=sysinit.target shutdown.target
+Before=sysinit.target shutdown.target systemd-udev-trigger.service
ConditionPathExists=/dev/tty0
[Service]

View File

@ -1,72 +0,0 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 4 Dec 2012 16:51:32 +0000
Subject: handle root_uses_lang value in /etc/sysconfig/language
handle ROOT_USES_LANG=ctype (boo#792182).
---
src/core/locale-setup.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
Index: systemd-228/src/core/locale-setup.c
===================================================================
--- systemd-228.orig/src/core/locale-setup.c
+++ systemd-228/src/core/locale-setup.c
@@ -30,11 +30,16 @@
#include "strv.h"
#include "util.h"
#include "virt.h"
+#include "alloc-util.h"
int locale_setup(char ***environment) {
char **add;
char *variables[_VARIABLE_LC_MAX] = {};
int r = 0, i;
+#ifdef HAVE_SYSV_COMPAT
+ char _cleanup_free_ *rc_lang = NULL, *rc_lc_ctype = NULL;
+ char _cleanup_free_ *root_uses_lang = NULL;
+#endif
if (detect_container() <= 0) {
r = parse_env_file("/proc/cmdline", WHITESPACE,
@@ -81,6 +86,41 @@ int locale_setup(char ***environment) {
if (r < 0 && r != -ENOENT)
log_warning_errno(r, "Failed to read /etc/locale.conf: %m");
}
+#ifdef HAVE_SYSV_COMPAT
+ r = parse_env_file("/etc/sysconfig/language", NEWLINE,
+ "RC_LANG", &rc_lang,
+ "RC_LC_CTYPE", &rc_lc_ctype,
+ "ROOT_USES_LANG", &root_uses_lang,
+ NULL);
+
+ if (r < 0 && r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/language: %s", strerror(-r));
+
+ /*
+ * Use the values of the interactive locale configuration in /etc/sysconfig/language
+ * as fallback if /etc/locale.conf does not exist and no locale was specified on the
+ * kernel's command line. The special case ROOT_USES_LANG=ctype allows to set LC_CTYPE
+ * even if LANG for root is set to e.g. POSIX. But do this only if no LC_CTYPE has been
+ * set in /etc/locale.conf and on the kernel's command line.
+ */
+ if (root_uses_lang) {
+ if (strcaseeq(root_uses_lang, "yes") && !variables[VARIABLE_LANG]) {
+ variables[VARIABLE_LANG] = rc_lang;
+ rc_lang = NULL;
+ }
+ if (strcaseeq(root_uses_lang, "ctype") && !variables[VARIABLE_LC_CTYPE]) {
+ if (variables[VARIABLE_LANG])
+ variables[VARIABLE_LC_CTYPE] = strdup(variables[VARIABLE_LANG]);
+ else if (rc_lc_ctype && *rc_lc_ctype) {
+ variables[VARIABLE_LC_CTYPE] = rc_lc_ctype;
+ rc_lc_ctype = NULL;
+ } else if (rc_lang && *rc_lang) {
+ variables[VARIABLE_LC_CTYPE] = rc_lang;
+ rc_lang = NULL;
+ }
+ }
+ }
+#endif
add = NULL;
for (i = 0; i < _VARIABLE_LC_MAX; i++) {

View File

@ -1,13 +0,0 @@
Index: systemd-222/src/core/hostname-setup.c
===================================================================
--- systemd-222.orig/src/core/hostname-setup.c
+++ systemd-222/src/core/hostname-setup.c
@@ -44,7 +44,7 @@ int hostname_setup(void) {
else
log_warning_errno(r, "Failed to read configured hostname: %m");
- hn = NULL;
+ hn = strdup("nohostname.set.site");
} else
hn = b;
/* strip any leftover of a domain name */

View File

@ -1,399 +0,0 @@
From a8cbe79c77836cc2466e3534157864abc98ef3ef Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 28 Jun 2013 17:54:41 +0200
Subject: [PATCH] insserv.conf generator
parse /etc/insserv.conf.dd content and /etc/insserv.conf and generate
systemd unit drop-in files to add dependencies
---
Makefile.am | 9
src/insserv-generator/Makefile | 28 ++
src/insserv-generator/insserv-generator.c | 319 ++++++++++++++++++++++++++++++
3 files changed, 355 insertions(+), 1 deletion(-)
create mode 100644 src/insserv-generator/Makefile
create mode 100644 src/insserv-generator/insserv-generator.c
Index: systemd-228/Makefile.am
===================================================================
--- systemd-228.orig/Makefile.am
+++ systemd-228/Makefile.am
@@ -626,7 +626,8 @@ nodist_systemunit_DATA += \
systemgenerator_PROGRAMS += \
systemd-sysv-generator \
- systemd-rc-local-generator
+ systemd-rc-local-generator \
+ systemd-insserv-generator
endif
EXTRA_DIST += \
@@ -2682,6 +2683,12 @@ $(systemd_boot): $(systemd_boot_solib)
endif
endif
+#-------------------------------------------------------------------------------
+systemd_insserv_generator_SOURCES = \
+ src/insserv-generator/insserv-generator.c
+
+systemd_insserv_generator_LDADD = libbasic.la
+
# ------------------------------------------------------------------------------
stub_headers = \
src/boot/efi/util.h \
Index: systemd-228/src/insserv-generator/Makefile
===================================================================
--- /dev/null
+++ systemd-228/src/insserv-generator/Makefile
@@ -0,0 +1,28 @@
+# This file is part of systemd.
+#
+# Copyright 2010 Lennart Poettering
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+# This file is a dirty trick to simplify compilation from within
+# emacs. This file is not intended to be distributed. So, don't touch
+# it, even better ignore it!
+
+all:
+ $(MAKE) -C ..
+
+clean:
+ $(MAKE) -C .. clean
+
+.PHONY: all clean
Index: systemd-228/src/insserv-generator/insserv-generator.c
===================================================================
--- /dev/null
+++ systemd-228/src/insserv-generator/insserv-generator.c
@@ -0,0 +1,319 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2012 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+ ***/
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "mkdir.h"
+#include "log.h"
+#include "fileio.h"
+#include "unit-name.h"
+#include "special.h"
+#include "path-util.h"
+#include "util.h"
+#include "strv.h"
+#include "alloc-util.h"
+#include "string-util.h"
+#include "fd-util.h"
+
+static const char *arg_dest = "/tmp";
+
+static char *sysv_translate_name(const char *name) {
+ char *r;
+
+ r = new(char, strlen(name) + sizeof(".service"));
+ if (!r)
+ return NULL;
+
+ if (endswith(name, ".sh"))
+ /* Drop .sh suffix */
+ strcpy(stpcpy(r, name) - 3, ".service");
+ if (startswith(name, "boot."))
+ /* Drop SuSE-style boot. prefix */
+ strcpy(stpcpy(r, name + 5), ".service");
+ else
+ /* Normal init script name */
+ strcpy(stpcpy(r, name), ".service");
+
+ return r;
+}
+
+static int sysv_translate_facility(const char *name, const char *filename, char **_r) {
+
+ /* We silently ignore the $ prefix here. According to the LSB
+ * spec it simply indicates whether something is a
+ * standardized name or a distribution-specific one. Since we
+ * just follow what already exists and do not introduce new
+ * uses or names we don't care who introduced a new name. */
+
+ static const char * const table[] = {
+ /* LSB defined facilities */
+ "local_fs", NULL,
+ "network", SPECIAL_NETWORK_ONLINE_TARGET,
+ "named", SPECIAL_NSS_LOOKUP_TARGET,
+ "portmap", SPECIAL_RPCBIND_TARGET,
+ "remote_fs", SPECIAL_REMOTE_FS_TARGET,
+ "syslog", NULL,
+ "time", SPECIAL_TIME_SYNC_TARGET,
+ };
+
+ unsigned i;
+ char *r;
+ const char *n;
+ int ret;
+
+ assert(name);
+ assert(_r);
+
+ n = *name == '$' ? name + 1 : name;
+
+ for (i = 0; i < ELEMENTSOF(table); i += 2) {
+
+ if (!streq(table[i], n))
+ continue;
+
+ if (!table[i+1])
+ return 0;
+
+ r = strdup(table[i+1]);
+ if (!r)
+ return log_oom();
+
+ goto finish;
+ }
+
+ /* If we don't know this name, fallback heuristics to figure
+ * out whether something is a target or a service alias. */
+
+ if (*name == '$') {
+ if (!unit_prefix_is_valid(n))
+ return -EINVAL;
+
+ /* Facilities starting with $ are most likely targets */
+ ret = unit_name_build(n, NULL, ".target", &r);
+ if (ret < 0)
+ return ret;
+ } else if (filename && streq(name, filename))
+ /* Names equaling the file name of the services are redundant */
+ return 0;
+ else
+ /* Everything else we assume to be normal service names */
+ r = sysv_translate_name(n);
+
+ if (!r)
+ return -ENOMEM;
+
+finish:
+ *_r = r;
+
+ return 1;
+}
+
+
+
+static int parse_insserv_conf(const char* filename) {
+ _cleanup_fclose_ FILE *f = NULL;
+ int r;
+
+ if (!(f = fopen(filename, "re"))) {
+ log_debug("Failed to open file %s", filename);
+ r = errno == ENOENT ? 0 : -errno;
+ return r;
+ }
+
+ while (!feof(f)) {
+ char l[LINE_MAX], *t;
+ _cleanup_strv_free_ char **parsed = NULL;
+
+ if (!fgets(l, sizeof(l), f)) {
+ if (feof(f))
+ break;
+
+ r = -errno;
+ log_error("Failed to read configuration file '%s': %s", filename, strerror(-r));
+ return -r;
+ }
+
+ t = strstrip(l);
+ if (*t != '$' && *t != '<')
+ continue;
+
+ parsed = strv_split(t,WHITESPACE);
+ /* we ignore <interactive>, not used, equivalent to X-Interactive */
+ if (parsed && !startswith_no_case (parsed[0], "<interactive>")) {
+ _cleanup_free_ char *facility = NULL;
+ if (sysv_translate_facility(parsed[0], NULL, &facility) < 0 || !facility)
+ continue;
+ if (streq(facility, SPECIAL_REMOTE_FS_TARGET)) {
+ _cleanup_free_ char *unit = NULL;
+ /* insert also a Wants dependency from remote-fs-pre on remote-fs */
+ unit = strjoin(arg_dest, "/remote-fs.target.d/50-",basename(filename),".conf", NULL);
+ if (!unit)
+ return log_oom();
+
+ mkdir_parents_label(unit, 0755);
+
+ r = write_string_file(unit,
+ "# Automatically generated by systemd-insserv-generator\n\n"
+ "[Unit]\n"
+ "Wants=remote-fs-pre.target\n",
+ WRITE_STRING_FILE_CREATE);
+ if (r)
+ return r;
+ free (facility);
+ facility=strdup(SPECIAL_REMOTE_FS_PRE_TARGET);
+ }
+ if (facility && endswith(facility, ".target")) {
+ char *name, **j;
+ FILE *file = NULL;
+
+ STRV_FOREACH (j, parsed+1) {
+ _cleanup_free_ char *unit = NULL;
+ _cleanup_free_ char *dep = NULL;
+
+ if (*j[0] == '+')
+ name = *j+1;
+ else
+ name = *j;
+ if (streq(name, "boot.localfs") ||
+ streq(name, "boot.crypto"))
+ continue;
+ if ((sysv_translate_facility(name, NULL, &dep) < 0) || !dep)
+ continue;
+
+ unit = strjoin(arg_dest, "/", dep, ".d/50-",basename(filename),"-",parsed[0],".conf", NULL);
+ if (!unit)
+ return log_oom();
+
+ mkdir_parents_label(unit, 0755);
+
+ file = fopen(unit, "wxe");
+ if (!file) {
+ if (errno == EEXIST)
+ log_error("Failed to create drop-in file %s", unit);
+ else
+ log_error("Failed to create drop-in file %s: %m", unit);
+ return -errno;
+ }
+
+ fprintf(file,
+ "# Automatically generated by systemd-insserv-generator\n\n"
+ "[Unit]\n"
+ "Wants=%s\n"
+ "Before=%s\n",
+ facility, facility);
+
+ fflush(file);
+ if (ferror(file)) {
+ log_error("Failed to write unit file %s: %m", unit);
+ return -errno;
+ }
+ fclose(file);
+
+ if (*j[0] != '+') {
+ free (unit);
+ unit = strjoin(arg_dest, "/", facility, ".d/50-hard-dependency-",basename(filename),"-",parsed[0],".conf", NULL);
+ if (!unit)
+ return log_oom();
+
+ mkdir_parents_label(unit, 0755);
+
+ file = fopen(unit, "wxe");
+ if (!file) {
+ if (errno == EEXIST)
+ log_error("Failed to create drop-in file %s, as it already exists", unit);
+ else
+ log_error("Failed to create drop-in file %s: %m", unit);
+ return -errno;
+ }
+
+
+ fprintf(file,
+ "# Automatically generated by systemd-insserv-generator\n\n"
+ "[Unit]\n"
+ "SourcePath=%s\n"
+ "Requires=%s\n",
+ filename, dep);
+ fflush(file);
+ if (ferror(file)) {
+ log_error("Failed to write unit file %s: %m", unit);
+ return -errno;
+ }
+ fclose(file);
+ }
+ }
+ }
+ }
+ }
+ return r;
+}
+
+static int parse_insserv(void) {
+ DIR *d = NULL;
+ struct dirent *de;
+ int r = 0;
+
+ if (!(d = opendir("/etc/insserv.conf.d/"))) {
+ if (errno != ENOENT) {
+ log_debug("opendir() failed on /etc/insserv.conf.d/ %s", strerror(errno));
+ }
+ } else {
+
+ while ((de = readdir(d))) {
+ char *path = NULL;
+ if (hidden_file(de->d_name))
+ continue;
+
+ path = strjoin("/etc/insserv.conf.d/", de->d_name, NULL);
+ parse_insserv_conf(path);
+ free(path);
+ }
+ closedir (d);
+ }
+
+ r = parse_insserv_conf("/etc/insserv.conf");
+
+ return r;
+}
+
+int main(int argc, char *argv[]) {
+ int r = 0;
+
+ if (argc > 1 && argc != 4) {
+ log_error("This program takes three or no arguments.");
+ return EXIT_FAILURE;
+ }
+
+ if (argc > 1)
+ arg_dest = argv[1];
+
+ log_set_target(LOG_TARGET_SAFE);
+ log_parse_environment();
+ log_open();
+
+ umask(0022);
+
+ r = parse_insserv();
+
+ return (r < 0) ? EXIT_FAILURE : EXIT_SUCCESS;
+}

View File

@ -1,138 +0,0 @@
From: werner@suse.de
Upstream: marked as openSUSE-specific fix originally, but may well
worth be to be sent upstream.
Original description:
(none)
Notes [jengelh@inai.de]:
MAP_NONBLOCK is documented (mmap(2) in man-pages-3.69+) to render
MAP_POPULATE ineffective. Why do we have it?
What is the rationale for MAP_STACK?
---
src/journal/catalog.c | 12 +++++++++++-
src/journal/journal-authenticate.c | 7 +++++--
src/journal/journald-kmsg.c | 3 ++-
src/journal/mmap-cache.c | 16 +++++++++++++++-
4 files changed, 33 insertions(+), 5 deletions(-)
Index: systemd-221/src/journal/catalog.c
===================================================================
--- systemd-221.orig/src/journal/catalog.c
+++ systemd-221/src/journal/catalog.c
@@ -469,6 +469,10 @@ finish:
static int open_mmap(const char *database, int *_fd, struct stat *_st, void **_p) {
const CatalogHeader *h;
+ static const unsigned int advice[] =
+ {MADV_WILLNEED, MADV_SEQUENTIAL, MADV_DONTDUMP, MADV_DONTFORK};
+ unsigned int n;
+ size_t psize;
int fd;
void *p;
struct stat st;
@@ -491,12 +495,18 @@ static int open_mmap(const char *databas
return -EINVAL;
}
- p = mmap(NULL, PAGE_ALIGN(st.st_size), PROT_READ, MAP_SHARED, fd, 0);
+ psize = PAGE_ALIGN(st.st_size);
+ p = mmap(NULL, psize, PROT_READ, MAP_SHARED | MAP_POPULATE |
+ MAP_NONBLOCK, fd, 0);
if (p == MAP_FAILED) {
safe_close(fd);
return -errno;
}
+ for (n = 0; n < sizeof(advice) / sizeof(*advice); ++n)
+ if (madvise(p, psize, advice[n]) < 0)
+ log_warning("Failed to give advice about use of memory: %m");
+
h = p;
if (memcmp(h->signature, CATALOG_SIGNATURE, sizeof(h->signature)) != 0 ||
le64toh(h->header_size) < sizeof(CatalogHeader) ||
Index: systemd-221/src/journal/journal-authenticate.c
===================================================================
--- systemd-221.orig/src/journal/journal-authenticate.c
+++ systemd-221/src/journal/journal-authenticate.c
@@ -355,7 +355,8 @@ int journal_file_fss_load(JournalFile *f
goto finish;
}
- m = mmap(NULL, PAGE_ALIGN(sizeof(FSSHeader)), PROT_READ, MAP_SHARED, fd, 0);
+ m = mmap(NULL, PAGE_ALIGN(sizeof(FSSHeader)), PROT_READ,
+ MAP_SHARED | MAP_STACK, fd, 0);
if (m == MAP_FAILED) {
m = NULL;
r = -errno;
@@ -399,7 +400,9 @@ int journal_file_fss_load(JournalFile *f
goto finish;
}
- f->fss_file = mmap(NULL, PAGE_ALIGN(f->fss_file_size), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+ f->fss_file = mmap(NULL, PAGE_ALIGN(f->fss_file_size),
+ PROT_READ | PROT_WRITE, MAP_SHARED | MAP_STACK,
+ fd, 0);
if (f->fss_file == MAP_FAILED) {
f->fss_file = NULL;
r = -errno;
Index: systemd-221/src/journal/journald-kmsg.c
===================================================================
--- systemd-221.orig/src/journal/journald-kmsg.c
+++ systemd-221/src/journal/journald-kmsg.c
@@ -454,7 +454,8 @@ int server_open_kernel_seqnum(Server *s)
return 0;
}
- p = mmap(NULL, sizeof(uint64_t), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+ p = mmap(NULL, sizeof(uint64_t), PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_STACK, fd, 0);
if (p == MAP_FAILED) {
log_error_errno(errno, "Failed to map sequential number file, ignoring: %m");
return 0;
Index: systemd-221/src/journal/mmap-cache.c
===================================================================
--- systemd-221.orig/src/journal/mmap-cache.c
+++ systemd-221/src/journal/mmap-cache.c
@@ -466,11 +466,14 @@ static int add_mmap(
struct stat *st,
void **ret) {
+ static const unsigned int advice[] =
+ {MADV_WILLNEED, MADV_SEQUENTIAL, MADV_DONTDUMP, MADV_DONTFORK};
uint64_t woffset, wsize;
Context *c;
FileDescriptor *f;
Window *w;
void *d;
+ unsigned int n;
int r;
assert(m);
@@ -509,7 +512,8 @@ static int add_mmap(
}
for (;;) {
- d = mmap(NULL, wsize, prot, MAP_SHARED, fd, woffset);
+ d = mmap(NULL, wsize, prot, MAP_SHARED | MAP_POPULATE |
+ MAP_NONBLOCK, fd, woffset);
if (d != MAP_FAILED)
break;
if (errno != ENOMEM)
@@ -522,6 +526,16 @@ static int add_mmap(
return -ENOMEM;
}
+ for (n = 0; n < sizeof(advice) / sizeof(*advice); ++n) {
+ if (advice[n] == MADV_DONTFORK) {
+ int flags = fcntl(fd, F_GETFD);
+ if (flags < 0 || !(flags & FD_CLOEXEC))
+ continue;
+ }
+ if (madvise(d, wsize, advice[n]) < 0)
+ log_warning("Failed to give advice about use of memory: %m");
+ }
+
c = context_add(m, context);
if (!c)
goto outofmem;

View File

@ -1,28 +0,0 @@
From: werner@suse.de
Date: Tue Jan 20 11:33:59 UTC 2015
---
src/locale/kbd-model-map | 13 +++++++++++++
1 file changed, 13 insertions(+)
Index: systemd-221/src/locale/kbd-model-map
===================================================================
--- systemd-221.orig/src/locale/kbd-model-map
+++ systemd-221/src/locale/kbd-model-map
@@ -66,3 +66,16 @@ lt.baltic lt pc105 - terminate:ctrl_a
lt.l4 lt pc105 - terminate:ctrl_alt_bksp
lt lt pc105 - terminate:ctrl_alt_bksp
khmer kh,us pc105 - terminate:ctrl_alt_bksp
+# Additional layouts offered by YaST
+Pl02 pl pc105 - terminate:ctrl_alt_bksp
+arabic ara,us pc105 - terminate:ctrl_alt_bksp,grp:shift_toggle
+cn-latin1 ca pc105 multix terminate:ctrl_alt_bksp
+cz-lat2-us cz,us pc105 qwerty,basic terminate:ctrl_alt_bksp,grp:shift_toggle
+es-cp850 es pc105 - terminate:ctrl_alt_bksp
+khmer us,kh pc105 - terminate:ctrl_alt_bksp,grp:alt_shift_toggle
+korean kr pc105 - terminate:ctrl_alt_bksp
+lt.baltic lt pc105 - terminate:ctrl_alt_bksp
+lt.std lt pc105 std terminate:ctrl_alt_bksp
+no-latin1 no pc105 - terminate:ctrl_alt_bksp
+ruwin_alt-UTF-8 us,ru pc105 ,winkeys terminate:ctrl_alt_bksp,grp:ctrl_shift_toggle,grp_led:scroll
+sk-qwertz sk,us pc105 - terminate:ctrl_alt_bksp,grp:shift_toggle

View File

@ -1,19 +0,0 @@
---
configure.ac | 4 ----
1 file changed, 4 deletions(-)
Index: systemd-224/configure.ac
===================================================================
--- systemd-224.orig/configure.ac
+++ systemd-224/configure.ac
@@ -199,10 +199,6 @@ AS_CASE([$CC], [*clang*],
-Wno-gnu-variable-sized-type-not-at-end \
])])
-AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
- [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
- -flto])],
- [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],

View File

@ -1,84 +0,0 @@
From: Werner Fink <werner@suse.de>
Date: Wed Sep 23 12:37:23 UTC 2015
Subject: Do not bother vistual console to much with GIO/PIO
This avoids broken virtual console mapping due stressed ioctl API
for the virtual consoles (boo#904214)
---
src/vconsole/vconsole-setup.c | 39 +++++++++++++++++++++++++--------------
1 file changed, 25 insertions(+), 14 deletions(-)
--- src/vconsole/vconsole-setup.c
+++ src/vconsole/vconsole-setup.c 2015-09-23 12:34:33.854018750 +0000
@@ -202,8 +202,13 @@ static void font_copy_to_all_vcs(int fd)
unsigned short map16[E_TABSZ];
struct unimapdesc unimapd;
struct unipair unipairs[USHRT_MAX];
+ struct console_font_op cfo = {};
int i, r;
+ bool hasmap8;
+ bool hasmap16;
+ bool hasunimap;
+
/* get active, and 16 bit mask of used VT numbers */
r = ioctl(fd, VT_GETSTATE, &vcs);
if (r < 0) {
@@ -211,10 +216,22 @@ static void font_copy_to_all_vcs(int fd)
return;
}
+ /* copy font from active VT, where the font was uploaded to */
+ cfo.op = KD_FONT_OP_COPY;
+ cfo.height = vcs.v_active-1; /* tty1 == index 0 */
+
+ hasmap8 = (ioctl(fd, GIO_SCRNMAP, map8) >= 0);
+ hasmap16 = (ioctl(fd, GIO_UNISCRNMAP, map16) >= 0);
+
+ /* unimapd is a ushort count and a pointer to an
+ * array of struct unipair { ushort, ushort } */
+ unimapd.entries = unipairs;
+ unimapd.entry_ct = USHRT_MAX;
+ hasunimap = (ioctl(fd, GIO_UNIMAP, &unimapd) >= 0);
+
for (i = 1; i <= 15; i++) {
char vcname[strlen("/dev/vcs") + DECIMAL_STR_MAX(int)];
_cleanup_close_ int vcfd = -1;
- struct console_font_op cfo = {};
if (i == vcs.v_active)
continue;
@@ -229,25 +246,19 @@ static void font_copy_to_all_vcs(int fd)
if (vcfd < 0)
continue;
- /* copy font from active VT, where the font was uploaded to */
- cfo.op = KD_FONT_OP_COPY;
- cfo.height = vcs.v_active-1; /* tty1 == index 0 */
+ /* copy font from active VT to vcs */
(void) ioctl(vcfd, KDFONTOP, &cfo);
- /* copy map of 8bit chars */
- if (ioctl(fd, GIO_SCRNMAP, map8) >= 0)
+ /* copy map of 8bit chars to vcs */
+ if (hasmap8)
(void) ioctl(vcfd, PIO_SCRNMAP, map8);
- /* copy map of 8bit chars -> 16bit Unicode values */
- if (ioctl(fd, GIO_UNISCRNMAP, map16) >= 0)
+ /* copy map of 8bit chars -> 16bit Unicode values to vcs */
+ if (hasmap16)
(void) ioctl(vcfd, PIO_UNISCRNMAP, map16);
- /* copy unicode translation table */
- /* unimapd is a ushort count and a pointer to an
- array of struct unipair { ushort, ushort } */
- unimapd.entries = unipairs;
- unimapd.entry_ct = USHRT_MAX;
- if (ioctl(fd, GIO_UNIMAP, &unimapd) >= 0) {
+ /* copy unicode translation table to vcs */
+ if (hasunimap) {
struct unimapinit adv = { 0, 0, 0 };
(void) ioctl(vcfd, PIO_UNIMAPCLR, &adv);

View File

@ -1,123 +0,0 @@
dnl Autoconf macros for libgcrypt
dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc.
dnl
dnl This file is free software; as a special exception the author gives
dnl unlimited permission to copy and/or distribute it, with or without
dnl modifications, as long as this notice is preserved.
dnl
dnl This file is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
dnl with the API version to also check the API compatibility. Example:
dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
dnl this features allows to prevent build against newer versions of libgcrypt
dnl with a changed API.
dnl
AC_DEFUN([AM_PATH_LIBGCRYPT],
[ AC_ARG_WITH(libgcrypt-prefix,
AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
[prefix where LIBGCRYPT is installed (optional)]),
libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
if test x$libgcrypt_config_prefix != x ; then
if test x${LIBGCRYPT_CONFIG+set} != xset ; then
LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
fi
fi
AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
tmp=ifelse([$1], ,1:1.2.0,$1)
if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
else
req_libgcrypt_api=0
min_libgcrypt_version="$tmp"
fi
AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
ok=no
if test "$LIBGCRYPT_CONFIG" != "no" ; then
req_major=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
major=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
fi
if test $ok = yes; then
AC_MSG_RESULT([yes ($libgcrypt_config_version)])
else
AC_MSG_RESULT(no)
fi
if test $ok = yes; then
# If we have a recent libgcrypt, we should also check that the
# API is compatible
if test "$req_libgcrypt_api" -gt 0 ; then
tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
if test "$tmp" -gt 0 ; then
AC_MSG_CHECKING([LIBGCRYPT API version])
if test "$req_libgcrypt_api" -eq "$tmp" ; then
AC_MSG_RESULT([okay])
else
ok=no
AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp])
fi
fi
fi
fi
if test $ok = yes; then
LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
ifelse([$2], , :, [$2])
if test x"$host" != x ; then
libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
if test x"$libgcrypt_config_host" != xnone ; then
if test x"$libgcrypt_config_host" != x"$host" ; then
AC_MSG_WARN([[
***
*** The config script $LIBGCRYPT_CONFIG was
*** built for $libgcrypt_config_host and thus may not match the
*** used host $host.
*** You may want to use the configure option --with-libgcrypt-prefix
*** to specify a matching config script.
***]])
fi
fi
fi
else
LIBGCRYPT_CFLAGS=""
LIBGCRYPT_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(LIBGCRYPT_LIBS)
])

View File

@ -1,105 +0,0 @@
# -*- Mode: rpm-spec; indent-tabs-mode: nil -*- */
#
# This file is part of systemd.
#
# Copyright 2012 Lennart Poettering
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
# RPM macros for packages installing systemd unit files
%_unitdir @systemunitdir@
%_userunitdir @userunitdir@
%_presetdir @systempresetdir@
%_udevhwdbdir @udevhwdbdir@
%_udevrulesdir @udevrulesdir@
%_journalcatalogdir @catalogdir@
%_tmpfilesdir @tmpfilesdir@
%_sysusersdir @sysusersdir@
%_sysctldir @sysctldir@
%_binfmtdir @binfmtdir@
%systemd_requires \
Requires(post): systemd \
Requires(preun): systemd \
Requires(postun): systemd \
%{nil}
%systemd_post() \
if [ $1 -eq 1 ] ; then \
# Initial installation \
systemctl --no-reload preset %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}
%systemd_user_post() %systemd_post --user --global %{?*}
%systemd_preun() \
if [ $1 -eq 0 ] ; then \
# Package removal, not upgrade \
systemctl --no-reload disable --now %{?*} > /dev/null 2>&1 || : \
fi \
%{nil}
%systemd_user_preun() \
if [ $1 -eq 0 ] ; then \
# Package removal, not upgrade \
systemctl --no-reload --user --global disable %{?*} > /dev/null 2>&1 || : \
fi \
%{nil}
%systemd_postun() %{nil}
%systemd_user_postun() %{nil}
%systemd_postun_with_restart() \
if [ $1 -ge 1 ] ; then \
# Package upgrade, not uninstall \
systemctl try-restart %{?*} >/dev/null 2>&1 || : \
fi \
%{nil}
%systemd_user_postun_with_restart() %{nil}
%udev_hwdb_update() \
udevadm hwdb --update >/dev/null 2>&1 || : \
%{nil}
%udev_rules_update() \
udevadm control --reload >/dev/null 2>&1 || : \
%{nil}
%journal_catalog_update() \
journalctl --update-catalog >/dev/null 2>&1 || : \
%{nil}
%tmpfiles_create() \
systemd-tmpfiles --create %{?*} >/dev/null 2>&1 || : \
%{nil}
%sysusers_create() \
systemd-sysusers %{?*} >/dev/null 2>&1 || : \
%{nil}
%sysusers_create_inline() \
echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \
%{nil}
%sysctl_apply() \
@rootlibexecdir@/systemd-sysctl %{?*} >/dev/null 2>&1 || : \
%{nil}
%binfmt_apply() \
@rootlibexecdir@/systemd-binfmt %{?*} >/dev/null 2>&1 || : \
%{nil}

View File

@ -1,25 +0,0 @@
If after emergency service had been started there is incoming
traffic on syslog.socket emergency.service gets killed due to
implicit dependencies on basic.target => sysinit.target which in
turn conflict with emergency.target.
As a workaround explicitly stop syslog.socket when entering
emergency.service.
Reference: bnc#852232
---
units/emergency.service.in | 1 +
1 file changed, 1 insertion(+)
Index: systemd-221/units/emergency.service.in
===================================================================
--- systemd-221.orig/units/emergency.service.in
+++ systemd-221/units/emergency.service.in
@@ -11,6 +11,7 @@ Documentation=man:sulogin(8)
DefaultDependencies=no
Conflicts=shutdown.target
Conflicts=rescue.service
+Conflicts=syslog.socket
Before=shutdown.target
[Service]

View File

@ -1,31 +0,0 @@
#!/bin/bash
# sed calls copied from fedora package
set -e
case "$1" in
--help)
echo "$0 [--enable|--disable]"
exit 0
;;
--enable)
sed -i.bak -e '
/^hosts:/ !b
/\<myhostname\>/ b
s/[[:blank:]]*$/ myhostname/
' /etc/nsswitch.conf
;;
--disable)
sed -i.bak -e '
/^hosts:/ !b
s/[[:blank:]]\+myhostname\>//
' /etc/nsswitch.conf
;;
"")
if grep -q "^hosts:.*\<myhostname\>" /etc/nsswitch.conf; then
echo "enabled"
else
echo "disabled"
fi
;;
*) echo "invalid argument $1"; exit 1 ;;
esac

View File

@ -1,67 +0,0 @@
---
src/fstab-generator/fstab-generator.c | 45 +++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
Index: systemd-221/src/fstab-generator/fstab-generator.c
===================================================================
--- systemd-221.orig/src/fstab-generator/fstab-generator.c
+++ systemd-221/src/fstab-generator/fstab-generator.c
@@ -47,6 +47,49 @@ static char *arg_usr_what = NULL;
static char *arg_usr_fstype = NULL;
static char *arg_usr_options = NULL;
+static int check_crypttab(const char *what) {
+ _cleanup_fclose_ FILE *f = NULL;
+ unsigned n = 0;
+
+ f = fopen("/etc/crypttab", "re");
+ if (!f) {
+ if (errno != ENOENT)
+ log_error("Failed to open /etc/crypttab: %m");
+
+ return 1;
+ }
+
+
+ for (;;) {
+ char line[LINE_MAX], *l;
+ _cleanup_free_ char *name = NULL, *device = NULL, *password = NULL, *options = NULL;
+ int k;
+
+ if (!fgets(line, sizeof(line), f))
+ break;
+
+ n++;
+
+ l = strstrip(line);
+ if (*l == '#' || *l == 0)
+ continue;
+
+ k = sscanf(l, "%ms %ms %ms %ms", &name, &device, &password, &options);
+ if (k < 2 || k > 4) {
+ log_error("Failed to parse /etc/crypttab:%u, ignoring.", n);
+ continue;
+ }
+
+ if (strcmp((what + 12), name) == 0) {
+ if (options && strstr(options, "noauto"))
+ return 0;
+
+ return 1;
+ }
+ }
+ return 1;
+}
+
static int add_swap(
const char *what,
struct mntent *me,
@@ -108,7 +151,7 @@ static int add_swap(
if (r < 0)
return r;
- if (!noauto) {
+ if (!noauto && check_crypttab(what) != 0) {
lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET,
nofail ? ".wants/" : ".requires/", name, NULL);
if (!lnk)

View File

@ -1,46 +0,0 @@
---
units/console-shell.service.m4.in | 2 ++
units/emergency.service.in | 2 +-
units/rescue.service.in | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
Index: systemd-224/units/console-shell.service.m4.in
===================================================================
--- systemd-224.orig/units/console-shell.service.m4.in
+++ systemd-224/units/console-shell.service.m4.in
@@ -17,6 +17,8 @@ Before=getty.target
[Service]
Environment=HOME=/root
WorkingDirectory=/root
+ExecStartPre=-/usr/bin/plymouth quit
+ExecStartPre=-/usr/bin/plymouth --wait
ExecStart=-@SULOGIN@
ExecStopPost=-@SYSTEMCTL@ poweroff
Type=idle
Index: systemd-224/units/emergency.service.in
===================================================================
--- systemd-224.orig/units/emergency.service.in
+++ systemd-224/units/emergency.service.in
@@ -17,7 +17,7 @@ Before=shutdown.target
[Service]
Environment=HOME=/root
WorkingDirectory=/root
-ExecStartPre=-/bin/plymouth --wait quit
+ExecStartPre=-/usr/bin/plymouth --wait quit
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.'
ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default"
Type=idle
Index: systemd-224/units/rescue.service.in
===================================================================
--- systemd-224.orig/units/rescue.service.in
+++ systemd-224/units/rescue.service.in
@@ -16,7 +16,8 @@ Before=shutdown.target
[Service]
Environment=HOME=/root
WorkingDirectory=/root
-ExecStartPre=-/bin/plymouth quit
+ExecStartPre=-/usr/bin/plymouth quit
+ExecStartPre=-/usr/bin/plymouth --wait
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.'
ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default"
Type=idle

View File

@ -1,13 +0,0 @@
---
units/rpcbind.target | 1 +
1 file changed, 1 insertion(+)
Index: systemd-221/units/rpcbind.target
===================================================================
--- systemd-221.orig/units/rpcbind.target
+++ systemd-221/units/rpcbind.target
@@ -12,3 +12,4 @@
Description=RPC Port Mapper
Documentation=man:systemd.special(7)
RefuseManualStart=yes
+Wants=rpcbind.socket

View File

@ -1,16 +0,0 @@
#!/bin/sh
# This script is based on libcdio_spec-prepare.sh (thanks to sbrabec@suse.cz)
# create a -mini spec for systemd for bootstrapping
ORIG_SPEC=systemd
EDIT_WARNING="##### WARNING: please do not edit this auto generated spec file. Use the ${ORIG_SPEC}.spec! #####\n"
sed "s/^%define bootstrap .*$/${EDIT_WARNING}%define bootstrap 1/;
s/^%define mini .*$/${EDIT_WARNING}%define mini -mini/;
s/^\(Name:.*\)$/\1-mini/;
s/^BuildRoot.*/&\n\nProvides: %{real} = %{version}-%{release}\n/
" < ${ORIG_SPEC}.spec > ${ORIG_SPEC}-mini.spec
cp ${ORIG_SPEC}.changes ${ORIG_SPEC}-mini.changes
cp ${ORIG_SPEC}-rpmlintrc ${ORIG_SPEC}-mini-rpmlintrc
osc service localrun format_spec_file

View File

@ -1,29 +0,0 @@
---
units/emergency.target | 1 +
units/rescue.target | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
Index: systemd-221/units/emergency.target
===================================================================
--- systemd-221.orig/units/emergency.target
+++ systemd-221/units/emergency.target
@@ -10,4 +10,5 @@ Description=Emergency Mode
Documentation=man:systemd.special(7)
Requires=emergency.service
After=emergency.service
+Conflicts=getty.target rescue.target
AllowIsolate=yes
Index: systemd-221/units/rescue.target
===================================================================
--- systemd-221.orig/units/rescue.target
+++ systemd-221/units/rescue.target
@@ -10,7 +10,8 @@ Description=Rescue Mode
Documentation=man:systemd.special(7)
Requires=sysinit.target rescue.service
After=sysinit.target rescue.service
-Conflicts=getty.target
+Conflicts=getty.target emergency.target
+Before=emergency.target
AllowIsolate=yes
[Install]

View File

@ -1,22 +0,0 @@
---
src/fstab-generator/fstab-generator.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: systemd-221/src/fstab-generator/fstab-generator.c
===================================================================
--- systemd-221.orig/src/fstab-generator/fstab-generator.c
+++ systemd-221/src/fstab-generator/fstab-generator.c
@@ -289,8 +289,11 @@ static int add_mount(
"Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n",
source);
- if (post && !noauto && !nofail && !automount)
- fprintf(f, "Before=%s\n", post);
+ if (post && !noauto && !nofail && !automount) {
+ bool is_nfs = fstype != NULL && streq(fstype, "nfs");
+ if (!is_nfs || strstr(opts, "bg") == NULL)
+ fprintf(f, "Before=%s\n", post);
+ }
if (!automount && opts) {
r = write_requires_after(f, opts);

View File

@ -1,87 +0,0 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 29 Oct 2012 13:01:20 +0000
Subject: restore /var/run and /var/lock bind mount if they aren't symlink
---
Makefile.am | 9 +++++++++
units/var-lock.mount | 19 +++++++++++++++++++
units/var-run.mount | 19 +++++++++++++++++++
3 files changed, 47 insertions(+)
create mode 100644 units/var-lock.mount
create mode 100644 units/var-run.mount
Index: systemd-221/Makefile.am
===================================================================
--- systemd-221.orig/Makefile.am
+++ systemd-221/Makefile.am
@@ -526,6 +526,12 @@ dist_systemunit_DATA += \
dist_systemunit_DATA_busnames += \
units/busnames.target
+if HAVE_SYSV_COMPAT
+dist_systemunit_DATA += \
+ units/var-run.mount \
+ units/var-lock.mount
+endif
+
nodist_systemunit_DATA = \
units/getty@.service \
units/serial-getty@.service \
@@ -6123,6 +6129,9 @@ GRAPHICAL_TARGET_WANTS += \
systemd-update-utmp-runlevel.service
RESCUE_TARGET_WANTS += \
systemd-update-utmp-runlevel.service
+LOCAL_FS_TARGET_WANTS += \
+ var-run.mount \
+ var-lock.mount
endif
SYSINIT_TARGET_WANTS += \
Index: systemd-221/units/var-lock.mount
===================================================================
--- /dev/null
+++ systemd-221/units/var-lock.mount
@@ -0,0 +1,19 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Lock Directory
+Before=local-fs.target
+# skip mounting if the directory does not exist or is a symlink
+ConditionPathIsDirectory=/var/lock
+ConditionPathIsSymbolicLink=!/var/lock
+
+[Mount]
+What=/run/lock
+Where=/var/lock
+Type=bind
+Options=bind
Index: systemd-221/units/var-run.mount
===================================================================
--- /dev/null
+++ systemd-221/units/var-run.mount
@@ -0,0 +1,19 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Runtime Directory
+Before=local-fs.target
+# skip mounting if the directory does not exist or is a symlink
+ConditionPathIsDirectory=/var/run
+ConditionPathIsSymbolicLink=!/var/run
+
+[Mount]
+What=/run
+Where=/var/run
+Type=bind
+Options=bind

View File

@ -1,175 +0,0 @@
Use and set default logging console for both journald and kernel messages
---
src/journal/journald-console.c | 100 +++++++++++++++++++++++++++++++++++++++++
src/journal/journald-console.h | 3 +
src/journal/journald-server.c | 5 ++
3 files changed, 108 insertions(+)
Index: systemd-228/src/journal/journald-console.c
===================================================================
--- systemd-228.orig/src/journal/journald-console.c
+++ systemd-228/src/journal/journald-console.c
@@ -22,6 +22,14 @@
#include <fcntl.h>
#include <sys/socket.h>
#include <time.h>
+#ifdef HAVE_SYSV_COMPAT
+# include <linux/tiocl.h>
+# include <linux/vt.h>
+# include <sys/ioctl.h>
+# include <sys/klog.h>
+# include <errno.h>
+# include "string-util.h"
+#endif
#include "alloc-util.h"
#include "fd-util.h"
@@ -50,6 +58,76 @@ static bool prefix_timestamp(void) {
return cached_printk_time;
}
+void default_tty_path(Server *s)
+{
+#ifdef HAVE_SYSV_COMPAT
+ static const char list[] = "/dev/tty10\0" "/dev/console\0";
+ const char *vc;
+
+ if (s->tty_path)
+ return;
+
+ NULSTR_FOREACH(vc, list) {
+ _cleanup_close_ int fd = -1;
+
+ if (access(vc, F_OK) < 0)
+ continue;
+
+ fd = open_terminal(vc, O_WRONLY|O_NOCTTY|O_CLOEXEC);
+ if (fd < 0)
+ continue;
+
+ s->tty_path = strdup(vc);
+ break;
+ }
+#endif
+}
+
+void klogconsole(Server *s)
+{
+#ifdef HAVE_SYSV_COMPAT
+ _cleanup_free_ char *klogconsole_params = NULL;
+ _cleanup_close_ int fd = -1;
+ const char *vc = s->tty_path;
+ const char *num;
+ int tiocl[2];
+ int r;
+
+ if (!vc || *vc == 0 || !strneq("/dev/tty", vc, 8))
+ return;
+
+ num = vc + strcspn(vc, "0123456789");
+ if (safe_atoi(num, &r) < 0)
+ return;
+
+ if (access(vc, F_OK) < 0)
+ return;
+
+ fd = open_terminal(vc, O_RDWR|O_NOCTTY|O_CLOEXEC);
+ if (fd < 0)
+ return;
+
+ tiocl[0] = TIOCL_SETKMSGREDIRECT;
+ tiocl[1] = r;
+
+ if (ioctl(fd, TIOCLINUX, tiocl) < 0)
+ return;
+
+ zero(klogconsole_params);
+ r = parse_env_file("/etc/sysconfig/boot", NEWLINE,
+ "KLOGCONSOLE_PARAMS", &klogconsole_params,
+ NULL);
+ if (r < 0)
+ return;
+ if (!klogconsole_params || *klogconsole_params == 0)
+ return;
+
+ num = klogconsole_params + strcspn(klogconsole_params, "0123456789");
+ if (safe_atoi(num, &r) == 0)
+ klogctl(8, 0, r);
+#endif
+}
+
void server_forward_console(
Server *s,
int priority,
@@ -71,6 +149,12 @@ void server_forward_console(
if (LOG_PRI(priority) > s->max_level_console)
return;
+#ifdef HAVE_SYSV_COMPAT
+ /* Do not write security/authorization (private) messages to console */
+ if ((priority & LOG_FACMASK) == LOG_AUTHPRIV)
+ return;
+#endif
+
/* First: timestamp */
if (prefix_timestamp()) {
assert_se(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
@@ -107,7 +191,23 @@ void server_forward_console(
fd = open_terminal(tty, O_WRONLY|O_NOCTTY|O_CLOEXEC);
if (fd < 0) {
log_debug_errno(fd, "Failed to open %s for logging: %m", tty);
+#ifdef HAVE_SYSV_COMPAT
+ if (fd != -ENOENT && fd != -ENODEV)
+ return;
+ if (tty != s->tty_path)
+ return;
+ if (!streq("/dev/console", tty)) {
+ if (s->tty_path)
+ free(s->tty_path);
+ s->tty_path = NULL;
+ tty = "/dev/console";
+ fd = open_terminal(tty, O_WRONLY|O_NOCTTY|O_CLOEXEC);
+ if (fd < 0)
+ return;
+ }
+#else
return;
+#endif
}
if (writev(fd, iovec, n) < 0)
Index: systemd-228/src/journal/journald-console.h
===================================================================
--- systemd-228.orig/src/journal/journald-console.h
+++ systemd-228/src/journal/journald-console.h
@@ -24,3 +24,6 @@
#include "journald-server.h"
void server_forward_console(Server *s, int priority, const char *identifier, const char *message, const struct ucred *ucred);
+
+void klogconsole(Server *s);
+void default_tty_path(Server *s);
Index: systemd-228/src/journal/journald-server.c
===================================================================
--- systemd-228.orig/src/journal/journald-server.c
+++ systemd-228/src/journal/journald-server.c
@@ -55,6 +55,7 @@
#include "journald-audit.h"
#include "journald-kmsg.h"
#include "journald-native.h"
+#include "journald-console.h"
#include "journald-rate-limit.h"
#include "journald-server.h"
#include "journald-stream.h"
@@ -1751,6 +1752,10 @@ int server_init(Server *s) {
server_parse_config_file(s);
server_parse_proc_cmdline(s);
+ default_tty_path(s);
+
+ if (s->tty_path)
+ klogconsole(s);
if (!!s->rate_limit_interval ^ !!s->rate_limit_burst) {
log_debug("Setting both rate limit interval and burst from "USEC_FMT",%u to 0,0",

View File

@ -1,25 +0,0 @@
---
Makefile.am | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Index: systemd-221/Makefile.am
===================================================================
--- systemd-221.orig/Makefile.am
+++ systemd-221/Makefile.am
@@ -4129,11 +4129,11 @@ noinst_LTLIBRARIES += \
libjournal-core.la
journal-install-hook:
- -$(MKDIR_P) $(DESTDIR)/var/log/journal
- -chown 0:0 $(DESTDIR)/var/log/journal
- -chmod 755 $(DESTDIR)/var/log/journal
- -setfacl -nm g:adm:rx,d:g:adm:rx $(DESTDIR)/var/log/journal/
- -setfacl -nm g:wheel:rx,d:g:wheel:rx $(DESTDIR)/var/log/journal/
+ -$(MKDIR_P) $(DESTDIR)/var/log/journal/
+ -@echo chown 0:0 $(DESTDIR)/var/log/journal/
+ -chmod 755 $(DESTDIR)/var/log/journal/
+ -@echo setfacl -nm g:adm:rx,d:g:adm:rx $(DESTDIR)/var/log/journal/
+ -@echo setfacl -nm g:wheel:rx,d:g:wheel:rx $(DESTDIR)/var/log/journal/
journal-uninstall-hook:
-rmdir $(DESTDIR)/var/log/journal/remote

View File

@ -1,80 +0,0 @@
From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 12 Apr 2013 16:56:26 +0200
Subject: Revert "service: drop support for SysV scripts for the early boot"
This reverts commit 3cdebc217c42c8529086f2965319b6a48eaaeabe.
[Implementation note: currently, the unit is generated, but not
activated even if symlinks exist in boot.d. Hmmm... -jengelh@inai.de]
---
src/sysv-generator/sysv-generator.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
Index: systemd-228/src/sysv-generator/sysv-generator.c
===================================================================
--- systemd-228.orig/src/sysv-generator/sysv-generator.c
+++ systemd-228/src/sysv-generator/sysv-generator.c
@@ -46,7 +46,8 @@
typedef enum RunlevelType {
RUNLEVEL_UP,
- RUNLEVEL_DOWN
+ RUNLEVEL_DOWN,
+ RUNLEVEL_SYSINIT,
} RunlevelType;
static const struct {
@@ -54,6 +55,9 @@ static const struct {
const char *target;
const RunlevelType type;
} rcnd_table[] = {
+ /* SUSE style boot.d */
+ { "boot.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
+
/* Standard SysV runlevels for start-up */
{ "rc1.d", SPECIAL_RESCUE_TARGET, RUNLEVEL_UP },
{ "rc2.d", SPECIAL_MULTI_USER_TARGET, RUNLEVEL_UP },
@@ -69,10 +73,10 @@ static const struct {
directories in this order, and we want to make sure that
sysv_start_priority is known when we first load the
unit. And that value we only know from S links. Hence
- UP must be read before DOWN */
+ UP/SYSINIT must be read before DOWN */
};
-const char *arg_dest = "/tmp";
+static const char *arg_dest = "/tmp";
typedef struct SysvStub {
char *name;
@@ -261,6 +265,10 @@ static char *sysv_translate_name(const c
_cleanup_free_ char *c = NULL;
char *res;
+ if (startswith(name, "boot."))
+ /* Drop SuSE-style boot. prefix */
+ name += 5;
+
c = strdup(name);
if (!c)
return NULL;
@@ -882,7 +890,8 @@ static int set_dependencies_from_rcnd(co
if (de->d_name[0] == 'S') {
- if (rcnd_table[i].type == RUNLEVEL_UP)
+ if (rcnd_table[i].type == RUNLEVEL_UP ||
+ rcnd_table[i].type == RUNLEVEL_SYSINIT)
service->sysv_start_priority = MAX(a*10 + b, service->sysv_start_priority);
r = set_ensure_allocated(&runlevel_services[i], NULL);
@@ -898,7 +907,8 @@ static int set_dependencies_from_rcnd(co
}
} else if (de->d_name[0] == 'K' &&
- (rcnd_table[i].type == RUNLEVEL_DOWN)) {
+ (rcnd_table[i].type == RUNLEVEL_DOWN ||
+ rcnd_table[i].type == RUNLEVEL_SYSINIT)) {
r = set_ensure_allocated(&shutdown_services, NULL);
if (r < 0) {

View File

@ -1,30 +0,0 @@
Mention that --force is required to override an already existing default.target
This solves the bug bnc#868439
---
man/systemctl.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: systemd-221/man/systemctl.xml
===================================================================
--- systemd-221.orig/man/systemctl.xml
+++ systemd-221/man/systemctl.xml
@@ -439,7 +439,7 @@
<term><option>--force</option></term>
<listitem>
- <para>When used with <command>enable</command>, overwrite
+ <para>When used with <command>enable</command> or <command>set-default</command>, overwrite
any existing conflicting symlinks.</para>
<para>When used with <command>halt</command>,
@@ -1237,6 +1237,8 @@ kobject-uevent 1 systemd-udevd-kernel.so
<para>Return the default target to boot into. This returns
the target unit name <filename>default.target</filename>
is aliased (symlinked) to.</para>
+ <para>If combined with <option>--force</option>, override
+ an already existing symlink for the default target.</para>
</listitem>
</varlistentry>

3
systemd-4.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d569a0624d7ce409cd76ace49d2d853f9e030674e24ea585427b9079f10ba5ba
size 637332

View File

@ -1,92 +0,0 @@
---
man/tmpfiles.d.xml | 3 +++
src/tmpfiles/tmpfiles.c | 46 ++++++++++++++++++++++++++++++++++++++++------
2 files changed, 43 insertions(+), 6 deletions(-)
Index: systemd-228/man/tmpfiles.d.xml
===================================================================
--- systemd-228.orig/man/tmpfiles.d.xml
+++ systemd-228/man/tmpfiles.d.xml
@@ -599,6 +599,9 @@
<varname>f</varname>, <varname>F</varname>, and
<varname>w</varname>, the argument may be used to specify a short string that
is written to the file, suffixed by a newline. For
+ <varname>x</varname>, <varname>X</varname>, a comma separated list of
+ usernames. If given, only paths belonging to these users will be excluded
+ during directory cleanup. Ignored for all other lines. For
<varname>C</varname>, specifies the source file or
directory. For <varname>t</varname> and <varname>T</varname>,
determines extended attributes to be set. For
Index: systemd-228/src/tmpfiles/tmpfiles.c
===================================================================
--- systemd-228.orig/src/tmpfiles/tmpfiles.c
+++ systemd-228/src/tmpfiles/tmpfiles.c
@@ -37,6 +37,7 @@
#include <sys/xattr.h>
#include <time.h>
#include <unistd.h>
+#include <pwd.h>
#include "acl-util.h"
#include "alloc-util.h"
@@ -378,6 +379,7 @@ static int dir_cleanup(
struct timespec times[2];
bool deleted = false;
int r = 0;
+ Item *found = NULL;
while ((dent = readdir(d))) {
struct stat s;
@@ -428,14 +430,46 @@ static int dir_cleanup(
}
/* Is there an item configured for this path? */
- if (ordered_hashmap_get(items, sub_path)) {
- log_debug("Ignoring \"%s\": a separate entry exists.", sub_path);
- continue;
+ bool found_glob = false;
+ found = ordered_hashmap_get(items, sub_path);
+ if (!found) {
+ found_glob = true;
+ found = find_glob(globs, sub_path);
}
- if (find_glob(globs, sub_path)) {
- log_debug("Ignoring \"%s\": a separate glob exists.", sub_path);
- continue;
+ if (found) {
+ struct passwd *pw;
+ char *userfound = NULL, *args;
+ bool match = false;
+ uid_t uid = -1;
+
+ /* evaluate username arguments in ignore statements */
+ if ((found->type != IGNORE_PATH && found->type != IGNORE_DIRECTORY_PATH) ||
+ !found->argument) {
+ if (found_glob)
+ log_debug("Ignoring \"%s\": a separate glob exists.", sub_path);
+ else
+ log_debug("Ignoring \"%s\": a separate entry exists.", sub_path);
+ continue;
+ }
+ args = strdup(found->argument);
+ assert_se(args != NULL);
+ while ((userfound = strsep(&args, ",")) != NULL) {
+ pw = getpwnam(userfound);
+ if (pw == NULL) {
+ log_error("Unknown user '%s' in ignore statement.", userfound);
+ continue;
+ }
+ uid = pw->pw_uid;
+ if (s.st_uid == uid) {
+ match = true;
+ break;
+ }
+ }
+ if (match) {
+ found = NULL;
+ continue;
+ }
}
if (S_ISDIR(s.st_mode)) {

View File

@ -1,33 +0,0 @@
---
src/basic/def.h | 2 +-
src/libsystemd/sd-bus/sd-bus.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Index: systemd-221/src/basic/def.h
===================================================================
--- systemd-221.orig/src/basic/def.h
+++ systemd-221/src/basic/def.h
@@ -61,7 +61,7 @@
"/usr/lib/kbd/keymaps/\0"
#endif
-#define UNIX_SYSTEM_BUS_ADDRESS "unix:path=/var/run/dbus/system_bus_socket"
+#define UNIX_SYSTEM_BUS_ADDRESS "unix:path=/run/dbus/system_bus_socket"
#define KERNEL_SYSTEM_BUS_ADDRESS "kernel:path=/sys/fs/kdbus/0-system/bus"
#define DEFAULT_SYSTEM_BUS_ADDRESS KERNEL_SYSTEM_BUS_ADDRESS ";" UNIX_SYSTEM_BUS_ADDRESS
#define UNIX_USER_BUS_ADDRESS_FMT "unix:path=%s/bus"
Index: systemd-221/src/libsystemd/sd-bus/sd-bus.c
===================================================================
--- systemd-221.orig/src/libsystemd/sd-bus/sd-bus.c
+++ systemd-221/src/libsystemd/sd-bus/sd-bus.c
@@ -837,8 +837,8 @@ static int parse_container_unix_address(
b->nspid = 0;
b->sockaddr.un.sun_family = AF_UNIX;
- strncpy(b->sockaddr.un.sun_path, "/var/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path));
- b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + strlen("/var/run/dbus/system_bus_socket");
+ strncpy(b->sockaddr.un.sun_path, "/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path));
+ b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + strlen("/run/dbus/system_bus_socket");
return 0;
}

View File

@ -1,34 +0,0 @@
---
Makefile.am | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: systemd-221/Makefile.am
===================================================================
--- systemd-221.orig/Makefile.am
+++ systemd-221/Makefile.am
@@ -5876,12 +5876,6 @@ lib_LTLIBRARIES += \
libsystemd-id128.la \
libsystemd-daemon.la
-pkgconfiglib_DATA += \
- src/compat-libs/libsystemd-journal.pc \
- src/compat-libs/libsystemd-login.pc \
- src/compat-libs/libsystemd-id128.pc \
- src/compat-libs/libsystemd-daemon.pc
-
# move lib from $(libdir) to $(rootlibdir) and update devel link, if needed
compat-lib-install-hook:
libname=libsystemd-login.so && $(move-to-rootlibdir)
@@ -5899,6 +5893,12 @@ INSTALL_EXEC_HOOKS += compat-lib-install
UNINSTALL_EXEC_HOOKS += compat-lib-uninstall-hook
endif
+pkgconfiglib_DATA += \
+ src/compat-libs/libsystemd-journal.pc \
+ src/compat-libs/libsystemd-login.pc \
+ src/compat-libs/libsystemd-id128.pc \
+ src/compat-libs/libsystemd-daemon.pc
+
EXTRA_DIST += \
src/compat-libs/linkwarning.h \
src/compat-libs/libsystemd-journal.pc.in \

View File

@ -1,29 +0,0 @@
addFilter("invalid-pkgconfig-file")
addFilter(".*dangling-symlink /sbin/(halt|init|poweroff|telinit|shutdown|runlevel|reboot).*")
addFilter(".*dangling-symlink .* /dev/null.*")
addFilter(".*files-duplicate .*/reboot\.8.*")
addFilter(".*files-duplicate .*/sd_is_socket\.3.*")
addFilter("non-conffile-in-etc /etc/bash_completion.d/systemd-bash-completion\.sh")
addFilter("non-conffile-in-etc /etc/rpm/macros\.systemd")
addFilter(".*dbus-policy-allow-receive")
addFilter(".*dangling-symlink /lib/udev/devices/std(in|out|err).*")
addFilter(".*dangling-symlink /lib/udev/devices/core.*")
addFilter(".*dangling-symlink /lib/udev/devices/fd.*")
addFilter(".*incoherent-init-script-name boot\.udev.*")
addFilter(".init-script-without-%stop_on_removal-preun /etc/init\.d/boot\.udev")
addFilter(".init-script-without-%restart_on_update-postun /etc/init\.d/boot\.udev")
addFilter(".*devel-file-in-non-devel-package.*udev.pc.*")
addFilter(".*libgudev-.*shlib-fixed-dependency.*")
addFilter(".*suse-filelist-forbidden-systemd-userdirs.*")
addFilter("libudev-mini.*shlib-policy-name-error.*")
addFilter("nss-myhostname.*shlib-policy-name-error.*")
addFilter("nss-mymachines.*shlib-policy-name-error.*")
addFilter("systemd-logger.*useless-provides sysvinit(syslog).*")
addFilter("devel-file-in-non-devel-package.*/usr/share/pkgconfig/(udev|systemd)\.pc.*")
addFilter(".*script-without-shebang.*/usr/lib/udev/rule_generator.functions.*")
addFilter(".*files-duplicate.*/systemd-logger.*")
addFilter(".*missing-call-to-setgroups-before-setuid.*")
addFilter(".*missing-call-to-chdir-with-chroot.*")
addFilter(".*systemd-service-without-service.*")
addFilter(".*shlib-policy-missing-suffix.*")
addFilter(".*suse-missing-rclink.*")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +0,0 @@
Index: systemd-227/factory/etc/pam.d/other
===================================================================
--- systemd-227.orig/factory/etc/pam.d/other
+++ systemd-227/factory/etc/pam.d/other
@@ -1,6 +1,6 @@
# This file is part of systemd.
-auth include system-auth
-account include system-auth
-password include system-auth
-session include system-auth
+auth include common-auth
+account include common-account
+password include common-password
+session include common-session
Index: systemd-227/src/login/systemd-user.m4
===================================================================
--- systemd-227.orig/src/login/systemd-user.m4
+++ systemd-227/src/login/systemd-user.m4
@@ -2,10 +2,10 @@
#
# Used by systemd --user instances.
-account include system-auth
+account include common-account
m4_ifdef(`HAVE_SELINUX',
session required pam_selinux.so close
session required pam_selinux.so nottys open
)m4_dnl
-session include system-auth
+session include common-session

View File

@ -1,15 +0,0 @@
#!/bin/sh
PATH=/usr/bin:/bin:/usr/sbin:/sbin
DIR=$(sed -rn '/^#/d;\@^[[:graph:]]+[[:space:]]+/[[:graph:]]+[[:space:]]+tmpfs[[:space:]]+.*size=[0-9]+[kmg,[:space:]]@{ s@^[[:graph:]]+[[:space:]]+(/[[:graph:]]+).*@\1@p }' /etc/fstab)
if [ -n "$DIR" ]; then
for i in $DIR; do
echo $i
mount -o remount "$i" >/dev/null 2>&1
STATE=$?
if [ "$STATE" -gt 0 ]; then
logger "Remount of $i failed with state $STATE"
fi
done
fi

View File

@ -1,29 +1,4 @@
addFilter("invalid-pkgconfig-file")
addFilter(".*dangling-symlink /sbin/(halt|init|poweroff|telinit|shutdown|runlevel|reboot).*") addFilter(".*dangling-symlink /sbin/(halt|init|poweroff|telinit|shutdown|runlevel|reboot).*")
addFilter(".*dangling-symlink .* /dev/null.*") addFilter(".*devel-file-in-non-devel-package.*systemd.pc.*")
addFilter(".*files-duplicate .*/reboot\.8.*") addFilter(".*files-duplicate .*/reboot.8.*")
addFilter(".*files-duplicate .*/sd_is_socket\.3.*") addFilter(".*files-duplicate .*/sd_is_socket.3.*")
addFilter("non-conffile-in-etc /etc/bash_completion.d/systemd-bash-completion\.sh")
addFilter("non-conffile-in-etc /etc/rpm/macros\.systemd")
addFilter(".*dbus-policy-allow-receive")
addFilter(".*dangling-symlink /lib/udev/devices/std(in|out|err).*")
addFilter(".*dangling-symlink /lib/udev/devices/core.*")
addFilter(".*dangling-symlink /lib/udev/devices/fd.*")
addFilter(".*incoherent-init-script-name boot\.udev.*")
addFilter(".init-script-without-%stop_on_removal-preun /etc/init\.d/boot\.udev")
addFilter(".init-script-without-%restart_on_update-postun /etc/init\.d/boot\.udev")
addFilter(".*devel-file-in-non-devel-package.*udev.pc.*")
addFilter(".*libgudev-.*shlib-fixed-dependency.*")
addFilter(".*suse-filelist-forbidden-systemd-userdirs.*")
addFilter("libudev-mini.*shlib-policy-name-error.*")
addFilter("nss-myhostname.*shlib-policy-name-error.*")
addFilter("nss-mymachines.*shlib-policy-name-error.*")
addFilter("systemd-logger.*useless-provides sysvinit(syslog).*")
addFilter("devel-file-in-non-devel-package.*/usr/share/pkgconfig/(udev|systemd)\.pc.*")
addFilter(".*script-without-shebang.*/usr/lib/udev/rule_generator.functions.*")
addFilter(".*files-duplicate.*/systemd-logger.*")
addFilter(".*missing-call-to-setgroups-before-setuid.*")
addFilter(".*missing-call-to-chdir-with-chroot.*")
addFilter(".*systemd-service-without-service.*")
addFilter(".*shlib-policy-missing-suffix.*")
addFilter(".*suse-missing-rclink.*")

View File

@ -1,179 +0,0 @@
#!/bin/bash
if [ "$UID" != "0" ]; then
echo Need to be root.
exit 1
fi
declare -A results_runlevel
declare -A results_priority
usage() {
cat << EOF
usage: systemd-sysv-convert [-h] [--save] [--show] [--apply]
SERVICE [SERVICE ...]
EOF
}
help() {
usage
cat << EOF
Save and Restore SysV Service Runlevel Information
positional arguments:
SERVICE Service names
optional arguments:
-h, --help show this help message and exit
--save Save SysV runlevel information for one or more services
--show Show saved SysV runlevel information for one or more services
--apply Apply saved SysV runlevel information for one or more services
to systemd counterparts
EOF
}
find_service() {
local service
local runlevel
declare -i priority
service=$1
runlevel=$2
priority=-1
for l in $(ls /etc/rc.d/rc$runlevel.d/) ; do
initscript=$(basename $l)
if [ ${initscript:0:1} != "S" -o ${initscript:3} != "$service" ]; then
continue
fi
if [ ${initscript:1:2} -ge 0 -a ${initscript:1:2} -le 99 -a ${initscript:1:2} -ge $priority ]; then
if [ ${initscript:1:1} == 0 ]; then
priority=${initscript:2:1}
else
priority=${initscript:1:2}
fi
fi
done
if [ $priority -ge 0 ]; then
return $priority
else
return 255
fi
}
lookup_database() {
local services
local service
local service_file
local runlevel
local priority
local -i k
declare -a parsed
services=$@
k=0
results_runlevel=()
results_priority=()
while read line ; do
k+=1
parsed=($line)
service=${parsed[0]}
runlevel=${parsed[1]}
priority=${parsed[2]}
if [ $runlevel -lt 2 -o $runlevel -gt 5 ]; then
echo "Runlevel out of bounds in database line $k. Ignoring" >/dev/stderr
continue
fi
if [ $priority -lt 0 -o $priority -gt 99 ]; then
echo "Priority out of bounds in database line $k. Ignoring" >/dev/stderr
continue
fi
declare -i found
found=0
for s in $services ; do
if [ $s == $service ]; then
found=1
continue
fi
done
if [ $found -eq 0 ]; then
continue
fi
results_runlevel[$service]+=" $runlevel"
results_priority[$service]+=" $priority"
done < /var/lib/systemd/sysv-convert/database
}
case "$1" in
-h|--help)
help
exit 0
;;
--save)
shift
for service in $@ ; do
if [ ! -r "/etc/init.d/$service" ]; then
echo "SysV service $service does not exist" >/dev/stderr
exit 1
fi
for runlevel in 2 3 4 5; do
find_service $service $runlevel
priority=$?
if [ $priority -lt 255 ]; then
echo "$service $runlevel $priority" >> /var/lib/systemd/sysv-convert/database
fi
done
done
;;
--show)
shift
services=$@
lookup_database $services
fail=0
for service in $services; do
if [ -z "${results_runlevel[$service]}" ]; then
echo No information found about service $service found. >/dev/stderr
fail=1
continue
fi
declare -i count
count=0
priority=(${results_priority[$service]})
for runlevel in ${results_runlevel[$service]}; do
echo SysV service $service enabled in runlevel $runlevel at priority ${priority[$count]}
count+=1
done
done
exit $fail
;;
--apply)
shift
services=$@
for service in $services; do
if [ ! -f "/lib/systemd/system/$service.service" -a ! -f "/usr/lib/systemd/system/$service.service" ]; then
echo systemd service $service.service does not exist. >/dev/stderr
exit 1
fi
done
lookup_database $services
for service in $services; do
[ -f "/lib/systemd/system/$service.service" ] && service_file="/lib/systemd/system/$service.service"
[ -f "/usr/lib/systemd/system/$service.service" ] && service_file="/usr/lib/systemd/system/$service.service"
if [ -z "${results_runlevel[$service]}" ]; then
echo No information found about service $service found. >/dev/stderr
fail=1
continue
fi
for runlevel in ${results_runlevel[$service]}; do
echo ln -sf $service_file /etc/systemd/system/runlevel$runlevel.target.wants/$service.service >/dev/stderr
mkdir -p "/etc/systemd/system/runlevel$runlevel.target.wants"
/bin/ln -sf $service_file /etc/systemd/system/runlevel$runlevel.target.wants/$service.service
done
done
;;
*) usage
exit 2;;
esac

View File

@ -1,26 +0,0 @@
#!/bin/sh
set -e
usage() {
echo "Usage: $0 [--root=path] enable|disable|is-enabled <sysv script name>" >&2
exit 1
}
eval set -- "$(getopt -o r: --long root: -- "$@")"
while true; do
case "$1" in
-r|--root)
ROOT="$2"
shift 2 ;;
--) shift ; break ;;
*) usage ;;
esac
done
NAME="$2"
ROOT="${ROOT:+--root=$ROOT}"
[ -n "$NAME" ] || usage
case "$1" in
enable) chkconfig $ROOT -a "$NAME" ;;
disable) chkconfig $ROOT -r "$NAME" ;;
is-enabled) chkconfig $ROOT -t "$NAME" ;;
*) usage ;;
esac

View File

@ -1,26 +0,0 @@
From: Reinhard Max <max@suse.de>
Date: Fri, 19 Apr 2013 16:12:28 +0200
Subject: systemd tmp safe defaults
Fix regression in the default for tmp auto-deletion (FATE#314974).
SUSE policy is to not clean /tmp by default.
---
tmpfiles.d/tmp.conf | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: systemd-228/tmpfiles.d/tmp.conf
===================================================================
--- systemd-228.orig/tmpfiles.d/tmp.conf
+++ systemd-228/tmpfiles.d/tmp.conf
@@ -8,8 +8,9 @@
# See tmpfiles.d(5) for details
# Clear tmp directories separately, to make them easier to override
-q /tmp 1777 root root 10d
-q /var/tmp 1777 root root 30d
+# SUSE policy: we do not clean these directories
+q /tmp 1777 root root -
+q /var/tmp 1777 root root -
# Exclude namespace mountpoints created with PrivateTmp=yes
x /tmp/systemd-private-%b-*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +0,0 @@
Provide /run/lock/subsys directory to be able to provide the
/var/lock/subsys via the symbolic link /var/lock (bnc#889357)
---
tmpfiles.d/legacy.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-221/tmpfiles.d/legacy.conf
===================================================================
--- systemd-221.orig/tmpfiles.d/legacy.conf
+++ systemd-221/tmpfiles.d/legacy.conf
@@ -17,7 +17,7 @@ L /var/lock - - - - ../run/lock
# /run/lock/subsys is used for serializing SysV service execution, and
# hence without use on SysV-less systems.
-#d /run/lock/subsys 0755 root root -
+d /run/lock/subsys 0755 root root -
# /run/lock/lockdev is used to serialize access to tty devices via
# LCK..xxx style lock files, For more information see:

View File

@ -1,376 +0,0 @@
From 907bc2aa36f58c6050cd4b7b290e0992a4373e49 Mon Sep 17 00:00:00 2001
From: Werner Fink <werner@suse.de>
Date: Wed, 30 Sep 2015 15:00:41 +0200
Subject: [PATCH] Ask for passphrases not only on the first console of
/dev/console
but also on all other consoles. This does help on e.g. mainframes
where often a serial console together with other consoles are
used. Even rack based servers attachted to both a serial console
as well as having a virtual console do sometimes miss a connected
monitor.
To be able to ask on all terminal devices of /dev/console the devices
are collected. If more than one device are found, then on each of the
terminals a inquiring task for passphrase is forked and do not return
to the caller.
Every task has its own session and its own controlling terminal.
If one of the tasks does handle a password, the remaining tasks
will be terminated.
Also let contradictory options on the command of
systemd-tty-ask-password-agent fail.
Spwan for each device of the system console /dev/console a own process.
Replace the system call wait() with with system call waitid().
---
src/tty-ask-password-agent/tty-ask-password-agent.c | 264 +++++++++++++++++++-
1 file changed, 254 insertions(+), 10 deletions(-)
Index: systemd-228/src/tty-ask-password-agent/tty-ask-password-agent.c
===================================================================
--- systemd-228.orig/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ systemd-228/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -4,6 +4,7 @@
This file is part of systemd.
Copyright 2010 Lennart Poettering
+ Copyright 2015 Werner Fink
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
@@ -21,6 +22,9 @@
#include <errno.h>
#include <fcntl.h>
+#include <sys/prctl.h>
+#include <signal.h>
+#include <sys/wait.h>
#include <getopt.h>
#include <poll.h>
#include <stdbool.h>
@@ -49,6 +53,8 @@
#include "terminal-util.h"
#include "util.h"
#include "utmp-wtmp.h"
+#include "fileio.h"
+#include "macro.h"
static enum {
ACTION_LIST,
@@ -57,8 +63,21 @@ static enum {
ACTION_WALL
} arg_action = ACTION_QUERY;
+struct console {
+ pid_t pid;
+ char *tty;
+};
+
+static volatile sig_atomic_t sigchild;
+
+static void chld_handler(int sig) {
+ ++sigchild;
+}
+
static bool arg_plymouth = false;
static bool arg_console = false;
+static bool arg_device = false;
+static const char *current_dev = "/dev/console";
static int ask_password_plymouth(
const char *message,
@@ -240,6 +259,80 @@ finish:
return r;
}
+static void free_consoles(struct console *con, unsigned int num) {
+ unsigned int n;
+
+ if (!con || num == 0)
+ return;
+
+ for (n = 0; n < num; n++)
+ free(con[n].tty);
+
+ free(con);
+}
+
+static int collect_consoles(struct console **consoles, unsigned int *num) {
+ _cleanup_free_ char *active = NULL;
+ const char *word, *state;
+ struct console *con = NULL;
+ size_t con_len = 0, len;
+ unsigned int count = 0;
+ int ret;
+
+ assert(num);
+ assert(consoles);
+
+ ret = read_one_line_file("/sys/class/tty/console/active", &active);
+ if (ret < 0)
+ return log_error_errno(ret, "Failed to read /sys/class/tty/console/active: %m");
+
+ FOREACH_WORD(word, len, active, state) {
+ _cleanup_free_ char *tty = NULL;
+
+ if (len == 4 && strneq(word, "tty0", 4)) {
+
+ ret = read_one_line_file("/sys/class/tty/tty0/active", &tty);
+ if (ret < 0)
+ return log_error_errno(ret, "Failed to read /sys/class/tty/tty0/active: %m");
+
+ word = tty;
+ len = strlen(tty);
+ }
+
+ con = GREEDY_REALLOC(con, con_len, 1+count);
+ if (!con)
+ return log_oom();
+
+ if (asprintf(&con[count].tty, "/dev/%.*s", (int)len, word) < 0) {
+ free_consoles(con, count);
+ return log_oom();
+ }
+
+ con[count].pid = 0;
+ count++;
+ }
+
+ if (!con) {
+ con = GREEDY_REALLOC(con, con_len, 1);
+ if (!con)
+ return log_oom();
+
+ con[0].tty = strdup(current_dev);
+ if (!con[0].tty) {
+ free_consoles(con, 1);
+ return log_oom();
+ }
+
+ con[0].pid = 0;
+ count++;
+ }
+
+ *num = count;
+ *consoles = con;
+
+ return 0;
+}
+
static int parse_password(const char *filename, char **wall) {
_cleanup_free_ char *socket_name = NULL, *message = NULL, *packet = NULL;
bool accept_cached = false, echo = false;
@@ -340,7 +433,7 @@ static int parse_password(const char *fi
int tty_fd = -1;
if (arg_console) {
- tty_fd = acquire_terminal("/dev/console", false, false, false, USEC_INFINITY);
+ tty_fd = acquire_terminal(current_dev, false, false, false, USEC_INFINITY);
if (tty_fd < 0)
return log_error_errno(tty_fd, "Failed to acquire /dev/console: %m");
@@ -601,7 +694,7 @@ static int parse_argv(int argc, char *ar
{ "watch", no_argument, NULL, ARG_WATCH },
{ "wall", no_argument, NULL, ARG_WALL },
{ "plymouth", no_argument, NULL, ARG_PLYMOUTH },
- { "console", no_argument, NULL, ARG_CONSOLE },
+ { "console", optional_argument, NULL, ARG_CONSOLE },
{}
};
@@ -643,6 +736,10 @@ static int parse_argv(int argc, char *ar
case ARG_CONSOLE:
arg_console = true;
+ if (optarg && *optarg) {
+ current_dev = optarg;
+ arg_device = true;
+ }
break;
case '?':
@@ -657,9 +754,143 @@ static int parse_argv(int argc, char *ar
return -EINVAL;
}
+ if (arg_plymouth || arg_console) {
+
+ if (!IN_SET(arg_action, ACTION_QUERY, ACTION_WATCH)) {
+ log_error("%s conflicting options --query and --watch.", program_invocation_short_name);
+ return -EINVAL;
+ }
+
+ if (arg_plymouth && arg_console) {
+ log_error("%s conflicting options --plymouth and --console.", program_invocation_short_name);
+ return -EINVAL;
+ }
+ }
+
return 1;
}
+/*
+ * To be able to ask on all terminal devices of /dev/console
+ * the devices are collected. If more than one device are found,
+ * then on each of the terminals a inquiring task is forked.
+ * Every task has its own session and its own controlling terminal.
+ * If one of the tasks does handle a password, the remaining tasks
+ * will be terminated.
+ */
+static int ask_on_consoles(int argc, char *argv[]) {
+ struct console *consoles = NULL;
+ struct sigaction sig = {
+ .sa_handler = chld_handler,
+ .sa_flags = SA_NOCLDSTOP | SA_RESTART,
+ };
+ struct sigaction oldsig;
+ sigset_t oldset;
+ unsigned int num = 0, id;
+ siginfo_t status = {};
+ int ret;
+
+ ret = collect_consoles(&consoles, &num);
+ if (ret < 0)
+ return log_error_errno(ret, "Failed to query password: %m");
+
+ assert_se(sigprocmask_many(SIG_UNBLOCK, &oldset, SIGHUP, SIGCHLD, -1) >= 0);
+
+ assert_se(sigemptyset(&sig.sa_mask) >= 0);
+ assert_se(sigaction(SIGCHLD, &sig, &oldsig) >= 0);
+
+ sig.sa_handler = SIG_DFL;
+ assert_se(sigaction(SIGHUP, &sig, NULL) >= 0);
+
+ for (id = 0; id < num; id++) {
+ consoles[id].pid = fork();
+
+ if (consoles[id].pid < 0)
+ return log_error_errno(errno, "Failed to query password: %m");
+
+ if (consoles[id].pid == 0) {
+ char *conarg;
+ int ac;
+
+ conarg = strjoina("--console=", consoles[id].tty);
+ if (!conarg)
+ return log_oom();
+
+ free_consoles(consoles, num); /* not used anymore */
+
+ assert_se(prctl(PR_SET_PDEATHSIG, SIGHUP) >= 0);
+
+ zero(sig);
+ assert_se(sigprocmask(SIG_UNBLOCK, &oldset, NULL) >= 0);
+ assert_se(sigaction(SIGCHLD, &oldsig, NULL) >= 0);
+
+ for (ac = 0; ac < argc; ac++) {
+ if (streq(argv[ac], "--console")) {
+ argv[ac] = conarg;
+ break;
+ }
+ }
+
+ execv(SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH, argv);
+
+ return log_error_errno(errno, "Failed to execute %s: %m", program_invocation_name);
+ }
+ }
+
+ ret = 0;
+ while (true) {
+
+ if ((ret = waitid(P_ALL, 0, &status, WEXITED)) < 0) {
+
+ if (errno != EINTR) {
+ ret = -errno;
+ if (errno == ECHILD)
+ ret = EXIT_SUCCESS;
+ break;
+ }
+ continue;
+ }
+
+ for (id = 0; id < num; id++) {
+ struct timespec timeout;
+ sigset_t set;
+ int signum;
+
+ if (consoles[id].pid == status.si_pid || kill(consoles[id].pid, 0) < 0)
+ consoles[id].pid = -1;
+
+ if (consoles[id].pid < 0)
+ continue;
+
+ kill(consoles[id].pid, SIGHUP);
+
+ assert_se(sigemptyset(&set) >= 0);
+ assert_se(sigaddset(&set, SIGCHLD) >= 0);
+
+ timespec_store(&timeout, 50 * USEC_PER_MSEC);
+ signum = sigtimedwait(&set, NULL, &timeout);
+
+ if (signum != SIGCHLD) {
+
+ if (signum < 0 && errno != EAGAIN)
+ return log_error_errno(errno, "sigtimedwait() failed: %m");
+
+ if (signum >= 0)
+ log_warning("sigtimedwait() returned unexpected signal.");
+ }
+
+ kill(consoles[id].pid, SIGKILL);
+ }
+
+ if (WIFEXITED(status.si_status) && ret == 0)
+ ret = WEXITSTATUS(status.si_status);
+ }
+
+ free_consoles(consoles, num);
+
+ return ret;
+}
+
int main(int argc, char *argv[]) {
int r;
@@ -673,16 +904,29 @@ int main(int argc, char *argv[]) {
if (r <= 0)
goto finish;
- if (arg_console) {
- (void) setsid();
- (void) release_terminal();
+ if (arg_console && !arg_device)
+ /*
+ * Spawn for each console device a own process
+ */
+ r = ask_on_consoles(argc, argv);
+ else {
+
+ if (arg_device) {
+ /*
+ * Later on a controlling terminal will be will be acquired,
+ * therefore the current process has to become a session
+ * leader and should not have a controlling terminal already.
+ */
+ (void) setsid();
+ (void) release_terminal();
+ }
+
+ if (IN_SET(arg_action, ACTION_WATCH, ACTION_WALL))
+ r = watch_passwords();
+ else
+ r = show_passwords();
}
- if (IN_SET(arg_action, ACTION_WATCH, ACTION_WALL))
- r = watch_passwords();
- else
- r = show_passwords();
-
finish:
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}

View File

@ -1,155 +0,0 @@
Simply writing /var/lib/systemd/random-seed back to /dev/(u)random does not
increase the entropy bit count. Therefore use the RNDADDENTROPY ioctl to
write back the bytes and increase the entropy bit counter.
Related to bnc#892096
---
src/random-seed/random-seed.c | 71 ++++++++++++++++++++++++++++++++++++------
1 file changed, 61 insertions(+), 10 deletions(-)
Index: systemd-228/src/random-seed/random-seed.c
===================================================================
--- systemd-228.orig/src/random-seed/random-seed.c
+++ systemd-228/src/random-seed/random-seed.c
@@ -24,6 +24,8 @@
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <linux/random.h>
+#include <sys/ioctl.h>
#include "alloc-util.h"
#include "fd-util.h"
@@ -36,8 +38,8 @@
#define POOL_SIZE_MIN 512
int main(int argc, char *argv[]) {
- _cleanup_close_ int seed_fd = -1, random_fd = -1;
- _cleanup_free_ void* buf = NULL;
+ _cleanup_close_ int seed_fd = -1, random_fd = -1, entropy_fd = -1;
+ _cleanup_free_ struct rand_pool_info *entropy = NULL;
size_t buf_size = 0;
ssize_t k;
int r;
@@ -68,11 +70,12 @@ int main(int argc, char *argv[]) {
if (buf_size <= POOL_SIZE_MIN)
buf_size = POOL_SIZE_MIN;
- buf = malloc(buf_size);
- if (!buf) {
+ entropy = (struct rand_pool_info*) malloc(sizeof(struct rand_pool_info) + buf_size);
+ if (!entropy) {
r = log_oom();
goto finish;
}
+ entropy->buf_size = (typeof(entropy->buf_size)) buf_size;
r = mkdir_parents_label(RANDOM_SEED, 0755);
if (r < 0) {
@@ -86,6 +89,23 @@ int main(int argc, char *argv[]) {
if (streq(argv[1], "load")) {
+ entropy_fd = open(RANDOM_SEED_DIR "entropy_count", O_RDONLY|O_CLOEXEC|O_NOCTTY, 0600);
+ if (entropy_fd < 0) {
+ entropy->entropy_count = 0;
+ if (errno != ENOENT) {
+ log_error("Failed to open " RANDOM_SEED "/entropy_count: %m");
+ r = -errno;
+ goto finish;
+ }
+ } else {
+ r = read(entropy_fd, &entropy->entropy_count, sizeof(entropy->entropy_count));
+ if (r < 0) {
+ log_error("Failed to read entropy count file: %m");
+ r = -errno;
+ goto finish;
+ }
+ }
+
seed_fd = open(RANDOM_SEED, O_RDWR|O_CLOEXEC|O_NOCTTY|O_CREAT, 0600);
if (seed_fd < 0) {
seed_fd = open(RANDOM_SEED, O_RDONLY|O_CLOEXEC|O_NOCTTY);
@@ -106,7 +126,7 @@ int main(int argc, char *argv[]) {
}
}
- k = loop_read(seed_fd, buf, buf_size, false);
+ k = loop_read(seed_fd, entropy->buf, (size_t) entropy->buf_size, false);
if (k < 0)
r = log_error_errno(k, "Failed to read seed from " RANDOM_SEED ": %m");
else if (k == 0)
@@ -114,13 +134,29 @@ int main(int argc, char *argv[]) {
else {
(void) lseek(seed_fd, 0, SEEK_SET);
- r = loop_write(random_fd, buf, (size_t) k, false);
- if (r < 0)
- log_error_errno(r, "Failed to write seed to /dev/urandom: %m");
+ if (entropy->entropy_count && (size_t)k == (size_t)entropy->buf_size) {
+ r = ioctl(random_fd, RNDADDENTROPY, entropy);
+ if (r < 0) {
+ log_error_errno(errno, "Failed to write seed to /dev/urandom: %m");
+ r = -errno;
+ }
+ } else {
+ r = loop_write(random_fd, entropy->buf, (size_t) k, false);
+ if (r < 0)
+ log_error_errno(r, "Failed to write seed to /dev/urandom: %m");
+ }
}
} else if (streq(argv[1], "save")) {
+ /* Read available entropy count, if possible */
+ f = fopen("/proc/sys/kernel/random/entropy_avail", "re");
+ if (f) {
+ if (fscanf(f, "%d", &entropy->entropy_count) < 0)
+ entropy->entropy_count = 0;
+ fclose(f);
+ }
+
seed_fd = open(RANDOM_SEED, O_WRONLY|O_CLOEXEC|O_NOCTTY|O_CREAT, 0600);
if (seed_fd < 0) {
r = log_error_errno(errno, "Failed to open " RANDOM_SEED ": %m");
@@ -133,6 +169,21 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ if (entropy->entropy_count) {
+ entropy_fd = open(RANDOM_SEED_DIR "entropy_count", O_WRONLY|O_CLOEXEC|O_NOCTTY|O_CREAT, 0600);
+ if (seed_fd < 0) {
+ log_error("Failed to open " RANDOM_SEED_DIR "entropy_count: %m");
+ r = -errno;
+ goto finish;
+ }
+ r = write(entropy_fd, &entropy->entropy_count, sizeof(entropy->entropy_count));
+ if (r < 0) {
+ log_error("Failed to write entropy count file: %m");
+ r = -errno;
+ goto finish;
+ }
+ }
+
} else {
log_error("Unknown verb '%s'.", argv[1]);
r = -EINVAL;
@@ -147,7 +198,7 @@ int main(int argc, char *argv[]) {
(void) fchmod(seed_fd, 0600);
(void) fchown(seed_fd, 0, 0);
- k = loop_read(random_fd, buf, buf_size, false);
+ k = loop_read(random_fd, entropy->buf, (size_t) entropy->buf_size, false);
if (k < 0) {
r = log_error_errno(k, "Failed to read new seed from /dev/urandom: %m");
goto finish;
@@ -158,7 +209,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
- r = loop_write(seed_fd, buf, (size_t) k, false);
+ r = loop_write(seed_fd, entropy->buf, (size_t) k, false);
if (r < 0)
log_error_errno(r, "Failed to write new random seed file: %m");
}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dd124ff561a07e6439ed2b3713f38ca914df7747f110ce86deea17b56d245ae6
size 4034401

View File

@ -1,40 +0,0 @@
Related to bnc#886599 and others. That is use the vhangup(8) tool
to explicit do a virtually hangup on the specified on the terminal
line to give e.g. the bash a few seconds to e.g. safe its history.
[crrodriguez@opensuse.org: Feb 2015
This a known kernel bug, no notification from the cgroup subsystem
arrives and the processes in the "scope" units have
to be SIGKILL'ed without delay in order not to hang shutdown
Status: fix not available as of Feb 16 2015
track progress: https://bugzilla.redhat.com/show_bug.cgi?id=1141137
]
---
units/getty@.service.m4 | 1 +
units/serial-getty@.service.m4 | 1 +
2 files changed, 2 insertions(+)
Index: systemd-221/units/getty@.service.m4
===================================================================
--- systemd-221.orig/units/getty@.service.m4
+++ systemd-221/units/getty@.service.m4
@@ -29,6 +29,7 @@ ConditionPathExists=/dev/tty0
[Service]
# the VT is cleared by TTYVTDisallocate
ExecStart=-/sbin/agetty --noclear %I $TERM
+ExecStopPost=-/sbin/vhangup /dev/%I
Type=idle
Restart=always
RestartSec=0
Index: systemd-221/units/serial-getty@.service.m4
===================================================================
--- systemd-221.orig/units/serial-getty@.service.m4
+++ systemd-221/units/serial-getty@.service.m4
@@ -24,6 +24,7 @@ IgnoreOnIsolate=yes
[Service]
ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
+ExecStopPost=-/sbin/vhangup /dev/%I
Type=idle
Restart=always
UtmpIdentifier=%I

View File

@ -1,153 +0,0 @@
---
src/core/manager.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/core/manager.h | 5 ++
2 files changed, 98 insertions(+)
Index: systemd-227/src/core/manager.c
===================================================================
--- systemd-227.orig/src/core/manager.c
+++ systemd-227/src/core/manager.c
@@ -32,6 +32,7 @@
#include <sys/timerfd.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <resolv.h>
#ifdef HAVE_AUDIT
#include <libaudit.h>
@@ -294,6 +295,91 @@ static int manager_check_ask_password(Ma
return m->have_ask_password;
}
+static int manager_setup_resolv_conf_change(Manager *);
+
+static int manager_dispatch_resolv_conf_fd(sd_event_source *source,
+ int fd, uint32_t revents, void *userdata) {
+ Manager *m = userdata;
+
+ assert(m);
+ assert(m->resolv_conf_inotify_fd == fd);
+
+ if (revents != EPOLLIN) {
+ log_warning("Got unexpected poll event for notify fd.");
+ return 0;
+ }
+
+ if (fd >= 0)
+ flush_fd(fd);
+
+ m->resolv_conf_event_source = sd_event_source_unref(m->resolv_conf_event_source);
+ m->resolv_conf_inotify_fd = safe_close(m->resolv_conf_inotify_fd);
+ manager_setup_resolv_conf_change(m);
+ return m->resolv_conf_noent ? 0 : res_init();
+}
+
+static int manager_setup_resolv_conf_change(Manager *m) {
+ int r;
+
+ assert(m);
+ assert(m->resolv_conf_inotify_fd < 0);
+
+ m->resolv_conf_inotify_fd = inotify_init1(IN_NONBLOCK|IN_CLOEXEC);
+ if (m->resolv_conf_inotify_fd < 0) {
+ log_error("inotify_init1() failed: %m");
+ r = -errno;
+ goto fail;
+ }
+ if (inotify_add_watch(m->resolv_conf_inotify_fd, "/etc/resolv.conf",
+ IN_CLOSE_WRITE|IN_MODIFY|IN_ATTRIB|IN_DELETE_SELF) < 0) {
+ if (errno == ENOENT) {
+ m->resolv_conf_noent = true;
+ if (inotify_add_watch(m->resolv_conf_inotify_fd, "/etc", IN_CREATE|IN_MOVED_TO) < 0) {
+ log_error("Failed to add watch on /etc: %m");
+ r = -errno;
+ goto fail;
+ }
+ } else {
+ log_error("Failed to add watch on /etc/resolv.conf: %m");
+ r = -errno;
+ goto fail;
+ }
+ }
+ if (inotify_add_watch(m->resolv_conf_inotify_fd, "/etc/host.conf",
+ IN_CLOSE_WRITE|IN_MODIFY|IN_ATTRIB|IN_DELETE_SELF) < 0 && errno != ENOENT) {
+ log_error("Failed to add watch on /etc/host.conf: %m");
+ r = -errno;
+ goto fail;
+ }
+
+ r = sd_event_add_io(m->event, &m->resolv_conf_event_source,
+ m->resolv_conf_inotify_fd, EPOLLIN,
+ manager_dispatch_resolv_conf_fd, m);
+ if (r < 0) {
+ log_error("Failed to add event source for resolver: %s", strerror(-r));
+ goto fail;
+ }
+
+ r = sd_event_source_set_priority(m->resolv_conf_event_source, -10);
+ if (r < 0) {
+ log_error("Failed to add event source for resolver: %s", strerror(-r));
+ m->resolv_conf_event_source = sd_event_source_unref(m->resolv_conf_event_source);
+ goto fail;
+ }
+
+ return 0;
+fail:
+ m->resolv_conf_inotify_fd = safe_close(m->resolv_conf_inotify_fd);
+ return 0; /* Ignore error here */
+}
+
+static void manager_shutdown_resolv_conf_change(Manager *m) {
+ assert(m);
+
+ m->resolv_conf_event_source = sd_event_source_unref(m->resolv_conf_event_source);
+ m->resolv_conf_inotify_fd = safe_close(m->resolv_conf_inotify_fd);
+}
+
static int manager_watch_idle_pipe(Manager *m) {
int r;
@@ -576,6 +662,7 @@ int manager_new(ManagerRunningAs running
m->current_job_id = 1; /* start as id #1, so that we can leave #0 around as "null-like" value */
+ m->resolv_conf_inotify_fd = -1;
m->ask_password_inotify_fd = -1;
m->have_ask_password = -EINVAL; /* we don't know */
m->first_boot = -1;
@@ -637,6 +724,10 @@ int manager_new(ManagerRunningAs running
if (r < 0)
goto fail;
+ r = manager_setup_resolv_conf_change(m);
+ if (r < 0)
+ goto fail;
+
m->udev = udev_new();
if (!m->udev) {
r = -ENOMEM;
@@ -914,6 +1005,8 @@ Manager* manager_free(Manager *m) {
if (!m)
return NULL;
+ manager_shutdown_resolv_conf_change(m);
+
manager_clear_jobs_and_units(m);
for (c = 0; c < _UNIT_TYPE_MAX; c++)
Index: systemd-227/src/core/manager.h
===================================================================
--- systemd-227.orig/src/core/manager.h
+++ systemd-227/src/core/manager.h
@@ -180,6 +180,11 @@ struct Manager {
struct libmnt_monitor *mount_monitor;
sd_event_source *mount_event_source;
+ /* Watch out any change of /etc/resolv.conf */
+ int resolv_conf_inotify_fd;
+ sd_event_source *resolv_conf_event_source;
+ bool resolv_conf_noent;
+
/* Data specific to the swap filesystem */
FILE *proc_swaps;
sd_event_source *swap_event_source;