diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-22 01:08:51 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-22 16:41:59 +0200 |
commit | b7dca0a8a5bbd9de2b6b499c1344725841c294cc (patch) | |
tree | 950d0b1e6815cf0f8bee025a01f1496c1260125d /contrib/examples/ncat-client-server | |
parent | version: bump snapshot (diff) | |
download | wireguard-monolithic-historical-b7dca0a8a5bbd9de2b6b499c1344725841c294cc.tar.xz wireguard-monolithic-historical-b7dca0a8a5bbd9de2b6b499c1344725841c294cc.zip |
ncat-client-server: do not always call sudo and use env bash
Diffstat (limited to 'contrib/examples/ncat-client-server')
-rwxr-xr-x | contrib/examples/ncat-client-server/client-quick.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/examples/ncat-client-server/client-quick.sh b/contrib/examples/ncat-client-server/client-quick.sh index 25ff615..8ef8f70 100755 --- a/contrib/examples/ncat-client-server/client-quick.sh +++ b/contrib/examples/ncat-client-server/client-quick.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: GPL-2.0 # # Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. @@ -19,7 +19,8 @@ IFS=: read -r status server_pubkey server_port internal_ip <&7 [[ $status == OK ]] || exit 1 echo "[+] Writing config file." -sudo sh -c 'umask 077; mkdir -p /etc/wireguard; cat > /etc/wireguard/demo.conf' <<_EOF +[[ $UID -eq 0 ]] || sudo=sudo +$sudo sh -c 'umask 077; mkdir -p /etc/wireguard; cat > /etc/wireguard/demo.conf' <<_EOF [Interface] PrivateKey = $privatekey Address = $internal_ip/24 |