about summary refs log tree commit diff
path: root/pkgs/tools/networking/wicd
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2012-01-18 20:38:34 +0000
committerPeter Simons <simons@cryp.to>2012-01-18 20:38:34 +0000
commit0f3fa64430095bcaedfa091d7a27b1d2dc728f9d (patch)
tree84fe588d077cfa4aaaede42afa6127a09b6b6467 /pkgs/tools/networking/wicd
parent5ebdf058cc5f8fbbcd680cbecbc06a04435555b3 (diff)
downloadnixlib-0f3fa64430095bcaedfa091d7a27b1d2dc728f9d.tar
nixlib-0f3fa64430095bcaedfa091d7a27b1d2dc728f9d.tar.gz
nixlib-0f3fa64430095bcaedfa091d7a27b1d2dc728f9d.tar.bz2
nixlib-0f3fa64430095bcaedfa091d7a27b1d2dc728f9d.tar.lz
nixlib-0f3fa64430095bcaedfa091d7a27b1d2dc728f9d.tar.xz
nixlib-0f3fa64430095bcaedfa091d7a27b1d2dc728f9d.tar.zst
nixlib-0f3fa64430095bcaedfa091d7a27b1d2dc728f9d.zip
wicd: integrate with upstart events
quite some services need to be started/restarted when a connection is
established/teared down. Also, some services are optional depending on
the connected access point. For example: use a vpn on an untrusted
network.

these small trigger scripts don't change any behaviour by themselves,
but allow you to hook in to them if you need.

example use:

  jobs.gw6c.startOn = pkgs.lib.mkForce "started  openvpn-dcsOffice";
  jobs.gw6c.stopOn  = pkgs.lib.mkForce "stopping openvpn-dcsOffice";
  jobs."openvpn-dcsOffice".startOn        = pkgs.lib.mkForce "wicd-postconnect";
  jobs."openvpn-dcsOffice".stopOn         = pkgs.lib.mkForce "stopping network-interfaces or wicd-predisconnect";

In the example, I use 3 layers. When a physical connection is
available (wifi connect), I setup a vpn connection, and setup an ipv6
tunnel on top of that. When disconnecting, they are automatically shut
down in the right order as well.

svn path=/nixpkgs/trunk/; revision=31662
Diffstat (limited to 'pkgs/tools/networking/wicd')
-rw-r--r--pkgs/tools/networking/wicd/default.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/tools/networking/wicd/default.nix b/pkgs/tools/networking/wicd/default.nix
index 19f30713a9fe..72d41519c7ce 100644
--- a/pkgs/tools/networking/wicd/default.nix
+++ b/pkgs/tools/networking/wicd/default.nix
@@ -85,6 +85,17 @@ stdenv.mkDerivation rec {
     # <http://wicd.net/punbb/viewtopic.php?id=87>.
     cp -v "${./wpa2-ttls}" "$out/etc/encryption/templates/wpa2-ttls"
     echo "wpa2-ttls" >> "$out/etc/encryption/templates/active"
+
+    # have wicd generate upstart events
+    echo '#!/bin/sh
+initctl emit -n wicd-preconnect ITYPE="$1" ESSID="$2" BSSID="$3"' > $out/etc/scripts/preconnect/upstart-emit
+    echo '#!/bin/sh
+initctl emit -n wicd-postconnect ITYPE="$1" ESSID="$2" BSSID="$3"' > $out/etc/scripts/postconnect/upstart-emit
+    echo '#!/bin/sh
+initctl emit -n wicd-predisconnect ITYPE="$1" ESSID="$2" BSSID="$3"' > $out/etc/scripts/predisconnect/upstart-emit
+    echo '#!/bin/sh
+initctl emit -n wicd-postdisconnect ITYPE="$1" ESSID="$2" BSSID="$3"' > $out/etc/scripts/postdisconnect/upstart-emit
+    chmod a+x $out/etc/scripts/*/upstart-emit
   '';
 
   meta = {