|
|
787d6d |
From 74632586b46c7e88b09c57eec50f9c4aed254b98 Mon Sep 17 00:00:00 2001
|
|
|
787d6d |
From: David Tardon <dtardon@redhat.com>
|
|
|
787d6d |
Date: Mon, 30 Jan 2023 14:31:23 +0100
|
|
|
787d6d |
Subject: [PATCH] systemctl: preserve old behavior unless requested
|
|
|
787d6d |
|
|
|
787d6d |
Currently, the legacy shutdown commands ignore inhibitors and reboot
|
|
|
787d6d |
immediately if run by root. Let's preserve that behavior in RHEL-8 by
|
|
|
787d6d |
default. The new behavior can be turned on by those who want it by
|
|
|
787d6d |
exporting SYSTEMD_NEW_SHUTDOWN=1 .
|
|
|
787d6d |
|
|
|
787d6d |
RHEL-only
|
|
|
787d6d |
|
|
|
787d6d |
Related: #2053273
|
|
|
787d6d |
---
|
|
|
787d6d |
src/systemctl/systemctl.c | 9 ++++++++-
|
|
|
787d6d |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
787d6d |
|
|
|
787d6d |
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
|
|
787d6d |
index a26e4a913a..1546119ce5 100644
|
|
|
787d6d |
--- a/src/systemctl/systemctl.c
|
|
|
787d6d |
+++ b/src/systemctl/systemctl.c
|
|
|
787d6d |
@@ -8714,7 +8714,7 @@ static int halt_main_old(void) {
|
|
|
787d6d |
return log_error_errno(r, "Failed to reboot: %m");
|
|
|
787d6d |
}
|
|
|
787d6d |
|
|
|
787d6d |
-static int halt_main(void) {
|
|
|
787d6d |
+static int halt_main_new(void) {
|
|
|
787d6d |
int r;
|
|
|
787d6d |
|
|
|
787d6d |
/* always try logind first */
|
|
|
787d6d |
@@ -8765,6 +8765,13 @@ static int halt_main(void) {
|
|
|
787d6d |
return log_error_errno(r, "Failed to reboot: %m");
|
|
|
787d6d |
}
|
|
|
787d6d |
|
|
|
787d6d |
+static int halt_main(void) {
|
|
|
787d6d |
+ if (getenv_bool("SYSTEMD_NEW_SHUTDOWN") > 0)
|
|
|
787d6d |
+ return halt_main_new();
|
|
|
787d6d |
+ else
|
|
|
787d6d |
+ return halt_main_old();
|
|
|
787d6d |
+}
|
|
|
787d6d |
+
|
|
|
787d6d |
static int runlevel_main(void) {
|
|
|
787d6d |
int r, runlevel, previous;
|
|
|
787d6d |
|