1
0
mirror of synced 2024-11-21 20:46:10 +03:00

Add new option

- Add an option for specifying a Libreswan version to install,
  using variable VPN_SWAN_VER. Currently supported values are
  4.15 and 5.0. This could be useful for users who want to
  install the older Libreswan version 4.
This commit is contained in:
hwdsl2 2024-05-03 22:18:08 -05:00
parent 0b1eaf64b8
commit bea8597b02
5 changed files with 49 additions and 1 deletions

View File

@ -280,7 +280,7 @@ run_setup() {
VPN_DNS_NAME="$VPN_DNS_NAME" VPN_CLIENT_NAME="$VPN_CLIENT_NAME" \
VPN_PROTECT_CONFIG="$VPN_PROTECT_CONFIG" \
VPN_CLIENT_VALIDITY="$VPN_CLIENT_VALIDITY" \
VPN_SKIP_IKEV2="$VPN_SKIP_IKEV2" \
VPN_SKIP_IKEV2="$VPN_SKIP_IKEV2" VPN_SWAN_VER="$VPN_SWAN_VER" \
/bin/bash "$tmpdir/vpn.sh" || status=1
else
status=1

View File

@ -248,6 +248,18 @@ get_swan_ver() {
if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|[1-9][0-9]{1,2})){1,2}$'; then
SWAN_VER="$swan_ver_latest"
fi
if [ -n "$VPN_SWAN_VER" ]; then
if ! printf '%s\n%s' "4.15" "$VPN_SWAN_VER" | sort -C -V \
|| ! printf '%s\n%s' "$VPN_SWAN_VER" "$SWAN_VER" | sort -C -V; then
cat 1>&2 <<EOF
Error: Libreswan version '$VPN_SWAN_VER' is not supported.
This script can install Libreswan 4.15+ or $SWAN_VER.
EOF
exit 1
else
SWAN_VER="$VPN_SWAN_VER"
fi
fi
}
check_libreswan() {

View File

@ -266,6 +266,18 @@ get_swan_ver() {
if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|[1-9][0-9]{1,2})){1,2}$'; then
SWAN_VER="$swan_ver_latest"
fi
if [ -n "$VPN_SWAN_VER" ]; then
if ! printf '%s\n%s' "4.15" "$VPN_SWAN_VER" | sort -C -V \
|| ! printf '%s\n%s' "$VPN_SWAN_VER" "$SWAN_VER" | sort -C -V; then
cat 1>&2 <<EOF
Error: Libreswan version '$VPN_SWAN_VER' is not supported.
This script can install Libreswan 4.15+ or $SWAN_VER.
EOF
exit 1
else
SWAN_VER="$VPN_SWAN_VER"
fi
fi
}
check_libreswan() {

View File

@ -368,6 +368,18 @@ get_swan_ver() {
if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|[1-9][0-9]{1,2})){1,2}$'; then
SWAN_VER="$swan_ver_latest"
fi
if [ -n "$VPN_SWAN_VER" ]; then
if ! printf '%s\n%s' "4.15" "$VPN_SWAN_VER" | sort -C -V \
|| ! printf '%s\n%s' "$VPN_SWAN_VER" "$SWAN_VER" | sort -C -V; then
cat 1>&2 <<EOF
Error: Libreswan version '$VPN_SWAN_VER' is not supported.
This script can install Libreswan 4.15+ or $SWAN_VER.
EOF
exit 1
else
SWAN_VER="$VPN_SWAN_VER"
fi
fi
}
check_libreswan() {

View File

@ -321,6 +321,18 @@ get_swan_ver() {
if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|[1-9][0-9]{1,2})){1,2}$'; then
SWAN_VER="$swan_ver_latest"
fi
if [ -n "$VPN_SWAN_VER" ]; then
if ! printf '%s\n%s' "4.15" "$VPN_SWAN_VER" | sort -C -V \
|| ! printf '%s\n%s' "$VPN_SWAN_VER" "$SWAN_VER" | sort -C -V; then
cat 1>&2 <<EOF
Error: Libreswan version '$VPN_SWAN_VER' is not supported.
This script can install Libreswan 4.15+ or $SWAN_VER.
EOF
exit 1
else
SWAN_VER="$VPN_SWAN_VER"
fi
fi
}
check_libreswan() {