1
0
Fork 0
mirror of https://github.com/pivpn/pivpn.git synced 2024-12-29 08:12:18 +00:00

after ubuntu testing

This commit is contained in:
Ubuntu 2020-05-10 16:37:30 +00:00
parent e41ccdaf6f
commit 501b9919a8

View file

@ -12,9 +12,9 @@
######## VARIABLES ######### ######## VARIABLES #########
#pivpnGitUrl="https://github.com/pivpn/pivpn.git" #pivpnGitUrl="https://github.com/pivpn/pivpn.git"
pivpnGitUrl="/root/repos/pivpn" pivpnGitUrl="/home/ubuntu/repos/pivpn"
setupVarsFile="setupVars.conf" setupVarsFile="setupVars.conf"
setupConfigDir="/etc/pivpn" # will be /etc/pivpn/${VPN}/setupVars.conf setupConfigDir="/etc/pivpn"
tempsetupVarsFile="/tmp/setupVars.conf" tempsetupVarsFile="/tmp/setupVars.conf"
pivpnFilesDir="/etc/.pivpn" pivpnFilesDir="/etc/.pivpn"
pivpnScriptDir="/opt/pivpn" pivpnScriptDir="/opt/pivpn"
@ -123,13 +123,13 @@ main(){
fi fi
# see which setup already exists # see which setup already exists
if [ -r "${setupVarsDir}/wireguard/${setupVarsFile}" ]; then if [ -r "${setupConfigDir}/wireguard/${setupVarsFile}" ]; then
setupVars="${setupVarsDir}/wireguard/${setupVarsFile}" setupVars="${setupConfigDir}/wireguard/${setupVarsFile}"
elif [ -f "${setupVarsDir}/openvpn/${setupVarsFile}" ]; then elif [ -r "${setupConfigDir}/openvpn/${setupVarsFile}" ]; then
setupVars="${setupVarsDir}/openvpn/${setupVarsFile}" setupVars="${setupConfigDir}/openvpn/${setupVarsFile}"
fi fi
if [ -r "$setupVars" ]; then #qqq if [ -r "$setupVars" ]; then
if [[ "${reconfigure}" == true ]]; then if [[ "${reconfigure}" == true ]]; then
echo "::: --reconfigure passed to install script, will reinstall PiVPN overwriting existing settings" echo "::: --reconfigure passed to install script, will reinstall PiVPN overwriting existing settings"
UpdateCmd="Reconfigure" UpdateCmd="Reconfigure"
@ -137,7 +137,7 @@ main(){
### What should the script do when passing --unattended to an existing installation? ### What should the script do when passing --unattended to an existing installation?
UpdateCmd="Reconfigure" UpdateCmd="Reconfigure"
else else
askAboutExistingInstall askAboutExistingInstall ${setupVars}
fi fi
fi fi
@ -148,7 +148,7 @@ main(){
exit 0 exit 0
elif [ "$UpdateCmd" = "Repair" ]; then elif [ "$UpdateCmd" = "Repair" ]; then
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "$setupVars" #qqq source "$setupVars"
runUnattended=true runUnattended=true
fi fi
@ -242,7 +242,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\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:" ${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) || \
@ -2235,15 +2235,11 @@ confUnattendedUpgrades(){
installScripts(){ installScripts(){
# Install the scripts from /etc/.pivpn to their various locations # Install the scripts from /etc/.pivpn to their various locations
echo -n -e "::: Installing scripts to ${pivpnScriptDir}...\n" echo -n -e "::: Installing scripts to ${pivpnScriptDir}...\n"
echo "::: line ${LINENO}"
if [ ! -d "${pivpnScriptDir}/${VPN}" ]; then if [ ! -d "${pivpnScriptDir}/${VPN}" ]; then
$SUDO install -m 0755 -o root -d ${pivpnScriptDir}/${VPN} $SUDO install -m 0755 -o root -d ${pivpnScriptDir}/${VPN}
# $SUDO mkdir -p ${pivpnScriptDir}/${VPN}
# $SUDO chown -R root:root ${pivpnScriptDir}
# $SUDO chmod -R 0755 ${pivpnScriptDir}
fi fi
$SUDO install -v -m 755 -t ${pivpnScriptDir} ${pivpnFilesDir}/scripts/*.sh $SUDO install -m 755 -t ${pivpnScriptDir} ${pivpnFilesDir}/scripts/*.sh
$SUDO install -v -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 $SUDO ln -s -T ${pivpnScriptDir}/${VPN}/pivpn.sh /usr/local/bin/pivpn
# if the other protocol file exists it has been installed # if the other protocol file exists it has been installed
@ -2255,14 +2251,13 @@ installScripts(){
if [ -r "${setupConfigDir}/${othervpn}/${setupVarsFile}" ]; then if [ -r "${setupConfigDir}/${othervpn}/${setupVarsFile}" ]; then
# 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 -v -m 755 -t /usr/local/bin /${pivpnFilesDir}/scripts/pivpn $SUDO install -m 755 -t /usr/local/bin /${pivpnFilesDir}/scripts/pivpn
fi fi
$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
echo "::: line ${LINENO}"
echo " done." echo " done."
} }