Skip to content

Commit

Permalink
Add new option
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
hwdsl2 committed May 4, 2024
1 parent 0b1eaf6 commit bea8597
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion vpnsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions vpnsetup_alpine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 12 additions & 0 deletions vpnsetup_amzn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 12 additions & 0 deletions vpnsetup_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 12 additions & 0 deletions vpnsetup_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit bea8597

Please sign in to comment.