hyperv-daemons: fix binary location to stop error log spam

This commit is contained in:
Peter Hoeg 2018-05-28 13:50:05 +08:00
parent 67202a95ba
commit a5872e8bde

View File

@ -1,7 +1,10 @@
{ stdenv, lib, python, kernel, makeWrapper, writeText }: { stdenv, lib, python, kernel, makeWrapper, writeText
, gawk, iproute }:
let let
daemons = stdenv.mkDerivation { libexec = "libexec/hypervkvpd";
daemons = stdenv.mkDerivation rec {
pname = "hyperv-daemons-bin"; pname = "hyperv-daemons-bin";
inherit (kernel) src version; inherit (kernel) src version;
@ -10,10 +13,15 @@ let
# as of 4.9 compilation will fail due to -Werror=format-security # as of 4.9 compilation will fail due to -Werror=format-security
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
preConfigure = '' postPatch = ''
cd tools/hv 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 = '' installPhase = ''
runHook preInstall runHook preInstall
@ -21,7 +29,9 @@ let
install -Dm755 hv_''${f}_daemon -t $out/bin install -Dm755 hv_''${f}_daemon -t $out/bin
done 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 # I don't know why this isn't being handled automatically by fixupPhase
substituteInPlace $out/bin/lsvmbus \ substituteInPlace $out/bin/lsvmbus \
@ -31,8 +41,8 @@ let
''; '';
postFixup = '' postFixup = ''
# kvp needs to be able to find the script(s) wrapProgram $out/bin/hv_kvp_daemon \
wrapProgram $out/bin/hv_kvp_daemon --prefix PATH : $out/bin --prefix PATH : $out/bin:${lib.makeBinPath [ gawk iproute ]}
''; '';
}; };
@ -56,24 +66,19 @@ let
in stdenv.mkDerivation { in stdenv.mkDerivation {
pname = "hyperv-daemons"; pname = "hyperv-daemons";
inherit (kernel) version; inherit (kernel) version;
# we just stick the bins into out as well as it requires "out" # we just stick the bins into out as well as it requires "out"
outputs = [ "bin" "lib" "out" ]; outputs = [ "bin" "lib" "out" ];
phases = [ "installPhase" ];
buildInputs = [ daemons ]; buildInputs = [ daemons ];
installPhase = '' buildCommand = ''
system=$lib/lib/systemd/system system=$lib/lib/systemd/system
mkdir -p $system 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
cp ${service "fcopy" "file copy (FCOPY)" "hv_fcopy" } $system/hv-fcopy.service install -Dm444 ${service "vss" "volume shadow copy (VSS)" "" } $system/hv-vss.service
cp ${service "kvp" "key-value pair (KVP)" "" } $system/hv-kvp.service
cp ${service "vss" "volume shadow copy (VSS)" "" } $system/hv-vss.service
cat > $system/hyperv-daemons.target <<EOF cat > $system/hyperv-daemons.target <<EOF
[Unit] [Unit]
@ -102,7 +107,7 @@ in stdenv.mkDerivation {
Microsoft calls their guest agents "Integration Services" which is why Microsoft calls their guest agents "Integration Services" which is why
we use that name here. we use that name here.
''; '';
homepage = https://kernel.org; homepage = "https://kernel.org";
maintainers = with maintainers; [ peterhoeg ]; maintainers = with maintainers; [ peterhoeg ];
platforms = kernel.meta.platforms; platforms = kernel.meta.platforms;
}; };