diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-21 04:08:23 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-21 16:43:56 +0200 |
commit | ec1323b231004c7bcb6f9e194f8e1799b56f212e (patch) | |
tree | 1a0d52e6d904daa0c226fba0ca9ebd5845900045 /contrib/examples/systemd-resolved | |
parent | compat: work around qcom 4.9 backports (diff) | |
download | wireguard-monolithic-historical-ec1323b231004c7bcb6f9e194f8e1799b56f212e.tar.xz wireguard-monolithic-historical-ec1323b231004c7bcb6f9e194f8e1799b56f212e.zip |
contrib: add systemd-resolved workaround script
This is for systems that don't have systemd 239, which supports
resolvconf.
Diffstat (limited to 'contrib/examples/systemd-resolved')
-rw-r--r-- | contrib/examples/systemd-resolved/README | 8 | ||||
-rwxr-xr-x | contrib/examples/systemd-resolved/apply.sh | 9 | ||||
-rw-r--r-- | contrib/examples/systemd-resolved/systemd-resolve.bash | 11 |
3 files changed, 28 insertions, 0 deletions
diff --git a/contrib/examples/systemd-resolved/README b/contrib/examples/systemd-resolved/README new file mode 100644 index 0000000..4f262b8 --- /dev/null +++ b/contrib/examples/systemd-resolved/README @@ -0,0 +1,8 @@ +systemd-resolved(8) support for wg-quick(8) +=========================================== + +This is a stop gap solution until systemd 239 comes out with resolvconf +emulation. Running 'apply.sh` in this directory will insert 'systemd-resolve.bash` +into the right place in 'wg-quick.bash`. It is recommended that distributions +who use systemd-resolved by default run this before calling 'make install` in +their packaging scripts. diff --git a/contrib/examples/systemd-resolved/apply.sh b/contrib/examples/systemd-resolved/apply.sh new file mode 100755 index 0000000..7340eea --- /dev/null +++ b/contrib/examples/systemd-resolved/apply.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. + +ME="$(readlink -f "$(dirname "$(readlink -f "$0")")")" +TOOLS="$ME/../../../src/tools" + +sed -i "/~~ function override insertion point ~~/r $ME/systemd-resolve.bash" "$TOOLS/wg-quick/linux.bash" diff --git a/contrib/examples/systemd-resolved/systemd-resolve.bash b/contrib/examples/systemd-resolved/systemd-resolve.bash new file mode 100644 index 0000000..4ea1cf9 --- /dev/null +++ b/contrib/examples/systemd-resolved/systemd-resolve.bash @@ -0,0 +1,11 @@ +set_dns() { + [[ ${#DNS[@]} -gt 0 ]] || return 0 + cmd systemd-resolve --interface="$INTERFACE" "${DNS[@]/#/--set-dns=}" --set-domain=~. + HAVE_SET_DNS=1 +} + +unset_dns() { + # We don't need to call --revert here, since the interface is being deleted + # anyway, and systemd-resolved knows about that. + return 0 +} |