From: Sven Eden Date: Tue, 12 Jun 2018 06:03:27 +0000 (+0200) Subject: Prep v238: Make a real distinction between 'halt' and 'poweroff'. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=2fb9555cca94ede6ad186060e2ef72ac5ed523a2;p=elogind.git Prep v238: Make a real distinction between 'halt' and 'poweroff'. --- diff --git a/meson.build b/meson.build index 817f68585..a9c3ac393 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/meson_options.txt b/meson_options.txt index 3536f3ddf..0fa3f1896 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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 diff --git a/src/login/eloginctl.c b/src/login/eloginctl.c index 566c339c6..9349f301f 100644 --- a/src/login/eloginctl.c +++ b/src/login/eloginctl.c @@ -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); diff --git a/src/login/elogind-dbus.c b/src/login/elogind-dbus.c index 638376fd7..baa36b1f2 100644 --- a/src/login/elogind-dbus.c +++ b/src/login/elogind-dbus.c @@ -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 &&