nixpkgs/pkgs/os-specific/linux/util-linux/rtcwake-search-PATH-for-shutdown.patch

28 lines
840 B
Diff
Raw Normal View History

Search $PATH for the shutdown binary instead of hard-coding /sbin/shutdown,
which isn't valid on NixOS (and a compatibility link on most other modern
distros anyway).
-- nckx <tobias.geerinckx.rice@gmail.com>
2016-04-28 03:19:02 +00:00
--- a/include/pathnames.h
+++ b/include/pathnames.h
2017-01-14 17:57:58 +00:00
@@ -53,7 +53,7 @@
#ifndef _PATH_LOGIN
2016-04-28 03:19:02 +00:00
#define _PATH_LOGIN "/bin/login"
2017-01-14 17:57:58 +00:00
#endif
-#define _PATH_SHUTDOWN "/sbin/shutdown"
2017-01-14 17:57:58 +00:00
+#define _PATH_SHUTDOWN "shutdown"
2016-04-28 03:19:02 +00:00
#define _PATH_TERMCOLORS_DIRNAME "terminal-colors.d"
#define _PATH_TERMCOLORS_DIR "/etc/" _PATH_TERMCOLORS_DIRNAME
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -575,7 +575,7 @@ int main(int argc, char **argv)
arg[i++] = "now";
arg[i] = NULL;
if (!ctl.dryrun) {
- execv(arg[0], arg);
+ execvp(arg[0], arg);
warn(_("failed to execute %s"), _PATH_SHUTDOWN);
rc = EXIT_FAILURE;
}