dnsname-cni: Use wrapper instead of patch for dnsmasq

The patch proved to be an incomplete solution while developing
nixosTests.podman-dnsname
This commit is contained in:
Robert Hensing 2021-05-31 08:32:21 +02:00
parent 3600a82711
commit 6517779349
2 changed files with 11 additions and 24 deletions

View file

@ -1,4 +1,11 @@
{ buildGoModule, fetchFromGitHub, lib, dnsmasq }:
{
buildGoModule,
dnsmasq,
fetchFromGitHub,
lib,
nixosTests,
makeWrapper,
}:
buildGoModule rec {
pname = "cni-plugin-dnsname";
@ -11,10 +18,9 @@ buildGoModule rec {
sha256 = "090kpq2ppan9ayajdk5vwbvww30nphylgajn2p3441d4jg2nvsm3";
};
patches = [ ./hardcode-dnsmasq-path.patch ];
postPatch = ''
substituteInPlace plugins/meta/dnsname/service.go --replace '@DNSMASQ@' '${dnsmasq}/bin/dnsmasq'
nativeBuildInputs = [ makeWrapper ];
postInstall = ''
wrapProgram $out/bin/dnsname --prefix PATH : ${lib.makeBinPath [ dnsmasq ]}
'';
vendorSha256 = null;

View file

@ -1,19 +0,0 @@
diff --git a/plugins/meta/dnsname/service.go b/plugins/meta/dnsname/service.go
index fc05f75..f6b4caf 100644
--- a/plugins/meta/dnsname/service.go
+++ b/plugins/meta/dnsname/service.go
@@ -16,10 +16,14 @@ import (
// newDNSMasqFile creates a new instance of a dnsNameFile
func newDNSMasqFile(domainName, networkInterface, networkName string) (dnsNameFile, error) {
+ /*
dnsMasqBinary, err := exec.LookPath("dnsmasq")
if err != nil {
return dnsNameFile{}, errors.Errorf("the dnsmasq cni plugin requires the dnsmasq binary be in PATH")
}
+ */
+ _ = errors.Errorf // XXX(mikroskeem): reduce diff
+ dnsMasqBinary := "@DNSMASQ@"
masqConf := dnsNameFile{
ConfigFile: makePath(networkName, confFileName),
Domain: domainName,