making wireguard work on RHEL7/etc.

Jason A. Donenfeld Jason at zx2c4.com
Tue Jun 27 21:59:07 CEST 2017


On Tue, Jun 27, 2017 at 08:43:30PM +0100, wireguard at wut.to wrote:
> GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)

Arg. Looks like namerefs were only added in bash 4.3. Annoying. The
fix looks something like this, but it's so ugly and bothers me:

diff --git a/src/tools/wg-quick.bash b/src/tools/wg-quick.bash
index 6edcd3a..5325f9d 100755
--- a/src/tools/wg-quick.bash
+++ b/src/tools/wg-quick.bash
@@ -54,10 +54,9 @@ parse_options() {
 }
 
 read_bool() {
-	local -n out="$1"
 	case "$2" in
-	true) out=1 ;;
-	false) out=0 ;;
+	true) eval "$1=1" ;;
+	false) eval "$1=0" ;;
 	*) die "\`$2' is neither true nor false"
 	esac
 }


Not sure whether or not I'll merge it yet.


More information about the WireGuard mailing list