Merge pull request #134 from ardadem/master

Fedora Support
This commit is contained in:
Angristan 2017-12-16 15:26:40 +01:00 committed by GitHub
commit bfa350d693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,7 +40,7 @@ if [[ -e /etc/debian_version ]]; then
exit 4 exit 4
fi fi
fi fi
elif [[ -e /etc/centos-release || -e /etc/redhat-release ]]; then elif [[ -e /etc/centos-release || -e /etc/redhat-release && ! -e /etc/fedora-release ]]; then
OS=centos OS=centos
IPTABLES='/etc/iptables/iptables.rules' IPTABLES='/etc/iptables/iptables.rules'
SYSCTL='/etc/sysctl.conf' SYSCTL='/etc/sysctl.conf'
@ -48,6 +48,10 @@ elif [[ -e /etc/arch-release ]]; then
OS=arch OS=arch
IPTABLES='/etc/iptables/iptables.rules' IPTABLES='/etc/iptables/iptables.rules'
SYSCTL='/etc/sysctl.d/openvpn.conf' SYSCTL='/etc/sysctl.d/openvpn.conf'
elif [[ -e /etc/fedora-release ]]; then
OS=fedora
IPTABLES='/etc/iptables/iptables.rules'
SYSCTL='/etc/sysctl.d/openvpn.conf'
else else
echo "Looks like you aren't running this installer on a Debian, Ubuntu, CentOS or ArchLinux system" echo "Looks like you aren't running this installer on a Debian, Ubuntu, CentOS or ArchLinux system"
exit 4 exit 4
@ -382,8 +386,10 @@ WantedBy=multi-user.target" > /etc/systemd/system/iptables.service
systemctl daemon-reload systemctl daemon-reload
systemctl enable iptables.service systemctl enable iptables.service
fi fi
elif [[ "$OS" = 'centos' ]]; then elif [[ "$OS" = 'centos' || "$OS" = 'fedora' ]]; then
if [[ "$OS" = 'centos' ]]; then
yum install epel-release -y yum install epel-release -y
fi
yum install openvpn iptables openssl wget ca-certificates curl -y yum install openvpn iptables openssl wget ca-certificates curl -y
# Install iptables service # Install iptables service
if [[ ! -e /etc/systemd/system/iptables.service ]]; then if [[ ! -e /etc/systemd/system/iptables.service ]]; then
@ -417,6 +423,7 @@ WantedBy=multi-user.target" > /etc/systemd/system/iptables.service
systemctl enable iptables.service systemctl enable iptables.service
# Disable firewalld to allow iptables to start upon reboot # Disable firewalld to allow iptables to start upon reboot
systemctl disable firewalld systemctl disable firewalld
systemctl mask firewalld
fi fi
else else
# Else, the distro is ArchLinux # Else, the distro is ArchLinux
@ -624,8 +631,8 @@ verb 3" >> /etc/openvpn/server.conf
fi fi
else else
if pgrep systemd-journal; then if pgrep systemd-journal; then
if [[ "$OS" = 'arch' ]]; then if [[ "$OS" = 'arch' || "$OS" = 'fedora' ]]; then
#Workaround to avoid rewriting the entire script for Arch #Workaround to avoid rewriting the entire script for Arch & Fedora
sed -i 's|/etc/openvpn/server|/etc/openvpn|' /usr/lib/systemd/system/openvpn-server@.service sed -i 's|/etc/openvpn/server|/etc/openvpn|' /usr/lib/systemd/system/openvpn-server@.service
sed -i 's|%i.conf|server.conf|' /usr/lib/systemd/system/openvpn-server@.service sed -i 's|%i.conf|server.conf|' /usr/lib/systemd/system/openvpn-server@.service
systemctl daemon-reload systemctl daemon-reload