From 6663af083352b62a2556a90dfbe673af4b461f1d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Apr 2009 22:04:31 +0000 Subject: [PATCH] * dbus: fork() into the background so that the daemon is running by the time the job has finished starting. This obviates the need for the sleep hack in other jobs. svn path=/nixos/trunk/; revision=14875 --- upstart-jobs/consolekit.nix | 5 ----- upstart-jobs/dbus.nix | 15 +++++++++------ upstart-jobs/disnix.nix | 5 ----- upstart-jobs/hal.nix | 3 --- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/upstart-jobs/consolekit.nix b/upstart-jobs/consolekit.nix index fef32159aa6..57fb5b9dca6 100644 --- a/upstart-jobs/consolekit.nix +++ b/upstart-jobs/consolekit.nix @@ -14,11 +14,6 @@ in start on dbus stop on shutdown - start script - # !!! quick hack: wait until dbus has started - sleep 3 - end script - respawn ${pkgs.ConsoleKit}/sbin/console-kit-daemon ''; } diff --git a/upstart-jobs/dbus.nix b/upstart-jobs/dbus.nix index a8ce1fddf06..d84ca477b08 100644 --- a/upstart-jobs/dbus.nix +++ b/upstart-jobs/dbus.nix @@ -10,8 +10,7 @@ let name = "dbus-conf"; buildCommand = " ensureDir $out - substitute ${dbus}/etc/dbus-1/system.conf $out/system.conf \\ - --replace '' '' + ln -s ${dbus}/etc/dbus-1/system.conf $out/system.conf ensureDir $out/system.d for i in ${toString dbusServices}; do @@ -49,13 +48,17 @@ in mkdir -m 0755 -p /var/lib/dbus ${dbus.tools}/bin/dbus-uuidgen --ensure + rm -f ${homeDir}/pid + ${dbus}/bin/dbus-daemon --config-file=${configFile}/system.conf end script - respawn + respawn sleep 1000000 - script - rm -f ${homeDir}/pid - exec ${dbus}/bin/dbus-daemon --config-file=${configFile}/system.conf + stop script + pid=$(cat ${homeDir}/pid) + if test -n "$pid"; then + kill -9 $pid + fi end script ''; diff --git a/upstart-jobs/disnix.nix b/upstart-jobs/disnix.nix index 2f64afbc4b9..bc24e513bec 100644 --- a/upstart-jobs/disnix.nix +++ b/upstart-jobs/disnix.nix @@ -14,11 +14,6 @@ in start on dbus stop on shutdown - start script - # !!! quick hack: wait until dbus has started - sleep 3 - end script - respawn ${pkgs.bash}/bin/sh -c 'export PATH=/var/run/current-system/sw/bin:$PATH; export HOME=/root; export DISNIX_ACTIVATE_HOOK=${cfg.activateHook}; export DISNIX_DEACTIVATE_HOOK=${cfg.deactivateHook}; ${pkgs.disnix}/bin/disnix-service' ''; } diff --git a/upstart-jobs/hal.nix b/upstart-jobs/hal.nix index 8b59c079eb8..af4038f0fe0 100644 --- a/upstart-jobs/hal.nix +++ b/upstart-jobs/hal.nix @@ -28,9 +28,6 @@ start script - # !!! quick hack: wait until dbus has started - sleep 3 - mkdir -m 0755 -p /var/cache/hald end script