aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/contrib/examples/ncat-client-server
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 01:08:51 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 16:41:59 +0200
commitb7dca0a8a5bbd9de2b6b499c1344725841c294cc (patch)
tree950d0b1e6815cf0f8bee025a01f1496c1260125d /contrib/examples/ncat-client-server
parentversion: bump snapshot (diff)
downloadwireguard-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 '')
-rwxr-xr-xcontrib/examples/ncat-client-server/client-quick.sh5
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