From ebe2a22bb82b1fb0048940e2d4278a1f15c216f6 Mon Sep 17 00:00:00 2001 From: Angristan Date: Thu, 28 Sep 2017 12:25:54 +0200 Subject: [PATCH] Remove .ovpn config files after uninstalling OpenVPN Also remove the if $1 = user. I prefer to put all the config files in the same directory --- openvpn-install.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 56b436c..0c7efef 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -57,9 +57,7 @@ fi newclient () { # Where to write the custom client.ovpn? - if [ -e /home/$1 ]; then # if $1 is a user name - homeDir="/home/$1" - elif [ ${SUDO_USER} ]; then # if not, use SUDO_USER + if [ ${SUDO_USER} ]; then # if not, use SUDO_USER homeDir="/home/${SUDO_USER}" else # if not SUDO_USER, use /root homeDir="/root" @@ -191,6 +189,13 @@ if [[ -e /etc/openvpn/server.conf ]]; then fi rm -rf /etc/openvpn rm -rf /usr/share/doc/openvpn* + # Where are the client files? + if [ ${SUDO_USER} ]; then # if not, use SUDO_USER + homeDir="/home/${SUDO_USER}" + else # if not SUDO_USER, use /root + homeDir="/root" + fi + rm $homeDir*/.ovpn echo "" echo "OpenVPN removed!" else