From a5872e8bde58efe529357260a083933fcac6ac39 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Mon, 28 May 2018 13:50:05 +0800 Subject: hyperv-daemons: fix binary location to stop error log spam --- pkgs/os-specific/linux/hyperv-daemons/default.nix | 37 +++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'pkgs/os-specific/linux/hyperv-daemons') diff --git a/pkgs/os-specific/linux/hyperv-daemons/default.nix b/pkgs/os-specific/linux/hyperv-daemons/default.nix index a209f1ab4bb..1a111a295a4 100644 --- a/pkgs/os-specific/linux/hyperv-daemons/default.nix +++ b/pkgs/os-specific/linux/hyperv-daemons/default.nix @@ -1,7 +1,10 @@ -{ stdenv, lib, python, kernel, makeWrapper, writeText }: +{ stdenv, lib, python, kernel, makeWrapper, writeText +, gawk, iproute }: let - daemons = stdenv.mkDerivation { + libexec = "libexec/hypervkvpd"; + + daemons = stdenv.mkDerivation rec { pname = "hyperv-daemons-bin"; inherit (kernel) src version; @@ -10,10 +13,15 @@ let # as of 4.9 compilation will fail due to -Werror=format-security hardeningDisable = [ "format" ]; - preConfigure = '' + postPatch = '' cd tools/hv + substituteInPlace hv_kvp_daemon.c \ + --replace /usr/libexec/hypervkvpd/ $out/${libexec}/ ''; + # We don't actually need the hv_get_{dhcp,dns}_info scripts on NixOS in + # their current incarnation but with them in place, we stop the spam of + # errors in the log. installPhase = '' runHook preInstall @@ -21,7 +29,9 @@ let install -Dm755 hv_''${f}_daemon -t $out/bin done - install -Dm755 hv_get_dns_info.sh lsvmbus -t $out/bin + install -Dm755 lsvmbus $out/bin/lsvmbus + install -Dm755 hv_get_dhcp_info.sh $out/${libexec}/hv_get_dhcp_info + install -Dm755 hv_get_dns_info.sh $out/${libexec}/hv_get_dns_info # I don't know why this isn't being handled automatically by fixupPhase substituteInPlace $out/bin/lsvmbus \ @@ -31,8 +41,8 @@ let ''; postFixup = '' - # kvp needs to be able to find the script(s) - wrapProgram $out/bin/hv_kvp_daemon --prefix PATH : $out/bin + wrapProgram $out/bin/hv_kvp_daemon \ + --prefix PATH : $out/bin:${lib.makeBinPath [ gawk iproute ]} ''; }; @@ -56,24 +66,19 @@ let in stdenv.mkDerivation { pname = "hyperv-daemons"; - inherit (kernel) version; # we just stick the bins into out as well as it requires "out" outputs = [ "bin" "lib" "out" ]; - phases = [ "installPhase" ]; - buildInputs = [ daemons ]; - installPhase = '' + buildCommand = '' system=$lib/lib/systemd/system - mkdir -p $system - - cp ${service "fcopy" "file copy (FCOPY)" "hv_fcopy" } $system/hv-fcopy.service - cp ${service "kvp" "key-value pair (KVP)" "" } $system/hv-kvp.service - cp ${service "vss" "volume shadow copy (VSS)" "" } $system/hv-vss.service + install -Dm444 ${service "fcopy" "file copy (FCOPY)" "hv_fcopy" } $system/hv-fcopy.service + install -Dm444 ${service "kvp" "key-value pair (KVP)" "" } $system/hv-kvp.service + install -Dm444 ${service "vss" "volume shadow copy (VSS)" "" } $system/hv-vss.service cat > $system/hyperv-daemons.target <