Accepting request 114876 from Base:System

- Implemented SUSE specific sysconfig numlock logic (bnc#746595). (forwarded request 114873 from sbrabec)

OBS-URL: https://build.opensuse.org/request/show/114876
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=97
This commit is contained in:
Stephan Kulow 2012-04-23 14:13:33 +00:00 committed by Git OBS Bridge
commit 2af1e8453a
3 changed files with 151 additions and 0 deletions

144
systemd-numlock-suse.patch Normal file
View File

@ -0,0 +1,144 @@
Index: systemd-44/src/vconsole/vconsole-setup.c
===================================================================
--- systemd-44.orig/src/vconsole/vconsole-setup.c
+++ systemd-44/src/vconsole/vconsole-setup.c
@@ -265,12 +265,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;
int r = EXIT_FAILURE;
pid_t font_pid = 0, keymap_pid = 0;
@@ -374,6 +376,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)) < 0) {
@@ -391,6 +394,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;
#elif defined(TARGET_ARCH)
if ((r = parse_env_file("/etc/rc.conf", NEWLINE,
@@ -558,6 +592,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 TARGET_SUSE
if (compose_table_pid > 0)
Index: systemd-44/Makefile.am
===================================================================
--- systemd-44.orig/Makefile.am
+++ systemd-44/Makefile.am
@@ -2043,7 +2043,8 @@ dist_udevrules_DATA += \
src/login/71-seat.rules
nodist_udevrules_DATA += \
- src/login/73-seat-late.rules
+ src/login/73-seat-late.rules \
+ src/login/73-seat-numlock.rules
MANPAGES += \
man/systemd-logind.conf.5 \
@@ -2106,12 +2107,14 @@ EXTRA_DIST += \
src/login/logind-user.h \
src/login/logind-acl.h \
src/login/73-seat-late.rules.in \
+ src/login/73-seat-numlock.rules.in \
units/systemd-logind.service.in \
units/systemd-user-sessions.service.in
CLEANFILES += \
src/login/logind-gperf.c \
- src/login/73-seat-late.rules
+ src/login/73-seat-late.rules \
+ src/login/73-seat-numlock.rules
endif
# ------------------------------------------------------------------------------
@@ -2121,6 +2124,7 @@ SED_PROCESS = \
-e 's,@rootbindir\@,$(rootbindir),g' \
-e 's,@bindir\@,$(bindir),g' \
-e 's,@SYSTEMCTL\@,$(rootbindir)/systemctl,g' \
+ -e 's,@SETLEDS\@,$(SETLEDS),g' \
-e 's,@SYSTEMD_NOTIFY\@,$(rootbindir)/systemd-notify,g' \
-e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
-e 's,@pkgdatadir\@,$(pkgdatadir),g' \
Index: systemd-44/configure.ac
===================================================================
--- systemd-44.orig/configure.ac
+++ systemd-44/configure.ac
@@ -410,6 +410,12 @@ fi
with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
+if test z"$with_distro" = z"suse" ; then
+ AC_PATH_PROG([HWINFO], [hwinfo], [/usr/sbin/hwinfo], [/sbin:/usr/sbin:/usr/bin:/bin])
+ AC_DEFINE_UNQUOTED([HWINFO], ["${HWINFO}"], [Path to hwinfo binary. (SUSE)])
+fi
+AC_PATH_PROG([SETLEDS], [setleds], [/bin/setleds], [/sbin:/usr/sbin:/usr/bin:/bin])
+
# Location of the init scripts as mandated by LSB
SYSTEM_SYSVINIT_PATH=/etc/init.d
SYSTEM_SYSVRCND_PATH=/etc/rc.d
Index: systemd-44/src/login/73-seat-numlock.rules.in
===================================================================
--- /dev/null
+++ systemd-44/src/login/73-seat-numlock.rules.in
@@ -0,0 +1,8 @@
+# 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.
+
+SUBSYSTEM=="tty", ACTION=="add", KERNEL=="tty[0-9]|tty1[0-2]", TAG=="systemd", TEST=="/run/numlock-on", RUN+="@SETLEDS@ -D +num <$env{DEVNAME}"

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Apr 20 17:16:37 CEST 2012 - sbrabec@suse.cz
- Implemented SUSE specific sysconfig numlock logic (bnc#746595).
-------------------------------------------------------------------
Thu Apr 19 10:07:47 UTC 2012 - fcrozat@suse.com

View File

@ -67,6 +67,7 @@ Source6: baselibs.conf
Patch1: 0001-Add-bootsplash-handling-for-password-dialogs.patch
# handle SUSE specific kbd settings
Patch6: 0001-handle-disable_caplock-and-compose_table-and-kbd_rat.patch
Patch7: systemd-numlock-suse.patch
# don't start getty on tty1 until all password request are done
Patch8: tty1.patch
Patch10: 0001-service-Fix-dependencies-added-when-parsing-insserv..patch
@ -135,6 +136,7 @@ Plymouth integration for systemd
%setup -q
%patch1 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch10 -p1
%patch13 -p1