From ecd99a6bbabdab256559fa91a68335390e15d34a Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Thu, 12 Nov 2020 10:24:02 -0600 Subject: [PATCH] Fix version detection - Fix Libreswan version detection in upgrade scripts --- extras/vpnupgrade.sh | 3 ++- extras/vpnupgrade_centos.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extras/vpnupgrade.sh b/extras/vpnupgrade.sh index 930a84e..071e718 100644 --- a/extras/vpnupgrade.sh +++ b/extras/vpnupgrade.sh @@ -81,11 +81,12 @@ esac ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null) ipsec_ver_short=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux Libreswan/Libreswan/' -e 's/ (netkey) on .*//') +swan_ver_old=$(printf '%s' "$ipsec_ver_short" | sed -e 's/Libreswan //') if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then exiterr "This script requires Libreswan already installed." fi -if printf '%s' "$ipsec_ver" | grep -qF "$SWAN_VER"; then +if [ "$swan_ver_old" = "$SWAN_VER" ]; then echo "You already have Libreswan version $SWAN_VER installed! " echo "If you continue, the same version will be re-installed." echo diff --git a/extras/vpnupgrade_centos.sh b/extras/vpnupgrade_centos.sh index d2f5719..62937f9 100644 --- a/extras/vpnupgrade_centos.sh +++ b/extras/vpnupgrade_centos.sh @@ -72,11 +72,12 @@ esac ipsec_ver=$(/usr/local/sbin/ipsec --version 2>/dev/null) ipsec_ver_short=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux Libreswan/Libreswan/' -e 's/ (netkey) on .*//') +swan_ver_old=$(printf '%s' "$ipsec_ver_short" | sed -e 's/Libreswan //') if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then exiterr "This script requires Libreswan already installed." fi -if printf '%s' "$ipsec_ver" | grep -qF "$SWAN_VER"; then +if [ "$swan_ver_old" = "$SWAN_VER" ]; then echo "You already have Libreswan version $SWAN_VER installed! " echo "If you continue, the same version will be re-installed." echo