3
0
Fork 0
forked from mirrors/nixpkgs

Fixed poweroff/reboot in "consolekit" for NixOS.

svn path=/nixpkgs/trunk/; revision=32261
This commit is contained in:
Arie Middelkoop 2012-02-13 17:15:34 +00:00
parent 0a85d5cf98
commit 456d380cef
2 changed files with 36 additions and 1 deletions

View file

@ -0,0 +1,33 @@
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

View file

@ -11,7 +11,9 @@ stdenv.mkDerivation rec {
buildInputs = [ pkgconfig dbus_glib zlib pam glib libX11 polkit expat ];
patches = [ ./0001-Don-t-daemonize-when-activated.patch
./0002-Don-t-take-bus-name-until-ready.patch ];
./0002-Don-t-take-bus-name-until-ready.patch
./commands.patch # adds shutdown commands for NixOS to the list of shutdown commands
];
# For console-kit to get the rpath to libgcc_s, needed for pthread_cancel to work
NIX_LDFLAGS = "-lgcc_s";