From a7af5588b69fe877bdaa346d044b6ccfb1860c23 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 10 Apr 2012 12:07:30 +0000 Subject: [PATCH] * Drop ugly reference to var/run/current-system/sw/sbin/wpa_cli, and make it conditional. svn path=/nixos/trunk/; revision=33717 --- modules/services/networking/dhcpcd.nix | 8 +++++--- modules/services/networking/wpa_supplicant.nix | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/services/networking/dhcpcd.nix b/modules/services/networking/dhcpcd.nix index 9c2ff5575be5..b22bbb3f0517 100644 --- a/modules/services/networking/dhcpcd.nix +++ b/modules/services/networking/dhcpcd.nix @@ -45,7 +45,9 @@ let # only works when interface is wireless and wpa_supplicant has a control socket # but we allow it to fail silently - wifiparams=$(/var/run/current-system/sw/sbin/wpa_cli -i$interface status 2>/dev/null | grep ssid | sed 's|^b|B|;s|ssid|SSID|' | xargs) + ${optionalString config.networking.wireless.enable '' + params+=" $(${pkgs.wpa_supplicant}/sbin/wpa_cli -i$interface status 2>/dev/null | grep ssid | sed 's|^b|B|;s|ssid|SSID|' | xargs)" + ''} if [ "$reason" = BOUND -o "$reason" = REBOOT ]; then # Restart ntpd. (The "ip-up" event below will trigger the @@ -56,11 +58,11 @@ let # it"), so we silently lose time synchronisation. ${config.system.build.upstart}/sbin/initctl stop ntpd - ${config.system.build.upstart}/sbin/initctl emit -n ip-up $params $wifiparams + ${config.system.build.upstart}/sbin/initctl emit -n ip-up $params fi if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then - ${config.system.build.upstart}/sbin/initctl emit -n ip-down $params $wifiparams + ${config.system.build.upstart}/sbin/initctl emit -n ip-down $params fi ''; diff --git a/modules/services/networking/wpa_supplicant.nix b/modules/services/networking/wpa_supplicant.nix index 338a801f701f..fe4fecaf0baf 100644 --- a/modules/services/networking/wpa_supplicant.nix +++ b/modules/services/networking/wpa_supplicant.nix @@ -126,7 +126,6 @@ in assertions = [{ assertion = !cfg.userControlled.enable || cfg.interfaces != []; message = "user controlled wpa_supplicant needs explicit networking.wireless.interfaces";}]; - }; }