diff options
author | Robin Gloster <mail@glob.in> | 2016-04-18 13:00:40 +0000 |
---|---|---|
committer | Robin Gloster <mail@glob.in> | 2016-04-18 13:49:22 +0000 |
commit | d020caa5b2eca90ea051403fbb4c52b99ee071b9 (patch) | |
tree | ba44ef1e784bca89e0df6b249956fd035b1d86e3 /pkgs/os-specific/linux/fanctl/default.nix | |
parent | 3e68106afd95df012ddb548575f0133681687a90 (diff) | |
parent | 0729f606973870c03d21bb2f21b70d91216943ca (diff) |
Merge remote-tracking branch 'upstream/master' into hardened-stdenv
Diffstat (limited to 'pkgs/os-specific/linux/fanctl/default.nix')
-rw-r--r-- | pkgs/os-specific/linux/fanctl/default.nix | 46 |
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 61e100f4c9b72..f60951f5541eb 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.makeBinPath [ + 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; { |