Verify that the available OpenVPN version has ECC support

This commit is contained in:
Orazio 2020-03-12 13:00:18 +01:00
parent 1352ccf9a3
commit eae70d0295

View file

@ -1129,7 +1129,12 @@ installOpenVPN(){
# Use x86-only OpenVPN APT repo on x86 Debian/Ubuntu systems # Use x86-only OpenVPN APT repo on x86 Debian/Ubuntu systems
if [ "$PLAT" != "Raspbian" ] && [ "$X86_SYSTEM" -eq 1 ]; then if [ "$PLAT" != "Raspbian" ] && [ "$X86_SYSTEM" -eq 1 ]; then
if [ -n "$(apt-cache policy openvpn | grep 'Candidate:' | awk '{print $2}')" ]; then
AVAILABLE_OPENVPN="$(apt-cache policy openvpn | grep 'Candidate:' | awk '{print $2}')"
# If there is an available openvpn package and its version is at least 2.4
# (required for ECC support), do not add the repository
if [ -n "$AVAILABLE_OPENVPN" ] && dpkg --compare-versions "$AVAILABLE_OPENVPN" ge 2.4; then
echo "::: OpenVPN is already available in the repositories" echo "::: OpenVPN is already available in the repositories"
else else
# gnupg is used by apt-key to import the openvpn GPG key into the # gnupg is used by apt-key to import the openvpn GPG key into the
@ -1137,9 +1142,8 @@ installOpenVPN(){
PIVPN_DEPS=(gnupg) PIVPN_DEPS=(gnupg)
installDependentPackages PIVPN_DEPS[@] installDependentPackages PIVPN_DEPS[@]
# We will download the repository key regardless of whether the user # We will download the repository key for the official repository from a
# has already enabled the openvpn repository or not, just to make sure # keyserver. If we fail, we will attempt to download the key via HTTPS
# we have the right key
echo "::: Adding repository key..." echo "::: Adding repository key..."
if ! $SUDO apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "$OPENVPN_KEY_ID"; then if ! $SUDO apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "$OPENVPN_KEY_ID"; then
echo "::: Import via keyserver failed, now trying wget" echo "::: Import via keyserver failed, now trying wget"