Improve warning message, fix checking for wrong OS

This commit is contained in:
Mark Vainomaa 2018-09-23 16:06:41 +03:00
parent 756f49aba4
commit 64887413eb
No known key found for this signature in database
GPG key ID: 1B3F9523B542D315

View file

@ -554,29 +554,30 @@ function installOpenVPN () {
yum install epel-release openvpn iptables openssl wget ca-certificates curl -y yum install epel-release openvpn iptables openssl wget ca-certificates curl -y
elif [[ "$OS" = 'fedora' ]]; then elif [[ "$OS" = 'fedora' ]]; then
dnf install openvpn iptables openssl wget ca-certificates curl -y dnf install openvpn iptables openssl wget ca-certificates curl -y
elif [[ "$OS" = 'archlinux' ]]; then elif [[ "$OS" = 'arch' ]]; then
# Else, the distro is ArchLinux
echo "" echo ""
echo "" echo "WARNING: As you're using ArchLinux, I need to update the packages on your system to install those I need."
echo "As you're using ArchLinux, I need to update the packages on your system to install those I need." echo "Not doing that could cause problems between dependencies, or missing files in repositories (Arch Linux does not support partial upgrades)."
echo "Not doing that could cause problems between dependencies, or missing files in repositories."
echo "" echo ""
echo "Continuing will update your installed packages and install needed ones." echo "Continuing will update your installed packages and install needed ones."
echo ""
until [[ $CONTINUE == "y" || $CONTINUE == "n" ]]; do until [[ $CONTINUE == "y" || $CONTINUE == "n" ]]; do
read -rp "Continue ? [y/n]: " -e -i y CONTINUE read -rp "Continue ? [y/n]: " -e -i y CONTINUE
done done
if [[ "$CONTINUE" = "n" ]]; then if [[ "$CONTINUE" = "n" ]]; then
echo "Ok, bye !" echo "Exiting because user did not permit updating the system."
exit 4 exit 4
fi fi
if [[ "$OS" = 'arch' ]]; then
# Install dependencies # Install required dependencies and upgrade the system
pacman --needed --noconfirm -Syu openvpn iptables openssl wget ca-certificates curl pacman --needed --noconfirm -Syu openvpn iptables openssl wget ca-certificates curl
iptables-save > /etc/iptables/iptables.rules # iptables won't start if this file does not exist
# iptables service won't start if this file does not exist
touch /etc/iptables/iptables.rules
# Enable iptables service
systemctl daemon-reload systemctl daemon-reload
systemctl enable iptables systemctl enable --now iptables
systemctl start iptables
fi
fi fi
# Find out if the machine uses nogroup or nobody for the permissionless group # Find out if the machine uses nogroup or nobody for the permissionless group