1 Search $PATH for the shutdown binary instead of hard-coding /sbin/shutdown,
2 which isn't valid on NixOS (and a compatibility link on most other modern
5 --- a/include/pathnames.h
6 +++ b/include/pathnames.h
9 # define _PATH_LOGIN "/bin/login"
11 -#define _PATH_SHUTDOWN "/sbin/shutdown"
12 -#define _PATH_POWEROFF "/sbin/poweroff"
13 +#define _PATH_SHUTDOWN "shutdown"
14 +#define _PATH_POWEROFF "poweroff"
16 #define _PATH_TERMCOLORS_DIRNAME "terminal-colors.d"
17 #define _PATH_TERMCOLORS_DIR "/etc/" _PATH_TERMCOLORS_DIRNAME
18 --- a/sys-utils/rtcwake.c
19 +++ b/sys-utils/rtcwake.c
20 @@ -587,29 +587,29 @@ int main(int argc, char **argv)
24 - if (!access(_PATH_SHUTDOWN, X_OK)) {
25 - arg[i++] = _PATH_SHUTDOWN;
30 - } else if (!access(_PATH_POWEROFF, X_OK)) {
31 - arg[i++] = _PATH_POWEROFF;
36 + arg[i++] = _PATH_SHUTDOWN;
44 - printf(_("suspend mode: off; executing %s\n"),
49 + printf(_("suspend mode: off; executing %s\n"),
53 + execvp(arg[0], arg);
55 warn(_("failed to execute %s"), arg[0]);
56 - rc = EX_EXEC_ENOENT;
57 + // Reuse translations.
58 + printf(_("suspend mode: off; executing %s\n"),
64 + arg[i++] = _PATH_POWEROFF;
66 + execvp(arg[0], arg);
67 /* Failed to find shutdown command */
68 warn(_("failed to find shutdown command"));