mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
added install.sh to change
This commit is contained in:
parent
b90077bd78
commit
e110286a13
1 changed files with 24 additions and 21 deletions
|
@ -10,11 +10,11 @@
|
||||||
# curl -L https://install.pivpn.io | bash
|
# curl -L https://install.pivpn.io | bash
|
||||||
# Make sure you have `curl` installed
|
# Make sure you have `curl` installed
|
||||||
|
|
||||||
# timestamp 2020/5/14 15:29BST
|
# timestamp 2020/5/22 12:30BST
|
||||||
|
|
||||||
######## VARIABLES #########
|
######## VARIABLES #########
|
||||||
pivpnGitUrl="https://github.com/pivpn/pivpn.git"
|
#pivpnGitUrl="https://github.com/pivpn/pivpn.git"
|
||||||
#pivpnGitUrl="/home/ubuntu/repos/pivpn"
|
pivpnGitUrl="/home/pi/repos/pivpn"
|
||||||
setupVarsFile="setupVars.conf"
|
setupVarsFile="setupVars.conf"
|
||||||
setupConfigDir="/etc/pivpn"
|
setupConfigDir="/etc/pivpn"
|
||||||
tempsetupVarsFile="/tmp/setupVars.conf"
|
tempsetupVarsFile="/tmp/setupVars.conf"
|
||||||
|
@ -126,9 +126,9 @@ main(){
|
||||||
|
|
||||||
# see which setup already exists
|
# see which setup already exists
|
||||||
if [ -r "${setupConfigDir}/wireguard/${setupVarsFile}" ]; then
|
if [ -r "${setupConfigDir}/wireguard/${setupVarsFile}" ]; then
|
||||||
setupVars="${setupConfigDir}/wireguard/${setupVarsFile}"
|
setupVars="${setupConfigDir}/wireguard/${setupVarsFile}"
|
||||||
elif [ -r "${setupConfigDir}/openvpn/${setupVarsFile}" ]; then
|
elif [ -r "${setupConfigDir}/openvpn/${setupVarsFile}" ]; then
|
||||||
setupVars="${setupConfigDir}/openvpn/${setupVarsFile}"
|
setupVars="${setupConfigDir}/openvpn/${setupVarsFile}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -r "$setupVars" ]; then
|
if [ -r "$setupVars" ]; then
|
||||||
|
@ -244,7 +244,7 @@ askAboutExistingInstall(){
|
||||||
opt3a="Reconfigure"
|
opt3a="Reconfigure"
|
||||||
opt3b="Reinstall PiVPN with new settings"
|
opt3b="Reinstall PiVPN with new settings"
|
||||||
|
|
||||||
UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\nWe have detected an existing install.\n$1\n\nPlease choose from the following options:" ${r} ${c} 3 \
|
UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\nWe have detected an existing install.\n$1\n\nPlease choose from the following options (Reconfigure can be used to add a second VPN type):" ${r} ${c} 3 \
|
||||||
"${opt1a}" "${opt1b}" \
|
"${opt1a}" "${opt1b}" \
|
||||||
"${opt2a}" "${opt2b}" \
|
"${opt2a}" "${opt2b}" \
|
||||||
"${opt3a}" "${opt3b}" 3>&2 2>&1 1>&3) || \
|
"${opt3a}" "${opt3b}" 3>&2 2>&1 1>&3) || \
|
||||||
|
@ -2243,31 +2243,34 @@ installScripts(){
|
||||||
$SUDO install -m 755 -t ${pivpnScriptDir} ${pivpnFilesDir}/scripts/*.sh
|
$SUDO install -m 755 -t ${pivpnScriptDir} ${pivpnFilesDir}/scripts/*.sh
|
||||||
$SUDO install -m 755 -t ${pivpnScriptDir}/${VPN} ${pivpnFilesDir}/scripts/${VPN}/*.sh
|
$SUDO install -m 755 -t ${pivpnScriptDir}/${VPN} ${pivpnFilesDir}/scripts/${VPN}/*.sh
|
||||||
# make a link for a single command being installed
|
# make a link for a single command being installed
|
||||||
$SUDO ln -s -T ${pivpnScriptDir}/${VPN}/pivpn.sh /usr/local/bin/pivpn
|
# may already exist if installing the second protocol
|
||||||
|
if [ ! -e "/usr/local/bin/pivpn" ]; then
|
||||||
|
$SUDO ln -s -T ${pivpnScriptDir}/${VPN}/pivpn.sh /usr/local/bin/pivpn
|
||||||
|
fi
|
||||||
# if the other protocol file exists it has been installed
|
# if the other protocol file exists it has been installed
|
||||||
if [[ ${VPN} == 'wireguard' ]]; then
|
if [[ ${VPN} == 'wireguard' ]]; then
|
||||||
othervpn='openvpn'
|
othervpn='openvpn'
|
||||||
else
|
else
|
||||||
othervpn='wireguard'
|
othervpn='wireguard'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -r "${setupConfigDir}/${othervpn}/${setupVarsFile}" ]; then
|
if [ -r "${setupConfigDir}/${othervpn}/${setupVarsFile}" ]; then
|
||||||
# both are installed
|
# both are installed
|
||||||
# dont need a link, copy the common script to the location instead
|
# dont need a link, copy the common script to the location instead
|
||||||
$SUDO rm -f /usr/local/bin/pivpn
|
$SUDO rm -f /usr/local/bin/pivpn
|
||||||
$SUDO install -m 755 -t /usr/local/bin /${pivpnFilesDir}/scripts/pivpn
|
$SUDO install -m 755 -t /usr/local/bin /${pivpnFilesDir}/scripts/pivpn
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -r "${setupConfigDir}/${othervpn}/${setupVarsFile}" ]; then
|
if [ -r "${setupConfigDir}/${othervpn}/${setupVarsFile}" ]; then
|
||||||
# both are installed, no bash completion, delete if already there
|
# both are installed, no bash completion, delete if already there
|
||||||
$SUDO rm -f /etc/bash_completion.d/pivpn
|
$SUDO rm -f /etc/bash_completion.d/pivpn
|
||||||
else
|
else
|
||||||
# only one protocol is installed, put bash completion in place
|
# only one protocol is installed, put bash completion in place
|
||||||
$SUDO cp "${pivpnFilesDir}/scripts/${VPN}/bash-completion" /etc/bash_completion.d/pivpn
|
$SUDO cp "${pivpnFilesDir}/scripts/${VPN}/bash-completion" /etc/bash_completion.d/pivpn
|
||||||
$SUDO chown root:root /etc/bash_completion.d/pivpn
|
$SUDO chown root:root /etc/bash_completion.d/pivpn
|
||||||
$SUDO chmod 755 /etc/bash_completion.d/pivpn
|
$SUDO chmod 755 /etc/bash_completion.d/pivpn
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
. /etc/bash_completion.d/pivpn
|
. /etc/bash_completion.d/pivpn
|
||||||
fi
|
fi
|
||||||
echo " done."
|
echo " done."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue