Merge pull request #69299 from peterhoeg/f/hv_master

hyperv-daemons: fix binary location to stop error log spam
This commit is contained in:
Peter Hoeg 2019-09-25 04:50:06 +08:00 committed by GitHub
commit da9e40fcc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 <<EOF
[Unit]
@ -102,7 +107,7 @@ in stdenv.mkDerivation {
Microsoft calls their guest agents "Integration Services" which is why
we use that name here.
'';
homepage = https://kernel.org;
homepage = "https://kernel.org";
maintainers = with maintainers; [ peterhoeg ];
platforms = kernel.meta.platforms;
};