mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
changes for devuan
- To simplify further additions to PLAT or OSCN, use the case command for checking - Treat Devuan as Debian - Add /sbin:/usr/sbin to PATH before calling ifconfig - Ensure net-tools is installed so we have ifconfig
This commit is contained in:
parent
a4cff2b65f
commit
2eb11cad0c
1 changed files with 110 additions and 85 deletions
|
@ -61,14 +61,14 @@ dhcpcdFile=/etc/dhcpcd.conf
|
||||||
# Next see if we are on a tested and supported OS
|
# Next see if we are on a tested and supported OS
|
||||||
function noOS_Support() {
|
function noOS_Support() {
|
||||||
whiptail --msgbox --backtitle "INVALID OS DETECTED" --title "Invalid OS" "We have not been able to detect a supported OS.
|
whiptail --msgbox --backtitle "INVALID OS DETECTED" --title "Invalid OS" "We have not been able to detect a supported OS.
|
||||||
Currently this installer supports Raspbian jessie, Ubuntu 14.04 (trusty), and Ubuntu 16.04 (xenial).
|
Currently this installer supports Raspbian (or Devuan) jessie, Ubuntu 14.04 (trusty), and Ubuntu 16.04 (xenial).
|
||||||
If you think you received this message in error, you can post an issue on the GitHub at https://github.com/pivpn/pivpn/issues." ${r} ${c}
|
If you think you received this message in error, you can post an issue on the GitHub at https://github.com/pivpn/pivpn/issues." ${r} ${c}
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function maybeOS_Support() {
|
function maybeOS_Support() {
|
||||||
if (whiptail --backtitle "Not Supported OS" --title "Not Supported OS" --yesno "You are on an OS that we have not tested but MAY work.
|
if (whiptail --backtitle "Not Supported OS" --title "Not Supported OS" --yesno "You are on an OS that we have not tested but MAY work.
|
||||||
Currently this installer supports Raspbian jessie, Ubuntu 14.04 (trusty), and Ubuntu 16.04 (xenial).
|
Currently this installer supports Raspbian (or Devuan) jessie, Ubuntu 14.04 (trusty), and Ubuntu 16.04 (xenial).
|
||||||
Would you like to continue anyway?" ${r} ${c}) then
|
Would you like to continue anyway?" ${r} ${c}) then
|
||||||
echo "::: Did not detect perfectly supported OS but,"
|
echo "::: Did not detect perfectly supported OS but,"
|
||||||
echo "::: Continuing installation at user's own risk..."
|
echo "::: Continuing installation at user's own risk..."
|
||||||
|
@ -84,16 +84,23 @@ distro_check() {
|
||||||
if hash lsb_release 2>/dev/null; then
|
if hash lsb_release 2>/dev/null; then
|
||||||
PLAT=$(lsb_release -si)
|
PLAT=$(lsb_release -si)
|
||||||
OSCN=$(lsb_release -sc) # We want this to be trusty xenial or jessie
|
OSCN=$(lsb_release -sc) # We want this to be trusty xenial or jessie
|
||||||
|
|
||||||
if [[ $PLAT == "Ubuntu" || $PLAT == "Raspbian" || $PLAT == "Debian" ]]; then
|
case ${PLAT} in
|
||||||
if [[ $OSCN != "trusty" && $OSCN != "xenial" && $OSCN != "jessie" ]]; then
|
Ubuntu|Raspbian|Debian|Devuan)
|
||||||
maybeOS_Support
|
case ${OSCN} in
|
||||||
fi
|
trusty|xenial|jessie)
|
||||||
else
|
;;
|
||||||
|
*)
|
||||||
|
maybeOS_Support
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
noOS_Support
|
noOS_Support
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
# else get info from os-release
|
# else get info from os-release
|
||||||
elif grep -q debian /etc/os-release; then
|
elif grep -q -e debian -e devuan /etc/os-release; then
|
||||||
if grep -q jessie /etc/os-release; then
|
if grep -q jessie /etc/os-release; then
|
||||||
PLAT="Raspbian"
|
PLAT="Raspbian"
|
||||||
OSCN="jessie"
|
OSCN="jessie"
|
||||||
|
@ -106,7 +113,7 @@ distro_check() {
|
||||||
else
|
else
|
||||||
noOS_Support
|
noOS_Support
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${PLAT}" > /tmp/DET_PLATFORM
|
echo "${PLAT}" > /tmp/DET_PLATFORM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,6 +362,7 @@ setStaticIPv4() {
|
||||||
|
|
||||||
setNetwork() {
|
setNetwork() {
|
||||||
# Sets the Network IP and Mask correctly
|
# Sets the Network IP and Mask correctly
|
||||||
|
export PATH=${PATH}:/sbin:/usr/sbin
|
||||||
LOCALMASK=$(ifconfig "${pivpnInterface}" | awk '/Mask:/{ print $4;} ' | cut -c6-)
|
LOCALMASK=$(ifconfig "${pivpnInterface}" | awk '/Mask:/{ print $4;} ' | cut -c6-)
|
||||||
LOCALIP=$(ifconfig "${pivpnInterface}" | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*')
|
LOCALIP=$(ifconfig "${pivpnInterface}" | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*')
|
||||||
IFS=. read -r i1 i2 i3 i4 <<< "$LOCALIP"
|
IFS=. read -r i1 i2 i3 i4 <<< "$LOCALIP"
|
||||||
|
@ -420,15 +428,19 @@ update_package_cache() {
|
||||||
timestampAsDate=$(date -d @"${timestamp}" "+%b %e")
|
timestampAsDate=$(date -d @"${timestamp}" "+%b %e")
|
||||||
today=$(date "+%b %e")
|
today=$(date "+%b %e")
|
||||||
|
|
||||||
if [[ ${PLAT} == "Ubuntu" || ${PLAT} == "Debian" ]]; then
|
case ${PLAT} in
|
||||||
if [[ ${OSCN} == "trusty" || ${OSCN} == "jessie" || ${OSCN} == "wheezy" ]]; then
|
Ubuntu|Debian|Devuan)
|
||||||
wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg| $SUDO apt-key add -
|
case ${OSCN} in
|
||||||
echo "deb http://swupdate.openvpn.net/apt $OSCN main" | $SUDO tee /etc/apt/sources.list.d/swupdate.openvpn.net.list > /dev/null
|
trusty|jessie|wheezy)
|
||||||
echo -n "::: Adding OpenVPN repo for $PLAT $OSCN ..."
|
wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg| $SUDO apt-key add -
|
||||||
$SUDO apt-get -qq update & spinner $!
|
echo "deb http://swupdate.openvpn.net/apt $OSCN main" | $SUDO tee /etc/apt/sources.list.d/swupdate.openvpn.net.list > /dev/null
|
||||||
echo " done!"
|
echo -n "::: Adding OpenVPN repo for $PLAT $OSCN ..."
|
||||||
fi
|
$SUDO apt-get -qq update & spinner $!
|
||||||
fi
|
echo " done!"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ ! "${today}" == "${timestampAsDate}" ]; then
|
if [ ! "${today}" == "${timestampAsDate}" ]; then
|
||||||
#update package lists
|
#update package lists
|
||||||
|
@ -489,11 +501,14 @@ stopServices() {
|
||||||
# Stop openvpn
|
# Stop openvpn
|
||||||
$SUDO echo ":::"
|
$SUDO echo ":::"
|
||||||
$SUDO echo -n "::: Stopping OpenVPN service..."
|
$SUDO echo -n "::: Stopping OpenVPN service..."
|
||||||
if [[ $PLAT == "Ubuntu" || $PLAT == "Debian" ]]; then
|
case ${PLAT} in
|
||||||
$SUDO service openvpn stop || true
|
Ubuntu|Debian|Devuan)
|
||||||
else
|
$SUDO service openvpn stop || true
|
||||||
$SUDO systemctl stop openvpn.service || true
|
;;
|
||||||
fi
|
*)
|
||||||
|
$SUDO systemctl stop openvpn.service || true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
$SUDO echo " done."
|
$SUDO echo " done."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,15 +524,19 @@ checkForDependencies() {
|
||||||
timestampAsDate=$(date -d @"$timestamp" "+%b %e")
|
timestampAsDate=$(date -d @"$timestamp" "+%b %e")
|
||||||
today=$(date "+%b %e")
|
today=$(date "+%b %e")
|
||||||
|
|
||||||
if [[ $PLAT == "Ubuntu" || $PLAT == "Debian" ]]; then
|
case ${PLAT} in
|
||||||
if [[ $OSCN == "trusty" || $OSCN == "jessie" || $OSCN == "wheezy" ]]; then
|
Ubuntu|Debian|Devuan)
|
||||||
wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg| $SUDO apt-key add -
|
case ${OSCN} in
|
||||||
echo "deb http://swupdate.openvpn.net/apt $OSCN main" | $SUDO tee /etc/apt/sources.list.d/swupdate.openvpn.net.list > /dev/null
|
trusty|jessie|wheezy)
|
||||||
echo -n "::: Adding OpenVPN repo for $PLAT $OSCN ..."
|
wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg| $SUDO apt-key add -
|
||||||
$SUDO apt-get -qq update & spinner $!
|
echo "deb http://swupdate.openvpn.net/apt $OSCN main" | $SUDO tee /etc/apt/sources.list.d/swupdate.openvpn.net.list > /dev/null
|
||||||
echo " done!"
|
echo -n "::: Adding OpenVPN repo for $PLAT $OSCN ..."
|
||||||
fi
|
$SUDO apt-get -qq update & spinner $!
|
||||||
fi
|
echo " done!"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ ! "$today" == "$timestampAsDate" ]; then
|
if [ ! "$today" == "$timestampAsDate" ]; then
|
||||||
#update package lists
|
#update package lists
|
||||||
|
@ -541,7 +560,7 @@ checkForDependencies() {
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Checking dependencies:"
|
echo "::: Checking dependencies:"
|
||||||
|
|
||||||
dependencies=( openvpn git dhcpcd5 tar wget grep iptables-persistent dnsutils expect whiptail )
|
dependencies=( openvpn git dhcpcd5 tar wget grep iptables-persistent dnsutils expect whiptail net-tools)
|
||||||
for i in "${dependencies[@]}"; do
|
for i in "${dependencies[@]}"; do
|
||||||
echo -n "::: Checking for $i..."
|
echo -n "::: Checking for $i..."
|
||||||
if [ "$(dpkg-query -W -f='${Status}' "$i" 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then
|
if [ "$(dpkg-query -W -f='${Status}' "$i" 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then
|
||||||
|
@ -772,7 +791,7 @@ setClientDNS() {
|
||||||
|
|
||||||
confOpenVPN() {
|
confOpenVPN() {
|
||||||
SERVER_NAME="server"
|
SERVER_NAME="server"
|
||||||
|
|
||||||
if [[ ${useUpdateVars} == false ]]; then
|
if [[ ${useUpdateVars} == false ]]; then
|
||||||
# Ask user for desired level of encryption
|
# Ask user for desired level of encryption
|
||||||
ENCRYPT=$(whiptail --backtitle "Setup OpenVPN" --title "Encryption Strength" --radiolist \
|
ENCRYPT=$(whiptail --backtitle "Setup OpenVPN" --title "Encryption Strength" --radiolist \
|
||||||
|
@ -780,7 +799,7 @@ confOpenVPN() {
|
||||||
"2048" "Use 2048-bit encryption. Recommended level." ON \
|
"2048" "Use 2048-bit encryption. Recommended level." ON \
|
||||||
"1024" "Use 1024-bit encryption. Test level." OFF \
|
"1024" "Use 1024-bit encryption. Test level." OFF \
|
||||||
"4096" "Use 4096-bit encryption. Paranoid level." OFF 3>&1 1>&2 2>&3)
|
"4096" "Use 4096-bit encryption. Paranoid level." OFF 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus != 0 ]; then
|
if [ $exitstatus != 0 ]; then
|
||||||
echo "::: Cancel selected. Exiting..."
|
echo "::: Cancel selected. Exiting..."
|
||||||
|
@ -831,7 +850,7 @@ EOF
|
||||||
if [[ ${useUpdateVars} == false ]]; then
|
if [[ ${useUpdateVars} == false ]]; then
|
||||||
whiptail --msgbox --backtitle "Setup OpenVPN" --title "Server Information" "The server key, Diffie-Hellman key, and HMAC key will now be generated." ${r} ${c}
|
whiptail --msgbox --backtitle "Setup OpenVPN" --title "Server Information" "The server key, Diffie-Hellman key, and HMAC key will now be generated." ${r} ${c}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the server
|
# Build the server
|
||||||
${SUDOE} ./easyrsa build-server-full server nopass
|
${SUDOE} ./easyrsa build-server-full server nopass
|
||||||
|
|
||||||
|
@ -843,7 +862,7 @@ EOF
|
||||||
DOWNLOAD_DH_PARAM=false
|
DOWNLOAD_DH_PARAM=false
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ENCRYPT" -ge "4096" ] && [[ ${DOWNLOAD_DH_PARAM} == true ]]
|
if [ "$ENCRYPT" -ge "4096" ] && [[ ${DOWNLOAD_DH_PARAM} == true ]]
|
||||||
then
|
then
|
||||||
# Downloading parameters
|
# Downloading parameters
|
||||||
|
@ -938,11 +957,14 @@ confNetwork() {
|
||||||
if [[ $noUFW -eq 1 ]]; then
|
if [[ $noUFW -eq 1 ]]; then
|
||||||
echo 1 > /tmp/noUFW
|
echo 1 > /tmp/noUFW
|
||||||
$SUDO iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o "$IPv4dev" -j MASQUERADE
|
$SUDO iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o "$IPv4dev" -j MASQUERADE
|
||||||
if [[ $PLAT == "Ubuntu" || $PLAT == "Debian" ]]; then
|
case ${PLAT} in
|
||||||
$SUDO iptables-save | $SUDO tee /etc/iptables/rules.v4 > /dev/null
|
Ubuntu|Debian|Devuan)
|
||||||
else
|
$SUDO iptables-save | $SUDO tee /etc/iptables/rules.v4 > /dev/null
|
||||||
$SUDO netfilter-persistent save
|
;;
|
||||||
fi
|
*)
|
||||||
|
$SUDO netfilter-persistent save
|
||||||
|
;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
echo 0 > /tmp/noUFW
|
echo 0 > /tmp/noUFW
|
||||||
fi
|
fi
|
||||||
|
@ -973,13 +995,13 @@ confOVPN() {
|
||||||
METH=$(whiptail --title "Public IP or DNS" --radiolist "Will clients use a Public IP or DNS Name to connect to your server (press space to select)?" ${r} ${c} 2 \
|
METH=$(whiptail --title "Public IP or DNS" --radiolist "Will clients use a Public IP or DNS Name to connect to your server (press space to select)?" ${r} ${c} 2 \
|
||||||
"$IPv4pub" "Use this public IP" "ON" \
|
"$IPv4pub" "Use this public IP" "ON" \
|
||||||
"DNS Entry" "Use a public DNS" "OFF" 3>&1 1>&2 2>&3)
|
"DNS Entry" "Use a public DNS" "OFF" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus != 0 ]; then
|
if [ $exitstatus != 0 ]; then
|
||||||
echo "::: Cancel selected. Exiting..."
|
echo "::: Cancel selected. Exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$METH" == "$IPv4pub" ]; then
|
if [ "$METH" == "$IPv4pub" ]; then
|
||||||
$SUDO sed -i 's/IPv4pub/'"$IPv4pub"'/' /etc/openvpn/easy-rsa/pki/Default.txt
|
$SUDO sed -i 's/IPv4pub/'"$IPv4pub"'/' /etc/openvpn/easy-rsa/pki/Default.txt
|
||||||
else
|
else
|
||||||
|
@ -1085,20 +1107,20 @@ updatePiVPN() {
|
||||||
stopServices
|
stopServices
|
||||||
confUnattendedUpgrades
|
confUnattendedUpgrades
|
||||||
installScripts
|
installScripts
|
||||||
|
|
||||||
# setCustomProto
|
# setCustomProto
|
||||||
# write out the PROTO
|
# write out the PROTO
|
||||||
PROTO=$pivpnProto
|
PROTO=$pivpnProto
|
||||||
$SUDO cp /tmp/pivpnPROTO /etc/pivpn/INSTALL_PROTO
|
$SUDO cp /tmp/pivpnPROTO /etc/pivpn/INSTALL_PROTO
|
||||||
|
|
||||||
#setCustomPort
|
#setCustomPort
|
||||||
# write out the port
|
# write out the port
|
||||||
$SUDO cp /tmp/INSTALL_PORT /etc/pivpn/INSTALL_PORT
|
$SUDO cp /tmp/INSTALL_PORT /etc/pivpn/INSTALL_PORT
|
||||||
|
|
||||||
confOpenVPN
|
confOpenVPN
|
||||||
confNetwork
|
confNetwork
|
||||||
confOVPN
|
confOVPN
|
||||||
|
|
||||||
# ?? Is this always OK? Also if you only select one DNS server ??
|
# ?? Is this always OK? Also if you only select one DNS server ??
|
||||||
$SUDO sed -i '0,/\(dhcp-option DNS \)/ s/\(dhcp-option DNS \).*/\1'${OVPNDNS1}'\"/' /etc/openvpn/server.conf
|
$SUDO sed -i '0,/\(dhcp-option DNS \)/ s/\(dhcp-option DNS \).*/\1'${OVPNDNS1}'\"/' /etc/openvpn/server.conf
|
||||||
$SUDO sed -i '0,/\(dhcp-option DNS \)/! s/\(dhcp-option DNS \).*/\1'${OVPNDNS2}'\"/' /etc/openvpn/server.conf
|
$SUDO sed -i '0,/\(dhcp-option DNS \)/! s/\(dhcp-option DNS \).*/\1'${OVPNDNS2}'\"/' /etc/openvpn/server.conf
|
||||||
|
@ -1133,12 +1155,12 @@ update_dialogs() {
|
||||||
fi
|
fi
|
||||||
opt2a="Reconfigure"
|
opt2a="Reconfigure"
|
||||||
opt2b="This will allow you to enter new settings"
|
opt2b="This will allow you to enter new settings"
|
||||||
|
|
||||||
UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\n\nWe have detected an existing install.\n\nPlease choose from the following options: \n($strAdd)" ${r} ${c} 2 \
|
UpdateCmd=$(whiptail --title "Existing Install Detected!" --menu "\n\nWe have detected an existing install.\n\nPlease choose from the following options: \n($strAdd)" ${r} ${c} 2 \
|
||||||
"${opt1a}" "${opt1b}" \
|
"${opt1a}" "${opt1b}" \
|
||||||
"${opt2a}" "${opt2b}" 3>&2 2>&1 1>&3) || \
|
"${opt2a}" "${opt2b}" 3>&2 2>&1 1>&3) || \
|
||||||
{ echo "::: Cancel selected. Exiting"; exit 1; }
|
{ echo "::: Cancel selected. Exiting"; exit 1; }
|
||||||
|
|
||||||
case ${UpdateCmd} in
|
case ${UpdateCmd} in
|
||||||
${opt1a})
|
${opt1a})
|
||||||
echo "::: ${opt1a} option selected."
|
echo "::: ${opt1a} option selected."
|
||||||
|
@ -1184,10 +1206,10 @@ main() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for supported distribution
|
# Check for supported distribution
|
||||||
distro_check
|
distro_check
|
||||||
|
|
||||||
# Check arguments for the undocumented flags
|
# Check arguments for the undocumented flags
|
||||||
for var in "$@"; do
|
for var in "$@"; do
|
||||||
case "$var" in
|
case "$var" in
|
||||||
|
@ -1196,7 +1218,7 @@ main() {
|
||||||
"--unattended" ) runUnattended=true;;
|
"--unattended" ) runUnattended=true;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -f ${setupVars} ]]; then
|
if [[ -f ${setupVars} ]]; then
|
||||||
if [[ "${runUnattended}" == true ]]; then
|
if [[ "${runUnattended}" == true ]]; then
|
||||||
echo "::: --unattended passed to install script, no whiptail dialogs will be displayed"
|
echo "::: --unattended passed to install script, no whiptail dialogs will be displayed"
|
||||||
|
@ -1205,7 +1227,7 @@ main() {
|
||||||
update_dialogs
|
update_dialogs
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the installer
|
# Start the installer
|
||||||
# Verify there is enough disk space for the install
|
# Verify there is enough disk space for the install
|
||||||
if [[ "${skipSpaceCheck}" == true ]]; then
|
if [[ "${skipSpaceCheck}" == true ]]; then
|
||||||
|
@ -1213,24 +1235,24 @@ main() {
|
||||||
else
|
else
|
||||||
verifyFreeDiskSpace
|
verifyFreeDiskSpace
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install the packages (we do this first because we need whiptail)
|
# Install the packages (we do this first because we need whiptail)
|
||||||
#checkForDependencies
|
#checkForDependencies
|
||||||
update_package_cache
|
update_package_cache
|
||||||
|
|
||||||
# Notify user of package availability
|
# Notify user of package availability
|
||||||
notify_package_updates_available
|
notify_package_updates_available
|
||||||
|
|
||||||
# Install packages used by this installation script
|
# Install packages used by this installation script
|
||||||
install_dependent_packages PIVPN_DEPS[@]
|
install_dependent_packages PIVPN_DEPS[@]
|
||||||
|
|
||||||
if [[ ${useUpdateVars} == false ]]; then
|
if [[ ${useUpdateVars} == false ]]; then
|
||||||
# Display welcome dialogs
|
# Display welcome dialogs
|
||||||
welcomeDialogs
|
welcomeDialogs
|
||||||
|
|
||||||
# Find interfaces and let the user choose one
|
# Find interfaces and let the user choose one
|
||||||
chooseInterface
|
chooseInterface
|
||||||
|
|
||||||
# Only try to set static on Raspbian, otherwise let user do it
|
# Only try to set static on Raspbian, otherwise let user do it
|
||||||
if [[ $PLAT != "Raspbian" ]]; then
|
if [[ $PLAT != "Raspbian" ]]; then
|
||||||
avoidStaticIPv4Ubuntu
|
avoidStaticIPv4Ubuntu
|
||||||
|
@ -1238,27 +1260,27 @@ main() {
|
||||||
getStaticIPv4Settings
|
getStaticIPv4Settings
|
||||||
setStaticIPv4
|
setStaticIPv4
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the Network IP and Mask correctly
|
# Set the Network IP and Mask correctly
|
||||||
setNetwork
|
setNetwork
|
||||||
|
|
||||||
# Choose the user for the ovpns
|
# Choose the user for the ovpns
|
||||||
chooseUser
|
chooseUser
|
||||||
|
|
||||||
# Ask if unattended-upgrades will be enabled
|
# Ask if unattended-upgrades will be enabled
|
||||||
unattendedUpgrades
|
unattendedUpgrades
|
||||||
|
|
||||||
# Clone/Update the repos
|
# Clone/Update the repos
|
||||||
clone_or_update_repos
|
clone_or_update_repos
|
||||||
|
|
||||||
# Install and log everything to a file
|
# Install and log everything to a file
|
||||||
installPiVPN | tee ${tmpLog}
|
installPiVPN | tee ${tmpLog}
|
||||||
|
|
||||||
echo "::: Install Complete..."
|
echo "::: Install Complete..."
|
||||||
else
|
else
|
||||||
# Source ${setupVars} for use in the rest of the functions.
|
# Source ${setupVars} for use in the rest of the functions.
|
||||||
source ${setupVars}
|
source ${setupVars}
|
||||||
|
|
||||||
echo "::: Using IP address: $IPv4addr"
|
echo "::: Using IP address: $IPv4addr"
|
||||||
echo "${IPv4addr%/*}" > /tmp/pivpnIP
|
echo "${IPv4addr%/*}" > /tmp/pivpnIP
|
||||||
echo "::: Using interface: $pivpnInterface"
|
echo "::: Using interface: $pivpnInterface"
|
||||||
|
@ -1270,7 +1292,7 @@ main() {
|
||||||
echo "::: Using port: $PORT"
|
echo "::: Using port: $PORT"
|
||||||
echo ${PORT} > /tmp/INSTALL_PORT
|
echo ${PORT} > /tmp/INSTALL_PORT
|
||||||
echo ":::"
|
echo ":::"
|
||||||
|
|
||||||
# Only try to set static on Raspbian
|
# Only try to set static on Raspbian
|
||||||
if [[ $PLAT != "Raspbian" ]]; then
|
if [[ $PLAT != "Raspbian" ]]; then
|
||||||
echo "::: IP Information"
|
echo "::: IP Information"
|
||||||
|
@ -1280,32 +1302,35 @@ main() {
|
||||||
else
|
else
|
||||||
setStaticIPv4 # This might be a problem if a user tries to modify the ip in the config file and then runs an update because of the way we check for previous configuration in /etc/dhcpcd.conf
|
setStaticIPv4 # This might be a problem if a user tries to modify the ip in the config file and then runs an update because of the way we check for previous configuration in /etc/dhcpcd.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clone/Update the repos
|
# Clone/Update the repos
|
||||||
clone_or_update_repos
|
clone_or_update_repos
|
||||||
|
|
||||||
|
|
||||||
updatePiVPN | tee ${tmpLog}
|
updatePiVPN | tee ${tmpLog}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Move the install log into /etc/pivpn for storage
|
#Move the install log into /etc/pivpn for storage
|
||||||
$SUDO mv ${tmpLog} ${instalLogLoc}
|
$SUDO mv ${tmpLog} ${instalLogLoc}
|
||||||
|
|
||||||
echo "::: Restarting services..."
|
echo "::: Restarting services..."
|
||||||
# Start services
|
# Start services
|
||||||
if [[ $PLAT == "Ubuntu" || $PLAT == "Debian" ]]; then
|
case ${PLAT} in
|
||||||
$SUDO service openvpn start
|
Ubuntu|Debian|Devuan)
|
||||||
else
|
$SUDO service openvpn start
|
||||||
$SUDO systemctl enable openvpn.service
|
;;
|
||||||
$SUDO systemctl start openvpn.service
|
*)
|
||||||
fi
|
$SUDO systemctl enable openvpn.service
|
||||||
|
$SUDO systemctl start openvpn.service
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "::: done."
|
echo "::: done."
|
||||||
|
|
||||||
if [[ "${useUpdateVars}" == false ]]; then
|
if [[ "${useUpdateVars}" == false ]]; then
|
||||||
displayFinalMessage
|
displayFinalMessage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
if [[ "${useUpdateVars}" == false ]]; then
|
if [[ "${useUpdateVars}" == false ]]; then
|
||||||
echo "::: Installation Complete!"
|
echo "::: Installation Complete!"
|
||||||
|
@ -1315,7 +1340,7 @@ main() {
|
||||||
else
|
else
|
||||||
echo "::: Update complete!"
|
echo "::: Update complete!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: The install log is located at: ${instalLogLoc}"
|
echo "::: The install log is located at: ${instalLogLoc}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue