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
This commit is contained in:
parent
9562799ec2
commit
ebe2a22bb8
1 changed files with 8 additions and 3 deletions
|
|
@ -57,9 +57,7 @@ fi
|
||||||
|
|
||||||
newclient () {
|
newclient () {
|
||||||
# Where to write the custom client.ovpn?
|
# Where to write the custom client.ovpn?
|
||||||
if [ -e /home/$1 ]; then # if $1 is a user name
|
if [ ${SUDO_USER} ]; then # if not, use SUDO_USER
|
||||||
homeDir="/home/$1"
|
|
||||||
elif [ ${SUDO_USER} ]; then # if not, use SUDO_USER
|
|
||||||
homeDir="/home/${SUDO_USER}"
|
homeDir="/home/${SUDO_USER}"
|
||||||
else # if not SUDO_USER, use /root
|
else # if not SUDO_USER, use /root
|
||||||
homeDir="/root"
|
homeDir="/root"
|
||||||
|
|
@ -191,6 +189,13 @@ if [[ -e /etc/openvpn/server.conf ]]; then
|
||||||
fi
|
fi
|
||||||
rm -rf /etc/openvpn
|
rm -rf /etc/openvpn
|
||||||
rm -rf /usr/share/doc/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 ""
|
||||||
echo "OpenVPN removed!"
|
echo "OpenVPN removed!"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue