1
0
mirror of synced 2025-03-03 19:33:16 +03:00
This commit is contained in:
hwdsl2 2021-08-14 00:26:27 -05:00
parent 70873348b9
commit 8e570129b2
6 changed files with 14 additions and 21 deletions

View File

@ -100,13 +100,7 @@ confirm_or_abort() {
} }
get_update_url() { get_update_url() {
update_url=vpnupgrade update_url="https://git.io/vpnupgrade"
if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] || [ "$os_type" = "alma" ]; then
update_url=vpnupgrade-centos
elif [ "$os_type" = "amzn" ]; then
update_url=vpnupgrade-amzn
fi
update_url="https://git.io/$update_url"
} }
check_swan_install() { check_swan_install() {

View File

@ -26,12 +26,11 @@ bigecho() { echo "## $1"; }
vpnupgrade() { vpnupgrade() {
[ -n "$VPN_UPDATE_SWAN_VER" ] && SWAN_VER="$VPN_UPDATE_SWAN_VER"
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-') os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
if ! grep -qs "Amazon Linux release 2" /etc/system-release; then if ! grep -qs "Amazon Linux release 2" /etc/system-release; then
echo "Error: This script only supports Amazon Linux 2." >&2 exiterr "This script only supports Amazon Linux 2."
echo "For Ubuntu/Debian, use https://git.io/vpnupgrade" >&2
echo "For CentOS/RHEL, use https://git.io/vpnupgrade-centos" >&2
exit 1
fi fi
if [ "$(id -u)" != 0 ]; then if [ "$(id -u)" != 0 ]; then
@ -70,7 +69,7 @@ if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|
&& printf '%s\n%s' "$swan_ver_cur" "$swan_ver_latest" | sort -C -V; then && printf '%s\n%s' "$swan_ver_cur" "$swan_ver_latest" | sort -C -V; then
echo "Note: A newer version of Libreswan ($swan_ver_latest) is available." echo "Note: A newer version of Libreswan ($swan_ver_latest) is available."
echo " To update to the new version, exit this script and run:" echo " To update to the new version, exit this script and run:"
echo " wget https://git.io/vpnupgrade-amzn -O vpnup.sh && sudo sh vpnup.sh" echo " wget https://git.io/vpnupgrade -O vpnup.sh && sudo sh vpnup.sh"
echo echo
printf "Do you want to continue anyway? [y/N] " printf "Do you want to continue anyway? [y/N] "
read -r response read -r response

View File

@ -26,6 +26,8 @@ bigecho() { echo "## $1"; }
vpnupgrade() { vpnupgrade() {
[ -n "$VPN_UPDATE_SWAN_VER" ] && SWAN_VER="$VPN_UPDATE_SWAN_VER"
os_type=centos os_type=centos
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-') os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
rh_file="/etc/redhat-release" rh_file="/etc/redhat-release"
@ -40,9 +42,7 @@ elif grep -qs "release 8" "$rh_file"; then
grep -qi rocky "$rh_file" && os_type=rocky grep -qi rocky "$rh_file" && os_type=rocky
grep -qi alma "$rh_file" && os_type=alma grep -qi alma "$rh_file" && os_type=alma
else else
echo "Error: This script only supports CentOS/RHEL 7 and 8." >&2 exiterr "This script only supports CentOS/RHEL 7 and 8."
echo "For Ubuntu/Debian, use https://git.io/vpnupgrade" >&2
exit 1
fi fi
if [ -f /proc/user_beancounters ]; then if [ -f /proc/user_beancounters ]; then
@ -85,7 +85,7 @@ if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|
&& printf '%s\n%s' "$swan_ver_cur" "$swan_ver_latest" | sort -C -V; then && printf '%s\n%s' "$swan_ver_cur" "$swan_ver_latest" | sort -C -V; then
echo "Note: A newer version of Libreswan ($swan_ver_latest) is available." echo "Note: A newer version of Libreswan ($swan_ver_latest) is available."
echo " To update to the new version, exit this script and run:" echo " To update to the new version, exit this script and run:"
echo " wget https://git.io/vpnupgrade-centos -O vpnup.sh && sudo sh vpnup.sh" echo " wget https://git.io/vpnupgrade -O vpnup.sh && sudo sh vpnup.sh"
echo echo
printf "Do you want to continue anyway? [y/N] " printf "Do you want to continue anyway? [y/N] "
read -r response read -r response

View File

@ -26,6 +26,8 @@ bigecho() { echo "## $1"; }
vpnupgrade() { vpnupgrade() {
[ -n "$VPN_UPDATE_SWAN_VER" ] && SWAN_VER="$VPN_UPDATE_SWAN_VER"
os_type=$(lsb_release -si 2>/dev/null) os_type=$(lsb_release -si 2>/dev/null)
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-') os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
[ -z "$os_type" ] && [ -f /etc/os-release ] && os_type=$(. /etc/os-release && printf '%s' "$ID") [ -z "$os_type" ] && [ -f /etc/os-release ] && os_type=$(. /etc/os-release && printf '%s' "$ID")
@ -40,9 +42,7 @@ case $os_type in
os_type=raspbian os_type=raspbian
;; ;;
*) *)
echo "Error: This script only supports Ubuntu and Debian." >&2 exiterr "This script only supports Ubuntu and Debian."
echo "For CentOS/RHEL, use https://git.io/vpnupgrade-centos" >&2
exit 1
;; ;;
esac esac

View File

@ -451,7 +451,7 @@ cat <<EOF
Note: A newer version of Libreswan ($swan_ver_latest) is available. Note: A newer version of Libreswan ($swan_ver_latest) is available.
To update, run: To update, run:
wget https://git.io/vpnupgrade-amzn -O vpnup.sh && sudo sh vpnup.sh wget https://git.io/vpnupgrade -O vpnup.sh && sudo sh vpnup.sh
EOF EOF
fi fi

View File

@ -542,7 +542,7 @@ cat <<EOF
Note: A newer version of Libreswan ($swan_ver_latest) is available. Note: A newer version of Libreswan ($swan_ver_latest) is available.
To update, run: To update, run:
wget https://git.io/vpnupgrade-centos -O vpnup.sh && sudo sh vpnup.sh wget https://git.io/vpnupgrade -O vpnup.sh && sudo sh vpnup.sh
EOF EOF
fi fi