better uninstall.sh

This commit is contained in:
shelleycat485 2020-05-13 00:51:45 +01:00
parent be3ee13586
commit 4e3a57b9aa
2 changed files with 23 additions and 20 deletions

View file

@ -9,11 +9,11 @@
#
# curl -L https://install.pivpn.io | bash
# Make sure you have `curl` installed
# timestamp 2020/5/11 16:48BST
# timestamp 2020/5/13 00:51BST
######## VARIABLES #########
#pivpnGitUrl="https://github.com/pivpn/pivpn.git"
pivpnGitUrl="/home/ubuntu/repos/pivpn"
pivpnGitUrl="/home/pi/repos/pivpn"
setupVarsFile="setupVars.conf"
setupConfigDir="/etc/pivpn"
tempsetupVarsFile="/tmp/setupVars.conf"

View file

@ -112,7 +112,7 @@ removeAll(){
$SUDO rm -f /usr/local/bin/pivpn
$SUDO ln -s -T /opt/pivpn/${othervpn}/pivpn.sh /usr/local/bin/pivpn
echo ":::"
echo "::: Two VPN protocols exist, you should remove the other one too"
echo "::: Two VPN protocols exist, you should remove ${othervpn} too"
echo ":::"
else
@ -179,24 +179,12 @@ removeAll(){
printf "::: Auto cleaning remaining dependencies..."
$PKG_MANAGER -y autoclean &> /dev/null & spinner $!; printf "done!\\n";
echo ":::"
# Removing pivpn files
echo "::: Removing pivpn system files..."
if [ -f "$dnsmasqConfig" ]; then
rm -f "$dnsmasqConfig"
pihole restartdns
fi
rm -rf /opt/pivpn/${VPN}
# if dual installation, other installation will cause next line to fail
rmdir /opt/pivpn
rm -rf /etc/.pivpn/${VPN}
rmdir /etc/.pivpn
rm -rf /etc/pivpn/${VPN}
rmdir /etc/pivpn
rm -f /var/log/*pivpn*
echo ":::"
echo "::: Removing VPN configuration files..."
@ -215,6 +203,21 @@ removeAll(){
rm -rf "$install_home/ovpns"
fi
if [ ${vpnStillExists} == 'no' ]; then
echo ":::"
echo "::: Removing pivpn system files..."
rm -rf /etc/.pivpn
rm -rf /etc/pivpn
rm -f /var/log/*pivpn*
rm -rf /opt/pivpn
rm -f /usr/local/bin/pivpn
else
echo ":::"
echo "::: Other protocol still present, so not"
echo "::: removing pivpn system files"
rm -f "${setupConfigDir}/${VPN}/${setupVarsFile}"
fi
echo ":::"
printf "::: Finished removing PiVPN from your system.\\n"
printf "::: Reinstall by simpling running\\n:::\\n:::\\tcurl -L https://install.pivpn.io | bash\\n:::\\n::: at any time!\\n:::\\n"