mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
uninstall fixes
This commit is contained in:
parent
969cff7848
commit
b230bade61
1 changed files with 15 additions and 13 deletions
|
@ -31,7 +31,9 @@ c=$(( c < 70 ? 70 : c ))
|
|||
PKG_MANAGER="apt-get"
|
||||
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
||||
dnsmasqConfig="/etc/dnsmasq.d/02-pivpn.conf"
|
||||
setupVars="/etc/pivpn/${VPN}/setupVars.conf"
|
||||
setupConfigDir="/etc/pivpn"
|
||||
setupVarsFile="setupVars.conf"
|
||||
setupVars="${setupConfigDir}/${VPN}/${setupVarsFile}"
|
||||
|
||||
if [ ! -f "${setupVars}" ]; then
|
||||
echo "::: Missing setup vars file!"
|
||||
|
@ -41,21 +43,11 @@ fi
|
|||
# shellcheck disable=SC1090
|
||||
source "${setupVars}"
|
||||
|
||||
# if the other protocol file exists it has been installed
|
||||
if [[ ${VPN} == 'wireguard' ]]; then
|
||||
othervpn='openvpn'
|
||||
else
|
||||
othervpn='wireguard'
|
||||
fi
|
||||
vpnStillExists=no
|
||||
if [ -r "${setupConfigDir}/${othervpn}/${setupVarsFile}" ]; then
|
||||
$SUDO rm -f /usr/local/bin/pivpn
|
||||
$SUDO ln -s -T ${pivpnScriptDir}/${othervpn}/pivpn.sh /usr/local/bin/pivpn
|
||||
vpnStillExists=yes
|
||||
echo ":::"
|
||||
echo "::: Two VPN protocols exist, you should remove the other one too"
|
||||
echo ":::"
|
||||
fi
|
||||
|
||||
### FIXME: introduce global lib
|
||||
spinner(){
|
||||
|
@ -190,8 +182,18 @@ removeAll(){
|
|||
rm -rf /etc/pivpn/${VPN}
|
||||
rmdir /etc/pivpn
|
||||
rm -f /var/log/*pivpn*
|
||||
rm -rf /usr/local/bin/pivpn/${VPN}
|
||||
if [ ${vpnStillExists} != 'yes' ]; then
|
||||
|
||||
vpnStillExists='no'
|
||||
|
||||
if [ -r "${setupConfigDir}/${othervpn}/${setupVarsFile}" ]; then
|
||||
$SUDO rm -f /usr/local/bin/pivpn
|
||||
$SUDO ln -s -T ${pivpnScriptDir}/${othervpn}/pivpn.sh /usr/local/bin/pivpn
|
||||
vpnStillExists='yes'
|
||||
echo ":::"
|
||||
echo "::: Two VPN protocols exist, you should remove the other one too"
|
||||
echo ":::"
|
||||
|
||||
else
|
||||
rm -f /etc/bash_completion.d/pivpn
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue