remove refs to /etc/pivpn/setupVars in selfcheck and debug scripts

tidy indenting
  on install, check if symlink already exists before making one to avoid error
  uninstall indicates which vpns are available for uninstall
  selfcheck checks both protocols if both present
  install - additional text in reconfigure saying 2nd protocol can be added
  change to use pivpn ovpn instaed of pivpn opv when dual protocols exist
This commit is contained in:
shelleycat485 2020-05-22 12:41:02 +01:00
parent e3363a7d98
commit b90077bd78
5 changed files with 86 additions and 37 deletions

View file

@ -1,13 +1,7 @@
#!/bin/bash
setupVars="/etc/pivpn/setupVars.conf"
ERR=0
if [ ! -f "${setupVars}" ]; then
echo "::: Missing setup vars file!"
exit 1
fi
runselfcheck()
{
source "${setupVars}"
if [ "$VPN" = "wireguard" ]; then
@ -162,3 +156,40 @@ fi
if [ "$ERR" -eq 1 ]; then
echo -e "[INFO] Run \e[1mpivpn -d\e[0m again to see if we detect issues"
fi
} # end function
# now there are two places setupVars.conf can be, so check each one
dualprot='no'
setupVars="/etc/pivpn/wireguard/setupVars.conf"
ERR=0
if [ ! -f "${setupVars}" ]; then
echo "::: Missing ${setupVars}i, wireguard not installed"
else
echo "::: Selfcheck for wireguard, config from ${setupVars}"
runselfcheck
dualprot='yes'
fi
setupVars="/etc/pivpn/openvpn/setupVars.conf"
ERR=0
if [ ! -f "${setupVars}" ]; then
echo "::: Missing ${setupVars}, openvpn not installed"
else
echo "::: Selfcheck for openvpn, config from ${setupVars}"
runselfcheck
dualprot='yes'
fi
# add check for a mixed up installation
setupVars="/etc/pivpn/setupVars.conf"
if [ ${dualprot} == 'yes' && -f "${setupVars}" ]; then
echo "::: Older ${setupVars} exists, should not be there,
echo "::: two versions have been installed which are not compatible"
fi