]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: use invoking shell in auto rooting
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 16 May 2018 17:19:48 +0000 (19:19 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 16 May 2018 17:19:48 +0000 (19:19 +0200)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/darwin.bash
src/wg-quick/linux.bash

index 0eef3d94c35eeb196ade9d55ddd61477b8e0e3bc..581954c20c51a2c15686399eefd024db459ffe2c 100755 (executable)
@@ -9,6 +9,7 @@ shopt -s extglob
 export LC_ALL=C
 
 SELF="${BASH_SOURCE[0]}"
+[[ $SELF == */* ]] || SELF="./$SELF"
 SELF="$(cd "${SELF%/*}" && pwd -P)/${SELF##*/}"
 export PATH="${SELF%/*}:$PATH"
 
@@ -82,7 +83,7 @@ read_bool() {
 }
 
 auto_su() {
-       [[ $UID == 0 ]] || exec sudo -p "$PROGRAM must be run as root. Please enter the password for %u to continue: " "$SELF" "${ARGS[@]}"
+       [[ $UID == 0 ]] || exec sudo -p "$PROGRAM must be run as root. Please enter the password for %u to continue: " -- "$BASH" -- "$SELF" "${ARGS[@]}"
 }
 
 get_real_interface() {
index 9139e7f68ea06583db607ee871f53cf9d9d3a8db..3f1976ba766ead0b43d665d3d2bd9b80acadfc12 100755 (executable)
@@ -79,7 +79,7 @@ read_bool() {
 }
 
 auto_su() {
-       [[ $UID == 0 ]] || exec sudo -p "$PROGRAM must be run as root. Please enter the password for %u to continue: " "$SELF" "${ARGS[@]}"
+       [[ $UID == 0 ]] || exec sudo -p "$PROGRAM must be run as root. Please enter the password for %u to continue: " -- "$BASH" -- "$SELF" "${ARGS[@]}"
 }
 
 add_if() {