nixpkgs/pkgs/development/libraries/consolekit/commands.patch
Arie Middelkoop 456d380cef Fixed poweroff/reboot in "consolekit" for NixOS.
svn path=/nixpkgs/trunk/; revision=32261
2012-02-13 17:15:34 +00:00

34 lines
1.3 KiB
Diff

This patch adds shutdown commands specific to NixOS, as NixOS does not have
a /sbin or /usr/sbin directory. In order not to have a dependency on the
package that provides "shutdown" when in an environment other than NixOS,
we'll make it depend on /var/run/current-system.
Note: this patch does not compromise system security. Other systems than
NixOS should have already shutdown in the earlier directories being searched,
and otherwise /var/run is writable only be root.
--- ConsoleKit-0.4.1/tools/linux/ck-system-restart.org 2012-02-13 11:29:57.352902568 +0100
+++ ConsoleKit-0.4.1/tools/linux/ck-system-restart 2012-02-13 11:43:27.593317712 +0100
@@ -7,6 +7,9 @@
elif [ -x "/usr/sbin/shutdown" ] ; then
/usr/sbin/shutdown -r now
exit $?
+elif [ -x "/var/run/current-system/sw/sbin/shutdown" ] ; then
+ /var/run/current-system/sw/sbin/shutdown -r now
+ exit $?
else
exit 1
fi
--- ConsoleKit-0.4.1/tools/linux/ck-system-stop.org 2012-02-13 11:30:06.228950934 +0100
+++ ConsoleKit-0.4.1/tools/linux/ck-system-stop 2012-02-13 11:44:12.664563304 +0100
@@ -7,6 +7,9 @@
elif [ -x "/usr/sbin/shutdown" ] ; then
/usr/sbin/shutdown -h now
exit $?
+elif [ -x "/var/run/current-system/sw/sbin/shutdown" ] ; then
+ /var/run/current-system/sw/sbin/shutdown -h now
+ exit $?
else
exit 1
fi