update-systemd-resolved: inject PATH to avoid wrapping
This commit is contained in:
parent
764c88feac
commit
adbf08f9ec
@ -1,34 +1,42 @@
|
||||
{ lib, stdenv, fetchFromGitHub
|
||||
, makeWrapper
|
||||
, iproute2, systemd, coreutils, util-linux }:
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, iproute2
|
||||
, runtimeShell
|
||||
, systemd
|
||||
, coreutils
|
||||
, util-linux
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "update-systemd-resolved";
|
||||
# when updating this, check if additional binaries need injecting into PATH
|
||||
version = "1.3.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "jonathanio";
|
||||
repo = "update-systemd-resolved";
|
||||
rev = "v${version}";
|
||||
sha256 = "19zhbpyms57yb70hi0ws5sbkpk2yqp9nnix3f86r36h1g93m70lm";
|
||||
hash = "sha256-lYJTR3oBmpENcqNHa9PFXsw7ly6agwjBWf4UXf1d8Kc=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
buildFlags = [
|
||||
"PREFIX=${placeholder "out"}/libexec/openvpn"
|
||||
# set SCRIPT_NAME in case we are wrapped and inject PATH
|
||||
patches = [
|
||||
./update-systemd-resolved.patch
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
wrapProgram $out/libexec/openvpn/update-systemd-resolved \
|
||||
--prefix PATH : ${lib.makeBinPath [ iproute2 systemd coreutils util-linux ]}
|
||||
PREFIX = "${placeholder "out"}/libexec/openvpn";
|
||||
|
||||
postInstall = ''
|
||||
substituteInPlace ${PREFIX}/update-systemd-resolved \
|
||||
--subst-var-by PATH ${lib.makeBinPath [ coreutils iproute2 runtimeShell systemd util-linux ]}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Helper script for OpenVPN to directly update the DNS settings of a link through systemd-resolved via DBus";
|
||||
homepage = "https://github.com/jonathanio/update-systemd-resolved";
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ eadwu ];
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.unix;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
26
pkgs/tools/networking/openvpn/update-systemd-resolved.patch
Normal file
26
pkgs/tools/networking/openvpn/update-systemd-resolved.patch
Normal file
@ -0,0 +1,26 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 524b6b7..8a880f1 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -9,7 +9,6 @@ all: install info
|
||||
|
||||
install:
|
||||
@install -Dm750 $(SRC) $(DEST)
|
||||
- @install -Dm644 $(SRC).conf $(DEST).conf
|
||||
|
||||
info:
|
||||
@printf 'Successfully installed %s to %s.\n' $(SRC) $(DEST)
|
||||
diff --git a/update-systemd-resolved b/update-systemd-resolved
|
||||
index 1452e1a..39641cb 100755
|
||||
--- a/update-systemd-resolved
|
||||
+++ b/update-systemd-resolved
|
||||
@@ -29,7 +29,8 @@
|
||||
DBUS_DEST="org.freedesktop.resolve1"
|
||||
DBUS_NODE="/org/freedesktop/resolve1"
|
||||
|
||||
-SCRIPT_NAME="${BASH_SOURCE[0]##*/}"
|
||||
+PATH="@PATH@"
|
||||
+SCRIPT_NAME="update-systemd-resolved"
|
||||
|
||||
log() {
|
||||
logger -s -t "$SCRIPT_NAME" "$@"
|
Loading…
Reference in New Issue
Block a user