mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-20 03:40:17 +00:00
still debugging dual
This commit is contained in:
parent
21d954167c
commit
081bf912c2
3 changed files with 66 additions and 5 deletions
|
@ -2244,8 +2244,19 @@ installScripts(){
|
||||||
fi
|
fi
|
||||||
$SUDO install -v -m 755 -t ${pivpnScriptDir} ${pivpnFilesDir}/scripts/*.sh
|
$SUDO install -v -m 755 -t ${pivpnScriptDir} ${pivpnFilesDir}/scripts/*.sh
|
||||||
$SUDO install -v -m 755 -t ${pivpnScriptDir}/${VPN} ${pivpnFilesDir}/scripts/${VPN}/*.sh
|
$SUDO install -v -m 755 -t ${pivpnScriptDir}/${VPN} ${pivpnFilesDir}/scripts/${VPN}/*.sh
|
||||||
$SUDO install -v -m 755 -t /usr/local/bin /${pivpnFilesDir}/scripts/pivpn
|
# line for the single command being installed
|
||||||
$SUDO cp "${pivpnFilesDir}/scripts/${VPN}/bash-completion" /etc/bash_completion.d/pivpn
|
$SUDO ln -s -T ${pivpnFilesDir}/scripts/${VPN}/pivpn pivpn
|
||||||
|
# if the other protocol file exists
|
||||||
|
if [ ${VPN} -eq 'wireguard' ]; then
|
||||||
|
othervpn='openvpn'
|
||||||
|
else
|
||||||
|
othervpn='wireguard'
|
||||||
|
fi
|
||||||
|
if [ -r "${setupConfigDir}/${othervpn}/${setupVarsFile} ] then;
|
||||||
|
# dont need a link, copy the common script to the location instead
|
||||||
|
$SUDO install -v -m 755 -t /usr/local/bin /${pivpnFilesDir}/scripts/pivpn
|
||||||
|
fi
|
||||||
|
$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
|
||||||
|
|
|
@ -2,7 +2,32 @@
|
||||||
|
|
||||||
backupdir=pivpnbackup
|
backupdir=pivpnbackup
|
||||||
date=$(date +%Y%m%d-%H%M%S)
|
date=$(date +%Y%m%d-%H%M%S)
|
||||||
setupVars="/etc/pivpn/setupVars.conf"
|
|
||||||
|
# Find the rows and columns. Will default to 80x24 if it can not be detected.
|
||||||
|
screen_size=$(stty size 2>/dev/null || echo 24 80)
|
||||||
|
rows=$(echo "$screen_size" | awk '{print $1}')
|
||||||
|
columns=$(echo "$screen_size" | awk '{print $2}')
|
||||||
|
|
||||||
|
# Divide by two so the dialogs take up half of the screen, which looks nice.
|
||||||
|
r=$(( rows / 2 ))
|
||||||
|
c=$(( columns / 2 ))
|
||||||
|
# Unless the screen is tiny
|
||||||
|
r=$(( r < 20 ? 20 : r ))
|
||||||
|
c=$(( c < 70 ? 70 : c ))
|
||||||
|
|
||||||
|
chooseVPNCmd=(whiptail --backtitle "Setup PiVPN" --title "Installation mode" --separate-output --radiolist "Choose a VPN to update (press space to select):" "${r}" "${c}" 2)
|
||||||
|
VPNChooseOptions=(WireGuard "" on
|
||||||
|
OpenVPN "" off)
|
||||||
|
|
||||||
|
if VPN=$("${chooseVPNCmd[@]}" "${VPNChooseOptions[@]}" 2>&1 >/dev/tty) ; then
|
||||||
|
echo "::: Using VPN: $VPN"
|
||||||
|
VPN="${VPN,,}"
|
||||||
|
else
|
||||||
|
echo "::: Cancel selected, exiting...."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
setupVars="/etc/pivpn/${VPN}/setupVars.conf"
|
||||||
|
|
||||||
if [ ! -f "${setupVars}" ]; then
|
if [ ! -f "${setupVars}" ]; then
|
||||||
echo "::: Missing setup vars file!"
|
echo "::: Missing setup vars file!"
|
||||||
|
|
|
@ -6,7 +6,32 @@ pivpnrepo="https://github.com/pivpn/pivpn.git"
|
||||||
pivpnlocalpath="/etc/.pivpn"
|
pivpnlocalpath="/etc/.pivpn"
|
||||||
pivpnscripts="/opt/pivpn/"
|
pivpnscripts="/opt/pivpn/"
|
||||||
bashcompletiondir="/etc/bash_completion.d/"
|
bashcompletiondir="/etc/bash_completion.d/"
|
||||||
setupVars="/etc/pivpn/setupVars.conf"
|
|
||||||
|
# Find the rows and columns. Will default to 80x24 if it can not be detected.
|
||||||
|
screen_size=$(stty size 2>/dev/null || echo 24 80)
|
||||||
|
rows=$(echo "$screen_size" | awk '{print $1}')
|
||||||
|
columns=$(echo "$screen_size" | awk '{print $2}')
|
||||||
|
|
||||||
|
# Divide by two so the dialogs take up half of the screen, which looks nice.
|
||||||
|
r=$(( rows / 2 ))
|
||||||
|
c=$(( columns / 2 ))
|
||||||
|
# Unless the screen is tiny
|
||||||
|
r=$(( r < 20 ? 20 : r ))
|
||||||
|
c=$(( c < 70 ? 70 : c ))
|
||||||
|
|
||||||
|
chooseVPNCmd=(whiptail --backtitle "Setup PiVPN" --title "Installation mode" --separate-output --radiolist "Choose a VPN to update (press space to select):" "${r}" "${c}" 2)
|
||||||
|
VPNChooseOptions=(WireGuard "" on
|
||||||
|
OpenVPN "" off)
|
||||||
|
|
||||||
|
if VPN=$("${chooseVPNCmd[@]}" "${VPNChooseOptions[@]}" 2>&1 >/dev/tty) ; then
|
||||||
|
echo "::: Using VPN: $VPN"
|
||||||
|
VPN="${VPN,,}"
|
||||||
|
else
|
||||||
|
echo "::: Cancel selected, exiting...."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
setupVars="/etc/pivpn/${VPN}/setupVars.conf"
|
||||||
|
|
||||||
if [ ! -f "${setupVars}" ]; then
|
if [ ! -f "${setupVars}" ]; then
|
||||||
echo "::: Missing setup vars file!"
|
echo "::: Missing setup vars file!"
|
||||||
|
|
Loading…
Reference in a new issue