Author: amiddelk
Date: Mon Feb 13 17:15:34 2012
New Revision: 32261
URL: https://nixos.org/websvn/nix/?rev=32261&sc=1

Log:
Fixed poweroff/reboot in "consolekit" for NixOS.

Added:
   nixpkgs/trunk/pkgs/development/libraries/consolekit/commands.patch
Modified:
   nixpkgs/trunk/pkgs/development/libraries/consolekit/default.nix

Added: nixpkgs/trunk/pkgs/development/libraries/consolekit/commands.patch
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixpkgs/trunk/pkgs/development/libraries/consolekit/commands.patch  Mon Feb 
13 17:15:34 2012        (r32261)
@@ -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

Modified: nixpkgs/trunk/pkgs/development/libraries/consolekit/default.nix
==============================================================================
--- nixpkgs/trunk/pkgs/development/libraries/consolekit/default.nix     Mon Feb 
13 16:35:11 2012        (r32260)
+++ nixpkgs/trunk/pkgs/development/libraries/consolekit/default.nix     Mon Feb 
13 17:15:34 2012        (r32261)
@@ -11,7 +11,9 @@
   
   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";
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to