From cdcbad35d7374f63a50a8fde7c809e1ab8e5ad17 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Sun, 19 Nov 2006 18:16:13 +0000
Subject: [PATCH] * Quick patch to set the Upstart events directory.

svn path=/nixpkgs/trunk/; revision=7073
---
 pkgs/os-specific/linux/upstart/cfgdir.patch | 22 +++++++++++++++++++++
 pkgs/os-specific/linux/upstart/default.nix  |  1 +
 2 files changed, 23 insertions(+)
 create mode 100644 pkgs/os-specific/linux/upstart/cfgdir.patch

diff --git a/pkgs/os-specific/linux/upstart/cfgdir.patch b/pkgs/os-specific/linux/upstart/cfgdir.patch
new file mode 100644
index 000000000000..7583ca85760e
--- /dev/null
+++ b/pkgs/os-specific/linux/upstart/cfgdir.patch
@@ -0,0 +1,22 @@
+diff -rc upstart-0.3.0-orig/init/main.c upstart-0.3.0/init/main.c
+*** upstart-0.3.0-orig/init/main.c	2006-10-13 14:35:16.000000000 +0200
+--- upstart-0.3.0/init/main.c	2006-11-19 17:02:47.000000000 +0100
+***************
+*** 206,212 ****
+  	control_open ();
+  
+  	/* Read configuration */
+! 	cfg_watch_dir (NULL, CFG_DIR, NULL);
+  
+  	/* Set the PATH environment variable */
+  	setenv ("PATH", PATH, TRUE);
+--- 206,214 ----
+  	control_open ();
+  
+  	/* Read configuration */
+!         char *cfg_dir = getenv("UPSTART_CFG_DIR");
+!         if (!cfg_dir) cfg_dir = CFG_DIR;
+! 	cfg_watch_dir (NULL, cfg_dir, NULL);
+  
+  	/* Set the PATH environment variable */
+  	setenv ("PATH", PATH, TRUE);
diff --git a/pkgs/os-specific/linux/upstart/default.nix b/pkgs/os-specific/linux/upstart/default.nix
index 30481782d642..3ff46e24b8c9 100644
--- a/pkgs/os-specific/linux/upstart/default.nix
+++ b/pkgs/os-specific/linux/upstart/default.nix
@@ -7,4 +7,5 @@ stdenv.mkDerivation {
     md5 = "269046f41c6418225306280044a799eb";
   };
   configureFlags = "--enable-compat";
+  patches = [./cfgdir.patch];
 }