systemd/0001-Add-bootsplash-handling-for-password-dialogs.patch

62 lines
2.0 KiB
Diff

From 81eca00461968aac09f9e8535f4327282698b495 Mon Sep 17 00:00:00 2001
From: Stefan Seyfried <seife+obs@b1-systems.com>
Date: Thu, 16 Dec 2010 11:30:17 +0100
Subject: [PATCH] Add bootsplash handling for password dialogs
openSUSE uses bootsplash.org, so add a crude handling for setting the
splash screen to verbose when a password is asked...
---
src/ask-password-api.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/ask-password-api.c b/src/ask-password-api.c
index 9f7023e..2023441 100644
--- a/src/ask-password-api.c
+++ b/src/ask-password-api.c
@@ -47,6 +47,9 @@ int ask_password_tty(
int r, ttyfd = -1, notify = -1;
struct pollfd pollfd[2];
bool reset_tty = false;
+ bool splash_silent = false;
+ FILE *procsplash = NULL;
+ char *line = NULL;
enum {
POLL_TTY,
POLL_INOTIFY
@@ -90,6 +93,19 @@ int ask_password_tty(
}
reset_tty = true;
+ procsplash = fopen("/proc/splash", "r+");
+ if (procsplash) {
+ getline(&line, &p, procsplash);
+ p = 0; /* reset, just to make sure */
+ if (line &&
+ (strstr(line, "on\n") == line + strlen(line) - 3) &&
+ (strstr(line, "silent") != NULL)) {
+ splash_silent = true;
+ rewind(procsplash);
+ fprintf(procsplash, "verbose\n");
+ fflush(procsplash);
+ }
+ }
}
zero(pollfd);
@@ -201,6 +217,12 @@ finish:
close_nointr_nofail(ttyfd);
}
+ if (splash_silent) { /* only set if procsplash != NULL */
+ rewind(procsplash);
+ fprintf(procsplash, "silent\n");
+ fclose(procsplash);
+ }
+
return r;
}
--
1.7.3.1