summary refs log tree commit diff
path: root/pkgs/os-specific/linux/fanctl/default.nix
diff options
context:
space:
mode:
authorCharles Strahan <charles@cstrahan.com>2016-04-09 19:36:02 -0400
committerCharles Strahan <charles@cstrahan.com>2016-04-10 16:07:03 -0400
commitad7b1e24c20d60199525f3849115fa7e96bc5174 (patch)
treea0d97c245b6cb33106cbb2f35749c34e063a4057 /pkgs/os-specific/linux/fanctl/default.nix
parentaec8daed8685c885f2e8c2701c4a013c607d163d (diff)
downloadnixpkgs-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar
nixpkgs-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.gz
nixpkgs-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.bz2
nixpkgs-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.lz
nixpkgs-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.xz
nixpkgs-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.zst
nixpkgs-ad7b1e24c20d60199525f3849115fa7e96bc5174.zip
fan-networking: updated patches from Ubuntu
This pulls in updated Fan Networking patches from Ubuntu.
(https://wiki.ubuntu.com/FanNetworking)

closes #14328
Diffstat (limited to 'pkgs/os-specific/linux/fanctl/default.nix')
-rw-r--r--pkgs/os-specific/linux/fanctl/default.nix46
1 files changed, 22 insertions, 24 deletions
diff --git a/pkgs/os-specific/linux/fanctl/default.nix b/pkgs/os-specific/linux/fanctl/default.nix
index 61e100f4c9b..cb188b56c06 100644
--- a/pkgs/os-specific/linux/fanctl/default.nix
+++ b/pkgs/os-specific/linux/fanctl/default.nix
@@ -1,41 +1,39 @@
-{ stdenv, lib, fetchbzr, makeWrapper, bridge-utils, iproute, dnsmasq, iptables, kmod, utillinux }:
+{ stdenv, lib, fetchurl, gnugrep, glibc, gawk, coreutils, bridge-utils, iproute
+, dnsmasq, iptables, kmod, utillinux, gnused }:
 
-let stateDir = "/var/lib/fan-networking";
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "fanctl-${version}";
 
-  version = "0.3.0";
+  version = "0.9.0";
 
-  src = fetchbzr {
-    url = "https://code.launchpad.net/~ubuntu-branches/ubuntu/vivid/ubuntu-fan/vivid-updates";
-    rev = 2;
-    sha256 = "1vcr2rg99g7sx1zynhiggjzc9y9z591i4535hbm21dysy3cisp7i";
+  src = fetchurl {
+    url = "https://launchpad.net/ubuntu/+archive/primary/+files/ubuntu-fan_${version}.tar.xz";
+    sha256 = "03dv5zzb8fkl9kkbhznxm48d6j3fjms74fn0s1zip2gz53l1s14n";
   };
 
-  buildInputs = [ makeWrapper ];
+  # The Ubuntu package creates a number of state/config directories upon
+  # installation, and so the fanctl script expects those directories to exist
+  # before being used. Instead, we patch the fanctl script to gracefully handle
+  # the fact that the directories might not exist yet.
+  # Also, when dnsmasq is given --conf-file="", it will still attempt to read
+  # /etc/dnsmasq.conf; if that file does not exist, dnsmasq subsequently fails,
+  # so we'll use /dev/null, which actually works as intended.
+  patches = [ ./robustness.patch ];
 
-  # When given --conf-file="", dnsmasq still attempts to read /etc/dnsmasq.conf;
-  # if that files does not exist, dnsmasq subsequently fails,
-  # so we'll use /dev/null.
-  #
-  # Also, make sure the state directory before starting dnsmasq.
-  buildPhase = ''
+  postPatch = ''
     substituteInPlace fanctl \
-      --replace '--conf-file= ' \
-                '--conf-file=/dev/null ' \
-      --replace '/var/lib/misc' \
-                '${stateDir}'
-
-    sed -i '/dnsmasq -u/i \
-    mkdir -p ${stateDir}' fanctl
+      --replace '@PATH@' \
+                '${lib.makeSearchPath "bin" [
+                     gnugrep gawk coreutils bridge-utils iproute dnsmasq
+                     iptables kmod utillinux gnused
+                     glibc # needed for getent
+                   ]}'
   '';
 
   installPhase = ''
     mkdir -p $out/bin $out/man/man8
     cp fanctl.8 $out/man/man8
     cp fanctl $out/bin
-    wrapProgram $out/bin/fanctl --prefix PATH : \
-      ${lib.makeSearchPath "bin" [ bridge-utils iproute dnsmasq iptables kmod utillinux ]};
   '';
 
   meta = with lib; {