diff options
author | Charles Strahan <charles@cstrahan.com> | 2016-04-09 19:36:02 -0400 |
---|---|---|
committer | Charles Strahan <charles@cstrahan.com> | 2016-04-10 16:07:03 -0400 |
commit | ad7b1e24c20d60199525f3849115fa7e96bc5174 (patch) | |
tree | a0d97c245b6cb33106cbb2f35749c34e063a4057 /pkgs/os-specific/linux/fanctl | |
parent | aec8daed8685c885f2e8c2701c4a013c607d163d (diff) | |
download | nixlib-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar nixlib-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.gz nixlib-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.bz2 nixlib-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.lz nixlib-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.xz nixlib-ad7b1e24c20d60199525f3849115fa7e96bc5174.tar.zst nixlib-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')
-rw-r--r-- | pkgs/os-specific/linux/fanctl/default.nix | 46 | ||||
-rw-r--r-- | pkgs/os-specific/linux/fanctl/robustness.patch | 85 |
2 files changed, 107 insertions, 24 deletions
diff --git a/pkgs/os-specific/linux/fanctl/default.nix b/pkgs/os-specific/linux/fanctl/default.nix index 61e100f4c9b7..cb188b56c06d 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; { diff --git a/pkgs/os-specific/linux/fanctl/robustness.patch b/pkgs/os-specific/linux/fanctl/robustness.patch new file mode 100644 index 000000000000..7a70a784e3ee --- /dev/null +++ b/pkgs/os-specific/linux/fanctl/robustness.patch @@ -0,0 +1,85 @@ +diff --git a/fanctl b/fanctl +index 4338b75..84cf987 100755 +--- a/fanctl ++++ b/fanctl +@@ -5,6 +5,8 @@ + # fanctl down 15 10.1.0.1 + # + ++export PATH="@PATH@" ++ + usage() + { + echo "Usage: $0 <cmd> [<options>...]" 1>&2 +@@ -23,8 +25,8 @@ run() + "$@" + } + +-state_dir="/run/ubuntu-fan" +-lconfig_dir="/var/lib/ubuntu-fan/config" ++state_dir="/run/fan-networking" ++lconfig_dir="/var/lib/fan-networking/config" + + __ip_split() + { +@@ -931,12 +933,12 @@ dhcp_reconfigure() + --strict-order \ + --bind-interfaces \ + --pid-file="$state_dir/dnsmasq-$C_bridge_state.pid" \ +- --conf-file= \ ++ --conf-file=/dev/null \ + $dhcp_flags \ + --dhcp-no-override \ + --except-interface=lo \ + --interface="$C_bridge" \ +- --dhcp-leasefile=/var/lib/misc/dnsmasq."$C_bridge_state".leases \ ++ --dhcp-leasefile=/var/lib/fan-networking/dnsmasq."$C_bridge_state".leases \ + --dhcp-authoritative \ + || $fail "$C_bridge: failed to start dnsmasq" + +@@ -1559,21 +1561,23 @@ cmd_config() + + case "$cmd" in + list|ls) +- ls -1 "$lconfig_dir" | \ +- while read config +- do +- case "$config" in +- *.conf) ;; +- *) continue ;; +- esac ++ if [ -d $lconfig_dir ]; then ++ ls -1 "$lconfig_dir" | \ ++ while read config ++ do ++ case "$config" in ++ *.conf) ;; ++ *) continue ;; ++ esac + +- config=$( echo "$config" | sed \ +- -e 's/.conf$//' \ +- -e 's/--/ /g' \ +- -e 's@-@/@g' +- ) +- echo "$config" +- done ++ config=$( echo "$config" | sed \ ++ -e 's/.conf$//' \ ++ -e 's/--/ /g' \ ++ -e 's@-@/@g' ++ ) ++ echo "$config" ++ done ++ fi + ;; + show) + cmd_decode_init +@@ -1588,6 +1592,7 @@ cmd_config() + [ -f "$uconfig" ] && cat "$uconfig" + ;; + set) ++ mkdir -p $lconfig_dir || fail "could not create config directory ($lconfig_dir)" + cmd_decode_init + if ! cmd_decode_config "config set" "$@"; then + fail "invalid config" |