From c2f385cf4acd1dadca8a780935a99c0ea0d8fba3 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Fri, 13 Dec 2013 09:44:51 +0100 Subject: [PATCH] dhcpcd: make dhcpcd work in linux containers --- pkgs/tools/networking/dhcpcd/default.nix | 2 ++ .../dhcpcd/lxc_ro_promote_secondaries.patch | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 pkgs/tools/networking/dhcpcd/lxc_ro_promote_secondaries.patch diff --git a/pkgs/tools/networking/dhcpcd/default.nix b/pkgs/tools/networking/dhcpcd/default.nix index 9b3b6238420c..ad0b62d19f81 100644 --- a/pkgs/tools/networking/dhcpcd/default.nix +++ b/pkgs/tools/networking/dhcpcd/default.nix @@ -8,6 +8,8 @@ stdenv.mkDerivation rec { sha256 = "1i7fv1l0n7q1mnia7g0789ch63x5zhwk5gsrwvs78dv2f2kmvcd3"; }; + patches = [ ./lxc_ro_promote_secondaries.patch ]; + configureFlags = "--sysconfdir=/etc"; makeFlags = "PREFIX=\${out}"; diff --git a/pkgs/tools/networking/dhcpcd/lxc_ro_promote_secondaries.patch b/pkgs/tools/networking/dhcpcd/lxc_ro_promote_secondaries.patch new file mode 100644 index 000000000000..066ea67db9ee --- /dev/null +++ b/pkgs/tools/networking/dhcpcd/lxc_ro_promote_secondaries.patch @@ -0,0 +1,12 @@ +diff -rupN dhcpcd-6.1.0-old/if-linux.c dhcpcd-6.1.0/if-linux.c +--- dhcpcd-6.1.0-old/if-linux.c 2013-09-20 12:27:24.000000000 +0200 ++++ dhcpcd-6.1.0/if-linux.c 2013-12-13 09:50:24.183694744 +0100 +@@ -86,7 +86,7 @@ if_init(struct interface *iface) + + fp = fopen(path, "w"); + if (fp == NULL) +- return errno == ENOENT ? 0 : -1; ++ return (errno == ENOENT || errno == EROFS) ? 0 : -1; + n = fprintf(fp, "1"); + fclose(fp); + return n == -1 ? -1 : 0;