chiark / gitweb /
Prep v238: Make a real distinction between 'halt' and 'poweroff'.
authorSven Eden <yamakuzure@gmx.net>
Tue, 12 Jun 2018 06:03:27 +0000 (08:03 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 12 Jun 2018 06:04:00 +0000 (08:04 +0200)
meson.build
meson_options.txt
src/login/eloginctl.c
src/login/elogind-dbus.c

index 817f68585c4eb1a13d26c0bacb65258d6bca0a93..a9c3ac393e9d3766fb38046634794c9da656de10 100644 (file)
@@ -663,9 +663,10 @@ mkdir_p = 'mkdir -p $DESTDIR/@0@'
 #          ['setfont',    '/usr/bin/setfont',    'KBD_SETFONT'],
 #         ]
 #else
-progs = [['kexec',      '/usr/sbin/kexec',     'KEXEC'],
+progs = [['halt',       '/sbin/halt',          'HALT'],
+         ['kexec',      '/usr/sbin/kexec',     'KEXEC'],
+         ['poweroff',   '/sbin/poweroff',      'POWEROFF'],
          ['reboot',     '/sbin/reboot',        'REBOOT'],
-         ['halt',       '/sbin/halt',          'HALT'],
         ]
 #endif // 0
 foreach prog : progs
index 3536f3ddf04ef93dd4c93e13ad3a683cb6ae2737..0fa3f1896ab38f36d6be9baee2159376cf9a9f9e 100644 (file)
@@ -27,7 +27,7 @@ option('rootprefix', type : 'string',
 #if 0 /// UNNEEDED by elogind
 # option('link-udev-shared', type : 'boolean',
 #        description : 'link systemd-udev and its helpers to libsystemd-shared.so')
-# 
+#
 # option('sysvinit-path', type : 'string', value : '/etc/init.d',
 #        description : 'the directory where the SysV init scripts are located')
 # option('sysvrcnd-path', type : 'string', value : '/etc/rc.d',
@@ -38,7 +38,7 @@ option('rootprefix', type : 'string',
 #        value : '/etc/rc.local')
 # option('halt-local', type : 'string',
 #        value : '/usr/sbin/halt.local')
-# 
+#
 # option('quotaon-path', type : 'string', description : 'path to quotaon')
 # option('quotacheck-path', type : 'string', description : 'path to quotacheck')
 # option('kill-path', type : 'string', description : 'path to kill')
@@ -60,8 +60,9 @@ option('udevbindir', type : 'string',
 option('docdir', type : 'string', description : 'path where to install the documentation.')
 option('htmldir', type : 'string', description : 'path where to install the HTML documentation.')
 
-# We have no systemd-shutdown binary, so we need 'halt' and 'reboot'
+# We have no systemd-shutdown binary, so we need 'halt', 'reboot' and 'poweroff'
 option('halt-path', type : 'string', description : 'path to halt')
+option('poweroff-path', type : 'string', description : 'path to poweroff')
 option('reboot-path', type : 'string', description : 'path to reboot')
 #endif // 0
 option('kexec-path', type : 'string', description : 'path to kexec')
@@ -71,7 +72,7 @@ option('kexec-path', type : 'string', description : 'path to kexec')
 # option('umount-path', type : 'string', description : 'path to umount')
 # option('loadkeys-path', type : 'string', description : 'path to loadkeys')
 # option('setfont-path', type : 'string', description : 'path to setfont')
-# 
+#
 # option('debug-shell', type : 'string', value : '/bin/sh',
 #        description : 'path to debug shell binary')
 # option('debug-tty', type : 'string', value : '/dev/tty9',
@@ -258,7 +259,7 @@ option('gshadow', type : 'boolean',
 # option('www-target', type : 'string',
 #        description : 'the address and dir to upload docs too',
 #        value : 'www.freedesktop.org:/srv/www.freedesktop.org/www/software/systemd')
-# 
+#
 # option('seccomp', type : 'combo', choices : ['auto', 'true', 'false'],
 #        description : 'SECCOMP support')
 #endif // 0
index 566c339c6e01a258a52e3ec71814305e0fe5cf41..9349f301f38c08980e528b16f3bff3d048dc75a3 100644 (file)
@@ -46,11 +46,14 @@ static const struct {
         HandleAction action;
         const char*  verb;
 } action_table[_ACTION_MAX] = {
+        [ACTION_HALT]         = { HANDLE_HALT,         "halt"         },
         [ACTION_POWEROFF]     = { HANDLE_POWEROFF,     "poweroff",    },
         [ACTION_REBOOT]       = { HANDLE_REBOOT,       "reboot",      },
+        [ACTION_KEXEC]        = { HANDLE_KEXEC,        "kexec",       },
         [ACTION_SUSPEND]      = { HANDLE_SUSPEND,      "suspend",     },
         [ACTION_HIBERNATE]    = { HANDLE_HIBERNATE,    "hibernate",   },
-        [ACTION_HYBRID_SLEEP] = { HANDLE_HYBRID_SLEEP, "hybrid-sleep" },
+        [ACTION_HYBRID_SLEEP] = { HANDLE_HYBRID_SLEEP, "hybrid-sleep" }
+        /* ACTION_CANCEL_SHUTDOWN is handled differently */
 };
 
 static int elogind_set_wall_message(sd_bus* bus, const char* msg);
index 638376fd73b8eb089d66e6b0dc1fe2b7bd3149ce..baa36b1f28c474d65bb322b24497dceed0cd6b61 100644 (file)
@@ -107,7 +107,7 @@ static int shutdown_or_sleep(Manager *m, HandleAction action) {
 
         switch (action) {
         case HANDLE_POWEROFF:
-                return run_helper(HALT);
+                return run_helper(POWEROFF);
         case HANDLE_REBOOT:
                 return run_helper(REBOOT);
         case HANDLE_HALT:
@@ -172,7 +172,7 @@ static int execute_shutdown_or_sleep(
          * sleeping processes to wake up, we have to tell them all
          * by ourselves. */
         if (w == INHIBIT_SLEEP) {
-                send_prepare_for(m, w, false);
+                (void) send_prepare_for(m, w, false);
                 m->action_what = 0;
         } else
                 m->action_what = w;
@@ -273,7 +273,7 @@ int bus_manager_shutdown_or_sleep_now_or_later(
         assert(w <= _INHIBIT_WHAT_MAX);
 
         /* Tell everybody to prepare for shutdown/sleep */
-        send_prepare_for(m, w, true);
+        (void) send_prepare_for(m, w, true);
 
         delayed =
                 m->inhibit_delay_max > 0 &&