From 550119bb08262cd8ab60d48e0610dbe109f7531d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 22 May 2018 01:08:51 +0200 Subject: [PATCH] ncat-client-server: do not always call sudo and use env bash Signed-off-by: Jason A. Donenfeld --- contrib/ncat-client-server/client-quick.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/ncat-client-server/client-quick.sh b/contrib/ncat-client-server/client-quick.sh index 25ff615..8ef8f70 100755 --- a/contrib/ncat-client-server/client-quick.sh +++ b/contrib/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 . 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