SHA256
1
0
forked from pool/systemd

Accepting request 178890 from Base:System

- Cleanup NumLock setting code
  (handle-numlock-value-in-etc-sysconfig-keyboard.patch). (forwarded request 178889 from sbrabec)

OBS-URL: https://build.opensuse.org/request/show/178890
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=143
This commit is contained in:
Stephan Kulow 2013-06-14 14:48:02 +00:00 committed by Git OBS Bridge
parent f2b41b0857
commit 5392bf0c44
15 changed files with 485 additions and 220 deletions

View File

@ -0,0 +1,87 @@
From 7f20c71497ec7c78c6d2572a0d7075f78b14548a Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Tue, 28 May 2013 20:45:34 +0200
Subject: [PATCH 4/8] journald: DO recalculate the ACL mask, but only if it
doesn't exist
Since 11ec7ce, journald isn't setting the ACLs properly anymore if
the files had no ACLs to begin with: acl_set_fd fails with EINVAL.
An ACL with ACL_USER or ACL_GROUP entries but no ACL_MASK entry is
invalid, so make sure a mask exists before trying to set the ACL.
---
src/journal/journald-server.c | 6 ++++--
src/shared/acl-util.c | 28 ++++++++++++++++++++++++++++
src/shared/acl-util.h | 1 +
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index cc52b8a..01f23ce 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -227,9 +227,11 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
}
}
- /* We do not recalculate the mask here, so that the fchmod() mask above stays intact. */
+ /* We do not recalculate the mask unconditionally here,
+ * so that the fchmod() mask above stays intact. */
if (acl_get_permset(entry, &permset) < 0 ||
- acl_add_perm(permset, ACL_READ) < 0) {
+ acl_add_perm(permset, ACL_READ) < 0 ||
+ calc_acl_mask_if_needed(&acl) < 0) {
log_warning("Failed to patch ACL on %s, ignoring: %m", f->path);
goto finish;
}
diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c
index 48bb12f..fb04e49 100644
--- a/src/shared/acl-util.c
+++ b/src/shared/acl-util.c
@@ -69,6 +69,34 @@ int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry) {
return 0;
}
+int calc_acl_mask_if_needed(acl_t *acl_p) {
+ acl_entry_t i;
+ int found;
+
+ assert(acl_p);
+
+ for (found = acl_get_entry(*acl_p, ACL_FIRST_ENTRY, &i);
+ found > 0;
+ found = acl_get_entry(*acl_p, ACL_NEXT_ENTRY, &i)) {
+
+ acl_tag_t tag;
+
+ if (acl_get_tag_type(i, &tag) < 0)
+ return -errno;
+
+ if (tag == ACL_MASK)
+ return 0;
+ }
+
+ if (found < 0)
+ return -errno;
+
+ if (acl_calc_mask(acl_p) < 0)
+ return -errno;
+
+ return 0;
+}
+
int search_acl_groups(char*** dst, const char* path, bool* belong) {
acl_t acl;
diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h
index 23090d9..36ef490 100644
--- a/src/shared/acl-util.h
+++ b/src/shared/acl-util.h
@@ -24,4 +24,5 @@
#include <stdbool.h>
int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry);
+int calc_acl_mask_if_needed(acl_t *acl_p);
int search_acl_groups(char*** dst, const char* path, bool* belong);
--
1.8.1.4

View File

