mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
Get install working on ubuntu
This commit is contained in:
parent
60ab6c057a
commit
fa60d29aa3
2 changed files with 38 additions and 7 deletions
|
@ -56,6 +56,13 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
# Next rough check for platform
|
||||
if [ "$(cat /etc/os-release | grep ubuntu)" ]; then
|
||||
PLAT="ubuntu"
|
||||
else
|
||||
PLAT="raspbian"
|
||||
fi
|
||||
|
||||
####### FUNCTIONS ##########
|
||||
spinner()
|
||||
{
|
||||
|
@ -167,6 +174,12 @@ chooseInterface() {
|
|||
fi
|
||||
}
|
||||
|
||||
avoidStaticIPv4Ubuntu() {
|
||||
# If we are in Ubuntu then they need to have previously set their network, so just use what you have.
|
||||
whiptail --msgbox --backtitle "IP Information" --title "IP Information" "Since we think you are using Ubuntu, and not Raspbian, we will not configure a static IP for you
|
||||
If you are in Amazon then you can not configure a static IP anyway. Just ensure before this installer started you had set an elastic IP on your instance." $r $c
|
||||
}
|
||||
|
||||
getStaticIPv4Settings() {
|
||||
# Ask if the user wants to use DHCP settings as their static IP
|
||||
if (whiptail --backtitle "Calibrating network interface" --title "Static IP Address" --yesno "Do you want to use your current network settings as a static address?
|
||||
|
@ -288,7 +301,11 @@ stopServices() {
|
|||
# Stop openvpn
|
||||
$SUDO echo ":::"
|
||||
$SUDO echo -n "::: Stopping openvpn service..."
|
||||
$SUDO systemctl openvpn.service stop || true
|
||||
if [[ $PLAT == "ubuntu" ]]; then
|
||||
$SUDO service openvpn stop || true
|
||||
else
|
||||
$SUDO systemctl stop openvpn.service || true
|
||||
fi
|
||||
$SUDO echo " done."
|
||||
}
|
||||
|
||||
|
@ -521,7 +538,11 @@ confNetwork() {
|
|||
|
||||
# Write script to run openvpn and allow it through firewall on boot using the template .txt file
|
||||
$SUDO iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o $IPv4dev -j MASQUERADE
|
||||
if [[ $PLAT == "ubuntu" ]]; then
|
||||
$SUDO iptables-save
|
||||
else
|
||||
$SUDO netfilter-persistent save
|
||||
fi
|
||||
}
|
||||
|
||||
confOVPN() {
|
||||
|
@ -594,8 +615,13 @@ installPiVPN() {
|
|||
|
||||
displayFinalMessage() {
|
||||
# Final completion message to user
|
||||
if [[ $PLAT == "ubuntu" ]]; then
|
||||
$SUDO service openvpn start
|
||||
else
|
||||
$SUDO systemctl enable openvpn.service
|
||||
$SUDO systemctl start openvpn.service
|
||||
fi
|
||||
|
||||
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Now run 'pivpn add' to create the ovpn profiles.
|
||||
Run 'pivpn help' to see what else you can do!
|
||||
The install log is in /etc/pivpn." $r $c
|
||||
|
@ -616,8 +642,13 @@ verifyFreeDiskSpace
|
|||
|
||||
# Find interfaces and let the user choose one
|
||||
chooseInterface
|
||||
|
||||
if [[ $PLAT == "ubuntu" ]]; then
|
||||
avoidStaticIPv4Ubuntu
|
||||
else
|
||||
getStaticIPv4Settings
|
||||
setStaticIPv4
|
||||
fi
|
||||
|
||||
# Choose the user for the ovpns
|
||||
chooseUser
|
||||
|
|
|
@ -9,7 +9,7 @@ if [ ! -f $INDEX ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
printf ": NOTE : You should always have a valid server entry below!\n"
|
||||
printf ": NOTE : The first entry should always be your valid server!\n"
|
||||
printf "\n"
|
||||
printf "\e[1m::: Certificate Status List :::\e[0m\n"
|
||||
printf " ::\e[4m Status \e[0m||\e[4m Name \e[0m:: \n"
|
||||
|
|
Loading…
Reference in a new issue