2014-01-31 13:36:06 +01:00
|
|
|
---
|
2015-03-27 09:39:40 +01:00
|
|
|
src/core/shutdown.c | 4 ++++
|
|
|
|
src/systemctl/systemctl.c | 18 ++++++++++++------
|
|
|
|
2 files changed, 16 insertions(+), 6 deletions(-)
|
2014-01-31 13:36:06 +01:00
|
|
|
|
2016-02-03 10:19:12 +01:00
|
|
|
Index: systemd-227/src/core/shutdown.c
|
2015-03-27 09:39:40 +01:00
|
|
|
===================================================================
|
2016-02-03 10:19:12 +01:00
|
|
|
--- systemd-227.orig/src/core/shutdown.c
|
|
|
|
+++ systemd-227/src/core/shutdown.c
|
|
|
|
@@ -418,6 +418,10 @@ int main(int argc, char *argv[]) {
|
2014-03-11 09:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
reboot(cmd);
|
|
|
|
+
|
2014-11-26 10:36:00 +01:00
|
|
|
+ if (cmd == (int)RB_POWER_OFF)
|
2014-03-11 09:24:11 +01:00
|
|
|
+ reboot(RB_HALT_SYSTEM);
|
|
|
|
+
|
|
|
|
if (errno == EPERM && in_container) {
|
|
|
|
/* If we are in a container, and we lacked
|
|
|
|
* CAP_SYS_BOOT just exit, this will kill our
|
2016-02-03 10:19:12 +01:00
|
|
|
Index: systemd-227/src/systemctl/systemctl.c
|
2015-03-27 09:39:40 +01:00
|
|
|
===================================================================
|
2016-02-03 10:19:12 +01:00
|
|
|
--- systemd-227.orig/src/systemctl/systemctl.c
|
|
|
|
+++ systemd-227/src/systemctl/systemctl.c
|
|
|
|
@@ -94,6 +94,7 @@ static bool arg_no_pager = false;
|
2014-01-31 13:36:06 +01:00
|
|
|
static bool arg_no_wtmp = false;
|
|
|
|
static bool arg_no_wall = false;
|
|
|
|
static bool arg_no_reload = false;
|
|
|
|
+static bool arg_no_sync = false;
|
|
|
|
static bool arg_show_types = false;
|
|
|
|
static bool arg_ignore_inhibitors = false;
|
|
|
|
static bool arg_dry = false;
|
2016-02-03 10:19:12 +01:00
|
|
|
@@ -6938,6 +6939,7 @@ static int halt_parse_argv(int argc, cha
|
2014-01-31 13:36:06 +01:00
|
|
|
{ "reboot", no_argument, NULL, ARG_REBOOT },
|
|
|
|
{ "force", no_argument, NULL, 'f' },
|
|
|
|
{ "wtmp-only", no_argument, NULL, 'w' },
|
|
|
|
+ { "no-sync", no_argument, NULL, 'n' },
|
|
|
|
{ "no-wtmp", no_argument, NULL, 'd' },
|
|
|
|
{ "no-wall", no_argument, NULL, ARG_NO_WALL },
|
2014-03-11 09:24:11 +01:00
|
|
|
{}
|
2016-02-03 10:19:12 +01:00
|
|
|
@@ -6990,10 +6992,13 @@ static int halt_parse_argv(int argc, cha
|
2014-01-31 13:36:06 +01:00
|
|
|
|
|
|
|
case 'i':
|
|
|
|
case 'h':
|
|
|
|
- case 'n':
|
|
|
|
/* Compatibility nops */
|
|
|
|
break;
|
|
|
|
|
|
|
|
+ case 'n':
|
|
|
|
+ arg_no_sync = true;
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
case '?':
|
|
|
|
return -EINVAL;
|
|
|
|
|
2016-02-03 10:19:12 +01:00
|
|
|
@@ -7506,7 +7511,8 @@ static int halt_now(enum action a) {
|
2015-03-27 09:39:40 +01:00
|
|
|
/* The kernel will automaticall flush ATA disks and suchlike
|
|
|
|
* on reboot(), but the file systems need to be synce'd
|
|
|
|
* explicitly in advance. */
|
2016-02-03 10:19:12 +01:00
|
|
|
- (void) sync();
|
2014-03-11 09:24:11 +01:00
|
|
|
+ if (!arg_no_sync)
|
2016-02-03 10:19:12 +01:00
|
|
|
+ (void) sync();
|
2015-03-27 09:39:40 +01:00
|
|
|
|
|
|
|
/* Make sure C-A-D is handled by the kernel from this point
|
|
|
|
* on... */
|
2016-02-03 10:19:12 +01:00
|
|
|
@@ -7514,14 +7520,13 @@ static int halt_now(enum action a) {
|
2014-11-26 10:36:00 +01:00
|
|
|
|
|
|
|
switch (a) {
|
2014-01-31 13:36:06 +01:00
|
|
|
|
|
|
|
- case ACTION_HALT:
|
|
|
|
- log_info("Halting.");
|
2016-02-03 10:19:12 +01:00
|
|
|
- (void) reboot(RB_HALT_SYSTEM);
|
2014-01-31 13:36:06 +01:00
|
|
|
- return -errno;
|
2016-02-03 10:19:12 +01:00
|
|
|
-
|
2014-01-31 13:36:06 +01:00
|
|
|
case ACTION_POWEROFF:
|
|
|
|
log_info("Powering off.");
|
2016-02-03 10:19:12 +01:00
|
|
|
(void) reboot(RB_POWER_OFF);
|
2015-03-27 09:39:40 +01:00
|
|
|
+ /* fall-through */
|
2014-01-31 13:36:06 +01:00
|
|
|
+ case ACTION_HALT:
|
|
|
|
+ log_info("Halting.");
|
2016-02-03 10:19:12 +01:00
|
|
|
+ (void) reboot(RB_HALT_SYSTEM);
|
2014-01-31 13:36:06 +01:00
|
|
|
return -errno;
|
|
|
|
|
2016-02-03 10:19:12 +01:00
|
|
|
case ACTION_KEXEC:
|