forked from pool/util-linux
.
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=225
This commit is contained in:
parent
d4b4a095b8
commit
7309d0e418
@ -3,12 +3,26 @@ flags become changed from under the first agetty on a serial system
|
||||
console as the flags are locked.
|
||||
|
||||
---
|
||||
agetty.c | 39 ++++++++++++++++++++++++++++++++-------
|
||||
1 file changed, 32 insertions(+), 7 deletions(-)
|
||||
agetty.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 68 insertions(+), 7 deletions(-)
|
||||
|
||||
--- term-utils/agetty.c
|
||||
+++ term-utils/agetty.c 2014-01-10 13:05:50.411075349 +0000
|
||||
@@ -281,8 +281,9 @@ static void login_options_to_argv(char *
|
||||
+++ term-utils/agetty.c 2014-03-05 17:52:32.574235616 +0000
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <sys/wait.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
@@ -276,13 +277,15 @@ static void log_warn (const char *, ...)
|
||||
static ssize_t append(char *dest, size_t len, const char *sep, const char *src);
|
||||
static void check_username (const char* nm);
|
||||
static void login_options_to_argv(char *argv[], int *argc, char *str, char *username);
|
||||
+static int plymouth_command(const char* arg);
|
||||
|
||||
/* Fake hostname for ut_host specified on command line. */
|
||||
static char *fakehost;
|
||||
|
||||
#ifdef DEBUGGING
|
||||
@ -19,7 +33,7 @@ console as the flags are locked.
|
||||
# endif
|
||||
# define debug(s) do { fprintf(dbf,s); fflush(dbf); } while (0)
|
||||
FILE *dbf;
|
||||
@@ -320,8 +321,12 @@ int main(int argc, char **argv)
|
||||
@@ -320,8 +323,12 @@ int main(int argc, char **argv)
|
||||
|
||||
#ifdef DEBUGGING
|
||||
dbf = fopen(DEBUG_OUTPUT, "w");
|
||||
@ -33,7 +47,7 @@ console as the flags are locked.
|
||||
#endif /* DEBUGGING */
|
||||
|
||||
/* Parse command-line arguments. */
|
||||
@@ -473,7 +478,6 @@ int main(int argc, char **argv)
|
||||
@@ -473,7 +480,6 @@ int main(int argc, char **argv)
|
||||
if (options.osrelease)
|
||||
free(options.osrelease);
|
||||
#ifdef DEBUGGING
|
||||
@ -41,14 +55,14 @@ console as the flags are locked.
|
||||
if (close_stream(dbf) != 0)
|
||||
log_err("write failed: %s", DEBUG_OUTPUT);
|
||||
#endif
|
||||
@@ -1090,6 +1094,25 @@ static void termio_init(struct options *
|
||||
@@ -1104,6 +1110,27 @@ static void termio_init(struct options *
|
||||
{
|
||||
speed_t ispeed, ospeed;
|
||||
struct winsize ws;
|
||||
+ struct termios lock;
|
||||
+ int i;
|
||||
+ int i = (plymouth_command("--ping") == 0) ? 30 : 0;
|
||||
+
|
||||
+ for (i = 0; i < 20; i++) {
|
||||
+ while (i-- > 0) {
|
||||
+ /*
|
||||
+ * Even with TTYReset=no it seems with systemd or plymouth
|
||||
+ * the termios flags become changed from under the first
|
||||
@ -60,6 +74,8 @@ console as the flags are locked.
|
||||
+ if (!lock.c_iflag && !lock.c_oflag && !lock.c_cflag && !lock.c_lflag)
|
||||
+ break;
|
||||
+ debug("termios locked\n");
|
||||
+ if (i == 15 && plymouth_command("quit") != 0)
|
||||
+ break;
|
||||
+ sleep(1);
|
||||
+ }
|
||||
+ memset(&lock, 0, sizeof(struct termios));
|
||||
@ -67,7 +83,7 @@ console as the flags are locked.
|
||||
|
||||
if (op->flags & F_VCONSOLE) {
|
||||
#if defined(IUTF8) && defined(KDGKBMODE)
|
||||
@@ -1154,9 +1177,6 @@ static void termio_init(struct options *
|
||||
@@ -1168,9 +1195,6 @@ static void termio_init(struct options *
|
||||
* later on.
|
||||
*/
|
||||
|
||||
@ -77,7 +93,7 @@ console as the flags are locked.
|
||||
#ifdef IUTF8
|
||||
tp->c_iflag = tp->c_iflag & IUTF8;
|
||||
if (tp->c_iflag & IUTF8)
|
||||
@@ -1216,8 +1236,11 @@ static void termio_init(struct options *
|
||||
@@ -1230,8 +1254,11 @@ static void termio_init(struct options *
|
||||
if (op->flags & F_RTSCTS)
|
||||
tp->c_cflag |= CRTSCTS;
|
||||
#endif
|
||||
@ -90,7 +106,7 @@ console as the flags are locked.
|
||||
|
||||
/* Go to blocking input even in local mode. */
|
||||
fcntl(STDIN_FILENO, F_SETFL,
|
||||
@@ -1238,6 +1261,10 @@ static void reset_vc(const struct option
|
||||
@@ -1252,6 +1279,10 @@ static void reset_vc(const struct option
|
||||
|
||||
if (tcsetattr(STDIN_FILENO, TCSADRAIN, tp))
|
||||
log_warn(_("setting terminal attributes failed: %m"));
|
||||
@ -101,3 +117,37 @@ console as the flags are locked.
|
||||
}
|
||||
|
||||
/* Extract baud rate from modem status message. */
|
||||
@@ -2273,3 +2304,33 @@ err:
|
||||
log_err(_("checkname failed: %m"));
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * For the case plymouth is found on this system
|
||||
+ */
|
||||
+static int plymouth_command(const char* arg)
|
||||
+{
|
||||
+ const char *cmd = "/usr/bin/plymouth";
|
||||
+ static int has_plymouth = 1;
|
||||
+ pid_t pid;
|
||||
+
|
||||
+ if (!has_plymouth)
|
||||
+ return 127;
|
||||
+
|
||||
+ pid = fork();
|
||||
+ if (!pid) {
|
||||
+ int fd = open("/dev/null", O_RDWR);
|
||||
+ dup2(fd, 0);
|
||||
+ dup2(fd, 1);
|
||||
+ dup2(fd, 2);
|
||||
+ close(fd);
|
||||
+ execl(cmd, cmd, arg, (char *) NULL);
|
||||
+ exit(127);
|
||||
+ } else if (pid > 0) {
|
||||
+ int status;
|
||||
+ waitpid(pid, &status, 0);
|
||||
+ if (status == 127)
|
||||
+ has_plymouth = 0;
|
||||
+ return status;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
|
@ -1,20 +1,57 @@
|
||||
Make sure that plymouth does not break sulogin.
|
||||
|
||||
---
|
||||
sulogin.c | 18 +++++++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
sulogin.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 50 insertions(+), 1 deletion(-)
|
||||
|
||||
--- login-utils/sulogin.c
|
||||
+++ login-utils/sulogin.c 2014-02-06 09:39:57.726236116 +0000
|
||||
@@ -83,7 +83,23 @@ static void tcinit(struct console *con)
|
||||
+++ login-utils/sulogin.c 2014-03-05 17:42:40.442235465 +0000
|
||||
@@ -77,13 +77,62 @@ static volatile sig_atomic_t sigchild;
|
||||
#endif
|
||||
|
||||
/*
|
||||
+ * For the case plymouth is found on this system
|
||||
+ */
|
||||
+static int plymouth_command(const char* arg)
|
||||
+{
|
||||
+ const char *cmd = "/usr/bin/plymouth";
|
||||
+ static int has_plymouth = 1;
|
||||
+ pid_t pid;
|
||||
+
|
||||
+ if (!has_plymouth)
|
||||
+ return 127;
|
||||
+
|
||||
+ pid = fork();
|
||||
+ if (!pid) {
|
||||
+ int fd = open("/dev/null", O_RDWR);
|
||||
+ dup2(fd, 0);
|
||||
+ dup2(fd, 1);
|
||||
+ dup2(fd, 2);
|
||||
+ close(fd);
|
||||
+ execl(cmd, cmd, arg, (char *) NULL);
|
||||
+ exit(127);
|
||||
+ } else if (pid > 0) {
|
||||
+ int status;
|
||||
+ waitpid(pid, &status, 0);
|
||||
+ if (status == 127)
|
||||
+ has_plymouth = 0;
|
||||
+ return status;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* Fix the tty modes and set reasonable defaults.
|
||||
*/
|
||||
static void tcinit(struct console *con)
|
||||
{
|
||||
int mode = 0, flags = 0;
|
||||
struct termios *tio = &con->tio;
|
||||
- int fd = con->fd;
|
||||
+ struct termios lock;
|
||||
+ int i, fd = con->fd;
|
||||
+ int fd = con->fd, i = (plymouth_command("--ping")) ? 20 : 0;
|
||||
+
|
||||
+ for (i = 0; i < 5; i++) {
|
||||
+ while (i-- > 0) {
|
||||
+ /*
|
||||
+ * With plymouth the termios flags become changed after this
|
||||
+ * function had changed the termios.
|
||||
@ -24,6 +61,8 @@ Make sure that plymouth does not break sulogin.
|
||||
+ break;
|
||||
+ if (!lock.c_iflag && !lock.c_oflag && !lock.c_cflag && !lock.c_lflag)
|
||||
+ break;
|
||||
+ if (i == 15 && plymouth_command("quit") != 0)
|
||||
+ break;
|
||||
+ sleep(1);
|
||||
+ }
|
||||
+ memset(&lock, 0, sizeof(struct termios));
|
||||
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 6 09:43:34 UTC 2014 - werner@suse.de
|
||||
|
||||
- Modify the patches
|
||||
agetty-fooled-on-serial-line-due-plymouth.patch
|
||||
sulogin-fooled-on-tty-line-due-plymouth.patch
|
||||
to be able to disable plymouth if not already terminated due to
|
||||
a hanging network service (bnc#866860)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Feb 9 21:20:31 UTC 2014 - andreas.stieger@gmx.de
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user