@ -0,0 +1,36 @@
From 3b1680e04cb0ff0e4cf180dbacd067f1f99316a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 3 Jun 2013 13:55:13 -0400
Subject: [PATCH 6/8] systemctl,core: allow nuking of symlinks to removed units
Before, one the unit file was deleted, install_context_for_removal()
would refuse to look for symlinks. But we can remove dangling symlinks
anyway.
In principle, package installation/deinstallation scripts should do
that before the unit is uninstalled, but they don't always do. Also,
a user might have added additional symlinks manually.
https://bugs.freedesktop.org/show_bug.cgi?id=62395
---
src/shared/install.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/shared/install.c b/src/shared/install.c
index edf4d2a..a695e12 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1413,7 +1413,9 @@ static int install_context_mark_for_removal(
assert_se(hashmap_move_one(c->have_installed, c->will_install, i->name) == 0);
q = unit_file_search(c, i, paths, root_dir, false);
- if (q < 0) {
+ if (q == -ENOENT) {
+ /* do nothing */
+ } else if (q < 0) {
if (r >= 0)
r = q;
--
1.8.1.4

View File

@ -0,0 +1,29 @@
From 3608595751f62bbc6d37eb78b746ab6fecfa2d45 Mon Sep 17 00:00:00 2001
From: Ross Lagerwall <rosslagerwall@gmail.com>
Date: Sun, 9 Jun 2013 17:28:44 +0100
Subject: [PATCH 8/8] service: don't report alien child as alive when it's not
When a sigchld is received from an alien child, main_pid is set to
0 then service_enter_running calls main_pid_good to check if the
child is running. This incorrectly returned true because
kill(main_pid, 0) would return >= 0.
This fixes an error where a service would die and the cgroup would
become empty but the service would still report as active (running).
---
src/core/service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: systemd-204/src/core/service.c
===================================================================
--- systemd-204.orig/src/core/service.c
+++ systemd-204/src/core/service.c
@@ -1933,7 +1933,7 @@ static int main_pid_good(Service *s) {
/* If it's an alien child let's check if it is still
* alive ... */
- if (s->main_pid_alien)
+ if (s->main_pid_alien && s->main_pid > 0)
return kill(s->main_pid, 0) >= 0 || errno != ESRCH;
/* .. otherwise assume we'll get a SIGCHLD for it,

View File

@ -8,11 +8,11 @@ udev: ensure that the network interfaces are renamed even if they exist
src/udev/udev-event.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 3db2cb7..3ee9039 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -750,6 +750,7 @@ static int rename_netif(struct udev_event *event)
Index: systemd-204/src/udev/udev-event.c
===================================================================
--- systemd-204.orig/src/udev/udev-event.c
+++ systemd-204/src/udev/udev-event.c
@@ -750,6 +750,7 @@ static int rename_netif(struct udev_even
struct udev_device *dev = event->dev;
int sk;
struct ifreq ifr;
@ -20,7 +20,7 @@ index 3db2cb7..3ee9039 100644
int err;
log_debug("changing net interface name from '%s' to '%s'\n",
@@ -766,12 +767,51 @@ static int rename_netif(struct udev_event *event)
@@ -766,12 +767,51 @@ static int rename_netif(struct udev_even
strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev));
strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
err = ioctl(sk, SIOCSIFNAME, &ifr);

View File

@ -0,0 +1,29 @@
Index: systemd-204/Makefile.am
===================================================================
--- systemd-204.orig/Makefile.am
+++ systemd-204/Makefile.am
@@ -2238,6 +2238,10 @@ dist_udevrules_DATA += \
rules/73-seat-numlock.rules
# ------------------------------------------------------------------------------
+dist_udevrules_DATA += \
+ rules/61-msft.rules
+
+# ------------------------------------------------------------------------------
if ENABLE_GUDEV
if ENABLE_GTK_DOC
SUBDIRS += \
Index: systemd-204/rules/61-msft.rules
===================================================================
--- /dev/null
+++ systemd-204/rules/61-msft.rules
@@ -0,0 +1,9 @@
+# MSFT compability rules
+ACTION!="add|change", GOTO="msft_end"
+
+ENV{DEVTYPE}=="partition", IMPORT{parent}="SCSI_IDENT_*"
+KERNEL=="sd*[!0-9]|sr*", ENV{SCSI_IDENT_LUN_T10}!="?*", IMPORT{program}="/usr/bin/sg_inq -p di --export $tempnode", ENV{ID_BUS}="scsi"
+KERNEL=="sd*|sr*", ENV{DEVTYPE}=="disk", ENV{SCSI_IDENT_LUN_T10}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-1$env{SCSI_IDENT_LUN_T10}"
+KERNEL=="sd*", ENV{DEVTYPE}=="partition", ENV{SCSI_IDENT_LUN_T10}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-1$env{SCSI_IDENT_LUN_T10}-part%n"
+
+LABEL="msft_end"

View File

@ -10,10 +10,10 @@ Conflicts:
src/core/service.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 46 insertions(+), 5 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index c13ff35..0b39ec6 100644
--- a/src/core/service.c
+++ b/src/core/service.c
Index: systemd-204/src/core/service.c
===================================================================
--- systemd-204.orig/src/core/service.c
+++ systemd-204/src/core/service.c
@@ -51,7 +51,8 @@
typedef enum RunlevelType {
@ -55,7 +55,7 @@ index c13ff35..0b39ec6 100644
#endif
static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
@@ -332,6 +345,9 @@ static char *sysv_translate_name(const char *name) {
@@ -332,6 +345,9 @@ static char *sysv_translate_name(const c
if (endswith(name, ".sh"))
/* Drop .sh suffix */
strcpy(stpcpy(r, name) - 3, ".service");
@ -65,7 +65,7 @@ index c13ff35..0b39ec6 100644
else
/* Normal init script name */
strcpy(stpcpy(r, name), ".service");
@@ -934,6 +950,13 @@ static int service_load_sysv_path(Service *s, const char *path) {
@@ -934,6 +950,13 @@ static int service_load_sysv_path(Servic
if ((r = sysv_exec_commands(s, supports_reload)) < 0)
goto finish;
@ -79,7 +79,7 @@ index c13ff35..0b39ec6 100644
if (s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels)) {
/* If there a runlevels configured for this service
@@ -1015,6 +1038,9 @@ static int service_load_sysv_name(Service *s, const char *name) {
@@ -1015,6 +1038,9 @@ static int service_load_sysv_name(Servic
if (endswith(name, ".sh.service"))
return -ENOENT;
@ -89,7 +89,7 @@ index c13ff35..0b39ec6 100644
STRV_FOREACH(p, UNIT(s)->manager->lookup_paths.sysvinit_path) {
char *path;
int r;
@@ -1035,6 +1061,18 @@ static int service_load_sysv_name(Service *s, const char *name) {
@@ -1035,6 +1061,18 @@ static int service_load_sysv_name(Servic
}
free(path);
@ -108,7 +108,7 @@ index c13ff35..0b39ec6 100644
if (r < 0)
return r;
@@ -3661,7 +3699,7 @@ static int service_enumerate(Manager *m) {
@@ -3667,7 +3705,7 @@ static int service_enumerate(Manager *m)
if (de->d_name[0] == 'S') {
@ -117,7 +117,7 @@ index c13ff35..0b39ec6 100644
SERVICE(service)->sysv_start_priority_from_rcnd =
MAX(a*10 + b, SERVICE(service)->sysv_start_priority_from_rcnd);
@@ -3678,7 +3716,8 @@ static int service_enumerate(Manager *m) {
@@ -3684,7 +3722,8 @@ static int service_enumerate(Manager *m)
goto finish;
} else if (de->d_name[0] == 'K' &&
@ -127,7 +127,7 @@ index c13ff35..0b39ec6 100644
r = set_ensure_allocated(&shutdown_services,
trivial_hash_func, trivial_compare_func);
@@ -3718,7 +3757,9 @@ static int service_enumerate(Manager *m) {
@@ -3724,7 +3763,9 @@ static int service_enumerate(Manager *m)
* runlevels we assume the stop jobs will be implicitly added
* by the core logic. Also, we don't really distinguish here
* between the runlevels 0 and 6 and just add them to the

View File

@ -6,11 +6,11 @@ Subject: fix support for boot prefixed initscript (bnc#746506)
src/systemctl/systemctl.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index c2b1749..84ce87c 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4060,8 +4060,28 @@ static int enable_sysv_units(char **args) {
Index: systemd-204/src/systemctl/systemctl.c
===================================================================
--- systemd-204.orig/src/systemctl/systemctl.c
+++ systemd-204/src/systemctl/systemctl.c
@@ -4082,8 +4082,28 @@ static int enable_sysv_units(char **args
p[strlen(p) - sizeof(".service") + 1] = 0;
found_sysv = access(p, F_OK) >= 0;

View File

@ -7,11 +7,11 @@ Subject: handle SYSTEMCTL_OPTIONS environment variable
src/systemctl/systemctl.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 84ce87c..cceafc9 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5926,6 +5926,28 @@ int main(int argc, char*argv[]) {
Index: systemd-204/src/systemctl/systemctl.c
===================================================================
--- systemd-204.orig/src/systemctl/systemctl.c
+++ systemd-204/src/systemctl/systemctl.c
@@ -5974,6 +5974,28 @@ int main(int argc, char*argv[]) {
log_parse_environment();
log_open();

View File

@ -1,24 +1,110 @@
From: Stanislav Brabec <sbrabec@suse.cz>
Date: Fri, 20 Apr 2012 17:16:37 +0200
Subject: handle numlock value in /etc/sysconfig/keyboard
Set NumLock according to /etc/sysconfig/keyboard.
(bnc#746595)
---
Makefile.am | 13 +++++++++++
configure.ac | 5 +++++
rules/73-seat-numlock.rules | 8 +++++++
src/login/numlock-on.c | 37 ++++++++++++++++++++++++++++++++
src/vconsole/vconsole-setup.c | 38 +++++++++++++++++++++++++++++++++
units/systemd-vconsole-setup.service.in | 2 +-
6 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 rules/73-seat-numlock.rules
create mode 100644 src/login/numlock-on.c
https://bugzilla.novell.com/show_bug.cgi?id=746595
diff --git a/Makefile.am b/Makefile.am
index d594a3d..e82d092 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2205,6 +2205,19 @@ dist_udevrules_DATA += \
Authors:
Stanislav Brabec <sbrabec@suse.cz>
Cristian Rodríguez <crrodriguez@opensuse.org>
Index: systemd-204/src/vconsole/vconsole-setup.c
===================================================================
--- systemd-204.orig/src/vconsole/vconsole-setup.c
+++ systemd-204/src/vconsole/vconsole-setup.c
@@ -42,6 +42,10 @@
#include "fileio.h"
#include "strv.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];
@@ -321,12 +325,14 @@ int main(int argc, char **argv) {
char *vc_kbd_delay = NULL;
char *vc_kbd_rate = NULL;
char *vc_kbd_disable_caps_lock = NULL;
+ char *vc_kbd_numlock = NULL;
char *vc_compose_table = NULL;
pid_t kbd_rate_pid = 0, compose_table_pid = 0;
#endif
int fd = -1;
bool utf8;
bool disable_capslock = false;
+ bool numlock = false;
pid_t font_pid = 0, keymap_pid = 0;
bool font_copy = false;
int r = EXIT_FAILURE;
@@ -389,6 +395,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)
@@ -403,6 +410,36 @@ int main(int argc, char **argv) {
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;
+#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) {
+ r = EXIT_FAILURE;
+ log_error("Failed to open /dev/mem: %m");
+ goto finish;
+ }
+
+ if(lseek(fdmem, BIOS_DATA_AREA + BDA_KEYBOARD_STATUS_FLAGS_4, SEEK_SET) == (off_t) -1) {
+ r = EXIT_FAILURE;
+ log_error("Failed to seek /dev/mem: %m");
+ goto finish;
+ }
+
+ if(read (fdmem, &c, sizeof(char)) == -1) {
+ r = EXIT_FAILURE;
+ log_error("Failed to read /dev/mem: %m");
+ goto finish;
+ }
+
+ if (c & BDA_KSF4_NUMLOCK_MASK)
+ numlock = true;
+ } else
+#endif
+ numlock = vc_kbd_numlock && strcaseeq(vc_kbd_numlock, "yes");
#endif
}
@@ -425,6 +462,10 @@ int main(int argc, char **argv) {
finish:
if (keymap_pid > 0)
wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
+ if (numlock)
+ touch("/run/numlock-on");
+ else
+ unlink("/run/numlock-on");
#ifdef HAVE_SYSV_COMPAT
if (compose_table_pid > 0)
@@ -444,6 +485,7 @@ finish:
free(vc_font);
free(vc_font_map);
free(vc_font_unimap);
+ free(vc_kbd_numlock);
#ifdef HAVE_SYSV_COMPAT
free(vc_kbd_delay);
free(vc_kbd_rate);
Index: systemd-204/Makefile.am
===================================================================
--- systemd-204.orig/Makefile.am
+++ systemd-204/Makefile.am
@@ -2219,6 +2219,19 @@ dist_udevrules_DATA += \
rules/61-accelerometer.rules
# ------------------------------------------------------------------------------
@ -38,29 +124,12 @@ index d594a3d..e82d092 100644
if ENABLE_GUDEV
if ENABLE_GTK_DOC
SUBDIRS += \
diff --git a/configure.ac b/configure.ac
index e58d694..222ed22 100644
--- a/configure.ac
+++ b/configure.ac
@@ -789,6 +789,11 @@ AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
# ------------------------------------------------------------------------------
+AC_PATH_PROG([HWINFO], [hwinfo], [/usr/sbin/hwinfo], [/sbin:/usr/sbin:/usr/bin:/bin])
+AC_DEFINE_UNQUOTED([HWINFO], ["${HWINFO}"], [Path to hwinfo binary. (SUSE)])
+AC_PATH_PROG([SETLEDS], [setleds], [/bin/setleds], [/sbin:/usr/sbin:/usr/bin:/bin])
+AC_DEFINE_UNQUOTED([SETLEDS], ["${SETLEDS}"], [Path to setleds binary.])
+
# Location of the init scripts as mandated by LSB
SYSTEM_SYSVINIT_PATH=/etc/init.d
SYSTEM_SYSVRCND_PATH=/etc/rc.d
diff --git a/rules/73-seat-numlock.rules b/rules/73-seat-numlock.rules
new file mode 100644
index 0000000..e0061ed
Index: systemd-204/rules/73-seat-numlock.rules
===================================================================
--- /dev/null
+++ b/rules/73-seat-numlock.rules
+++ systemd-204/rules/73-seat-numlock.rules
@@ -0,0 +1,8 @@
+# This file is part of systemd.
+# 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
@ -68,130 +137,50 @@ index 0000000..e0061ed
+# (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}"
diff --git a/src/login/numlock-on.c b/src/login/numlock-on.c
new file mode 100644
index 0000000..77a8368
Index: systemd-204/src/login/numlock-on.c
===================================================================
--- /dev/null
+++ b/src/login/numlock-on.c
@@ -0,0 +1,37 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+++ systemd-204/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.
+
+/***
+ This file is part of systemd.
+ * Copyright (C) 2013 Stanislav Brabec, SUSE
+ *
+ * based on setleds.c, which is
+ * Copyright (C) 1994-1999 Andries E. Brouwer
+ */
+
+ Copyright 2012 Stanislav Brabec
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+
+ 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.
+int
+main(int argc, char **argv) {
+ char flags;
+
+ 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
+ General Public License for more details.
+ if (ioctl(0, KDGKBLED, &flags)) {
+ perror("KDGKBLED");
+ exit(1);
+ }
+
+ You should have received a copy of the GNU General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+ if (ioctl(0, KDSKBLED, flags | LED_NUM | (LED_NUM << 4))) {
+ perror("KDSKBLED");
+ exit(1);
+ }
+
+#include "config.h"
+#include <fcntl.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+int main (int argc, char *argv[]) {
+ static const char *args[] = { SETLEDS, "-D", "+num", NULL };
+
+ if (argc != 2)
+ return EX_USAGE;
+ close (STDIN_FILENO);
+ if (open (argv[1], O_RDONLY) != STDIN_FILENO)
+ return EX_IOERR;
+ /* add cast to prevent warning caused by -Wwrite-strings */
+ return execv(args[0], (char * const*) args);
+ exit(0);
+}
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 384f936..e1f8868 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -321,12 +321,14 @@ int main(int argc, char **argv) {
char *vc_kbd_delay = NULL;
char *vc_kbd_rate = NULL;
char *vc_kbd_disable_caps_lock = NULL;
+ char *vc_kbd_numlock = NULL;
char *vc_compose_table = NULL;
pid_t kbd_rate_pid = 0, compose_table_pid = 0;
#endif
int fd = -1;
bool utf8;
bool disable_capslock = false;
+ bool numlock = false;
pid_t font_pid = 0, keymap_pid = 0;
bool font_copy = false;
int r = EXIT_FAILURE;
@@ -389,6 +391,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)
@@ -403,6 +406,37 @@ int main(int argc, char **argv) {
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;
+ if (vc_kbd_numlock && strcasecmp(vc_kbd_numlock, "BIOS") == 0) {
+ int hwinfo_fd[2];
+ pid_t hwinfo_pid;
+
+ pipe(hwinfo_fd);
+ if ((hwinfo_pid = fork()) < 0) {
+ log_error("Failed to fork: %m");
+ _exit(EXIT_FAILURE);
+ } else if (hwinfo_pid == 0) {
+ const char *args[3];
+ int i = 0;
+ args[i++] = HWINFO;
+ args[i++] = "--bios";
+ args[i++] = NULL;
+ close(hwinfo_fd[0]);
+ fclose(stdout);
+ dup2(hwinfo_fd[1], STDOUT_FILENO);
+ execv(args[0], (char **) args);
+ _exit(EXIT_FAILURE);
+ } else {
+ char line[17];
+ FILE *hwinfo_file = fdopen(hwinfo_fd[0], "r");
+ close(hwinfo_fd[1]);
+ while (fgets(line, 17, hwinfo_file))
+ if (strstr(line, "Num Lock: on"))
+ numlock = true;
+ close(hwinfo_fd[0]);
+ fclose(hwinfo_file);
+ }
+ } else
+ numlock = vc_kbd_numlock && strcasecmp(vc_kbd_numlock, "YES") == 0;
#endif
}
@@ -425,6 +459,10 @@ int main(int argc, char **argv) {
finish:
if (keymap_pid > 0)
wait_for_terminate_and_warn(KBD_LOADKEYS, keymap_pid);
+ if (numlock)
+ close(open("/run/numlock-on", O_WRONLY|O_CREAT, 0644));
+ else
+ unlink("/run/numlock-on");
#ifdef HAVE_SYSV_COMPAT
if (compose_table_pid > 0)
diff --git a/units/systemd-vconsole-setup.service.in b/units/systemd-vconsole-setup.service.in
index 18faa63..44ebbd0 100644
--- a/units/systemd-vconsole-setup.service.in
+++ b/units/systemd-vconsole-setup.service.in
@@ -11,7 +11,7 @@ Documentation=man:systemd-vconsole-setup.service(8) man:vconsole.conf(5)
Index: systemd-204/units/systemd-vconsole-setup.service.in
===================================================================
--- systemd-204.orig/units/systemd-vconsole-setup.service.in
+++ systemd-204/units/systemd-vconsole-setup.service.in
@@ -11,7 +11,7 @@ Documentation=man:systemd-vconsole-setup
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service

View File

@ -12,11 +12,11 @@ Fixes https://bugzilla.novell.com/show_bug.cgi?id=721426
src/core/service.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/core/service.c b/src/core/service.c
index 08fc97c..5118b06 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2072,8 +2072,13 @@ static void service_enter_running(Service *s, ServiceResult f) {
Index: systemd-204/src/core/service.c
===================================================================
--- systemd-204.orig/src/core/service.c
+++ systemd-204/src/core/service.c
@@ -2075,8 +2075,13 @@ static void service_enter_running(Servic
cgroup_ok = cgroup_good(s);
if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) &&

View File

@ -10,10 +10,10 @@ configuration), needed by openSUSE (bnc#809420).
units/systemd-sysctl.service.in | 1 +
2 files changed, 9 insertions(+)
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index db18dd9..aa10b79 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
Index: systemd-204/src/sysctl/sysctl.c
===================================================================
--- systemd-204.orig/src/sysctl/sysctl.c
+++ systemd-204/src/sysctl/sysctl.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <limits.h>
@ -36,11 +36,11 @@ index db18dd9..aa10b79 100644
r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs);
if (r < 0) {
diff --git a/units/systemd-sysctl.service.in b/units/systemd-sysctl.service.in
index 45e1ceb..61d13c9 100644
--- a/units/systemd-sysctl.service.in
+++ b/units/systemd-sysctl.service.in
@@ -19,6 +19,7 @@ ConditionDirectoryNotEmpty=|/usr/lib/sysctl.d
Index: systemd-204/units/systemd-sysctl.service.in
===================================================================
--- systemd-204.orig/units/systemd-sysctl.service.in
+++ systemd-204/units/systemd-sysctl.service.in
@@ -20,6 +20,7 @@ ConditionDirectoryNotEmpty=|/usr/lib/sys
ConditionDirectoryNotEmpty=|/usr/local/lib/sysctl.d
ConditionDirectoryNotEmpty=|/etc/sysctl.d
ConditionDirectoryNotEmpty=|/run/sysctl.d
@ -48,6 +48,3 @@ index 45e1ceb..61d13c9 100644
[Service]
Type=oneshot
--
1.8.1.4

View File

@ -1,3 +1,37 @@
-------------------------------------------------------------------
Thu Jun 13 16:00:25 CEST 2013 - sbrabec@suse.cz
- Cleanup NumLock setting code
(handle-numlock-value-in-etc-sysconfig-keyboard.patch).
-------------------------------------------------------------------
Wed Jun 12 10:00:53 UTC 2013 - fcrozat@suse.com
- Only apply 1007-add-msft-compability-rules.patch when not
building systemd-mini.
-------------------------------------------------------------------
Tue Jun 11 11:01:46 UTC 2013 - rmilasan@suse.com
- Add udev MSFT compability rules (bnc#805059).
add: 1007-add-msft-compability-rules.patch
- Add sg3_utils requires, need it by 61-msft.rules (bnc#805059).
- Clean-up spec file, put udev patches after systemd patches.
- Rebase patches so they would apply nicely.
-------------------------------------------------------------------
Tue Jun 11 02:29:49 UTC 2013 - crrodriguez@opensuse.org
- 0004-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch
fixes :
* systemd-journald[347]: Failed to set ACL on
/var/log/journal/11d90b1c0239b5b2e38ed54f513722e3/user-1000.journal,
ignoring: Invalid argument
- 006-systemctl-core-allow-nuking-of-symlinks-to-removed-u.patch
systemctl disable should remove dangling symlinks.
- 0008-service-don-t-report-alien-child-as-alive-when-it-s-.patch
alien childs are reported as alive when they are really dead.
-------------------------------------------------------------------
Wed May 29 10:44:11 CEST 2013 - fcrozat@suse.com

View File

@ -170,6 +170,12 @@ Patch38: rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch
Patch42: systemctl-does-not-expand-u-so-revert-back-to-I.patch
# PATCH-FIX-UPSTREAM Start-ctrl-alt-del.target-irreversibly.patch fcrozat@suse.com -- ctrl-alt-del should be irreversible for reliability.
Patch43: Start-ctrl-alt-del.target-irreversibly.patch
# PATCH-FIX-UPSTREAM 0004-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch crrodriguez@opensuse.org fix systemd-journald[347]: Failed to set ACL on ...user-1000.journal..Invalid argument
Patch44: 0004-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch
# PATCH-FIX-UPSTREAM 0006-systemctl-core-allow-nuking-of-symlinks-to-removed-u.patch crrodriguez@opensuse.org ensure systemctl disable removes dangling symlinks
Patch45: 0006-systemctl-core-allow-nuking-of-symlinks-to-removed-u.patch
# PATCH-FIX-UPSTREAM 0008-service-don-t-report-alien-child-as-alive-when-it-s-.patch crrodriguez@opensuse.org do not report alien child as alive when it is dead.
Patch46: 0008-service-don-t-report-alien-child-as-alive-when-it-s-.patch
# udev patches
# PATCH-FIX-OPENSUSE 1001-re-enable-by_path-links-for-ata-devices.patch
@ -184,6 +190,8 @@ Patch1004: 1004-fix-devname-prefix.patch
Patch1005: 1005-create-default-links-for-primary-cd_dvd-drive.patch
# PATCH-FIX-OPENSUSE 1006-udev-always-rename-network.patch
Patch1006: 1006-udev-always-rename-network.patch
# PATCH-FIX-OPENSUSE 1007-add-msft-compability-rules.patch
Patch1007: 1007-add-msft-compability-rules.patch
%description
Systemd is a system and service manager, compatible with SysV and LSB
@ -226,7 +234,7 @@ Summary: A rule-based device node and kernel event manager
License: GPL-2.0
Group: System/Kernel
Url: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
PreReq: /bin/pidof /bin/rm /usr/bin/stat %insserv_prereq %fillup_prereq /usr/sbin/groupadd /usr/bin/getent /sbin/mkinitrd
PreReq: /bin/pidof /bin/rm /usr/bin/stat %insserv_prereq %fillup_prereq /usr/sbin/groupadd /usr/bin/getent /sbin/mkinitrd /usr/bin/sg_inq
Requires(post): lib%{udevpkgname}%{udev_major}
Conflicts: systemd < 39
Conflicts: aaa_base < 11.5
@ -360,15 +368,7 @@ This package marks the installation to not use syslog but only the journal.
cp %{SOURCE7} m4/
%endif
#udev
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
#systemd
# systemd patches
%patch0 -p1
%patch1 -p1
%patch3 -p1
@ -406,6 +406,21 @@ cp %{SOURCE7} m4/
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
# udev patches
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
# don't apply when bootstrapping to not modify Makefile.am
%if ! 0%{?bootstrap}
%patch1007 -p1
%endif
%build
autoreconf -fiv

View File

@ -1,3 +1,37 @@
-------------------------------------------------------------------
Thu Jun 13 16:00:25 CEST 2013 - sbrabec@suse.cz
- Cleanup NumLock setting code
(handle-numlock-value-in-etc-sysconfig-keyboard.patch).
-------------------------------------------------------------------
Wed Jun 12 10:00:53 UTC 2013 - fcrozat@suse.com
- Only apply 1007-add-msft-compability-rules.patch when not
building systemd-mini.
-------------------------------------------------------------------
Tue Jun 11 11:01:46 UTC 2013 - rmilasan@suse.com
- Add udev MSFT compability rules (bnc#805059).
add: 1007-add-msft-compability-rules.patch
- Add sg3_utils requires, need it by 61-msft.rules (bnc#805059).
- Clean-up spec file, put udev patches after systemd patches.
- Rebase patches so they would apply nicely.
-------------------------------------------------------------------
Tue Jun 11 02:29:49 UTC 2013 - crrodriguez@opensuse.org
- 0004-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch
fixes :
* systemd-journald[347]: Failed to set ACL on
/var/log/journal/11d90b1c0239b5b2e38ed54f513722e3/user-1000.journal,
ignoring: Invalid argument
- 006-systemctl-core-allow-nuking-of-symlinks-to-removed-u.patch
systemctl disable should remove dangling symlinks.
- 0008-service-don-t-report-alien-child-as-alive-when-it-s-.patch
alien childs are reported as alive when they are really dead.
-------------------------------------------------------------------
Wed May 29 10:44:11 CEST 2013 - fcrozat@suse.com

View File

@ -165,6 +165,12 @@ Patch38: rules-add-lid-switch-of-ARM-based-Chromebook-as-a-power-sw.patch
Patch42: systemctl-does-not-expand-u-so-revert-back-to-I.patch
# PATCH-FIX-UPSTREAM Start-ctrl-alt-del.target-irreversibly.patch fcrozat@suse.com -- ctrl-alt-del should be irreversible for reliability.
Patch43: Start-ctrl-alt-del.target-irreversibly.patch
# PATCH-FIX-UPSTREAM 0004-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch crrodriguez@opensuse.org fix systemd-journald[347]: Failed to set ACL on ...user-1000.journal..Invalid argument
Patch44: 0004-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch
# PATCH-FIX-UPSTREAM 0006-systemctl-core-allow-nuking-of-symlinks-to-removed-u.patch crrodriguez@opensuse.org ensure systemctl disable removes dangling symlinks
Patch45: 0006-systemctl-core-allow-nuking-of-symlinks-to-removed-u.patch
# PATCH-FIX-UPSTREAM 0008-service-don-t-report-alien-child-as-alive-when-it-s-.patch crrodriguez@opensuse.org do not report alien child as alive when it is dead.
Patch46: 0008-service-don-t-report-alien-child-as-alive-when-it-s-.patch
# udev patches
# PATCH-FIX-OPENSUSE 1001-re-enable-by_path-links-for-ata-devices.patch
@ -179,6 +185,8 @@ Patch1004: 1004-fix-devname-prefix.patch
Patch1005: 1005-create-default-links-for-primary-cd_dvd-drive.patch
# PATCH-FIX-OPENSUSE 1006-udev-always-rename-network.patch
Patch1006: 1006-udev-always-rename-network.patch
# PATCH-FIX-OPENSUSE 1007-add-msft-compability-rules.patch
Patch1007: 1007-add-msft-compability-rules.patch
%description
Systemd is a system and service manager, compatible with SysV and LSB
@ -221,7 +229,7 @@ Summary: A rule-based device node and kernel event manager
License: GPL-2.0
Group: System/Kernel
Url: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
PreReq: /bin/pidof /bin/rm /usr/bin/stat %insserv_prereq %fillup_prereq /usr/sbin/groupadd /usr/bin/getent /sbin/mkinitrd
PreReq: /bin/pidof /bin/rm /usr/bin/stat %insserv_prereq %fillup_prereq /usr/sbin/groupadd /usr/bin/getent /sbin/mkinitrd /usr/bin/sg_inq
Requires(post): lib%{udevpkgname}%{udev_major}
Conflicts: systemd < 39
Conflicts: aaa_base < 11.5
@ -355,15 +363,7 @@ This package marks the installation to not use syslog but only the journal.
cp %{SOURCE7} m4/
%endif
#udev
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
#systemd
# systemd patches
%patch0 -p1
%patch1 -p1
%patch3 -p1
@ -401,6 +401,21 @@ cp %{SOURCE7} m4/
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
# udev patches
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
# don't apply when bootstrapping to not modify Makefile.am
%if ! 0%{?bootstrap}
%patch1007 -p1
%endif
%build
autoreconf -fiv