mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-19 19:30:16 +00:00
uninstall change
This commit is contained in:
parent
f6463b8849
commit
9b04391629
1 changed files with 25 additions and 6 deletions
|
@ -37,10 +37,26 @@ if [ ! -f "${setupVars}" ]; then
|
||||||
echo "::: Missing setup vars file!"
|
echo "::: Missing setup vars file!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "${setupVars}"
|
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
|
### FIXME: introduce global lib
|
||||||
spinner(){
|
spinner(){
|
||||||
local pid=$1
|
local pid=$1
|
||||||
|
@ -98,8 +114,10 @@ removeAll(){
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable IPv4 forwarding
|
# Disable IPv4 forwarding
|
||||||
sed -i '/net.ipv4.ip_forward=1/c\#net.ipv4.ip_forward=1' /etc/sysctl.conf
|
if [ ${vpnStillExists} != 'yes' ]; then
|
||||||
sysctl -p
|
sed -i '/net.ipv4.ip_forward=1/c\#net.ipv4.ip_forward=1' /etc/sysctl.conf
|
||||||
|
sysctl -p
|
||||||
|
fi
|
||||||
|
|
||||||
# Purge dependencies
|
# Purge dependencies
|
||||||
echo "::: Purge dependencies..."
|
echo "::: Purge dependencies..."
|
||||||
|
@ -172,9 +190,10 @@ removeAll(){
|
||||||
rm -rf /etc/pivpn/${VPN}
|
rm -rf /etc/pivpn/${VPN}
|
||||||
rmdir /etc/pivpn
|
rmdir /etc/pivpn
|
||||||
rm -f /var/log/*pivpn*
|
rm -f /var/log/*pivpn*
|
||||||
rm -f /usr/local/bin/pivpn/${VPN}
|
rm -rf /usr/local/bin/pivpn/${VPN}
|
||||||
# TODO fix bash_completion removal
|
if [ ${vpnStillExists} != 'yes' ]; then
|
||||||
rm -f /etc/bash_completion.d/pivpn
|
rm -f /etc/bash_completion.d/pivpn
|
||||||
|
fi
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Removing VPN configuration files..."
|
echo "::: Removing VPN configuration files..."
|
||||||
|
|
Loading…
Reference in a new issue