Update wireguard.sh

This commit is contained in:
Teddysun 2019-09-25 23:43:55 +09:00
parent 06fc6a002c
commit 9bdc797c7a
No known key found for this signature in database
GPG Key ID: 09BD4C080AD6C46D

View File

@ -637,23 +637,20 @@ install_from_source() {
} }
update_from_source() { update_from_source() {
if check_version; then if check_version > /dev/null 2>&1; then
_get_latest_ver _get_latest_ver
echo "WireGuard latest version: $(_green ${wireguard_ver})" _info "WireGuard version: $(_green ${installed_wg_ver})"
_info "WireGuard latest version: $(_green ${wireguard_ver})"
if _version_gt "${wireguard_ver}" "${installed_wg_ver}"; then if _version_gt "${wireguard_ver}" "${installed_wg_ver}"; then
echo "Do you want to upgrade WireGuard? (y/n)" _info "Starting upgrade WireGuard"
read -p "(Default: n):" update_wg install_wg_2
[ -z "${update_wg}" ] && update_wg="n" _error_detect "systemctl restart wg-quick@${SERVER_WG_NIC}"
if [ "${update_wg}" = "y" -o "${update_wg}" = "Y" ]; then _info "Update WireGuard completed"
install_wg_2
systemctl restart wg-quick@${SERVER_WG_NIC}
echo "Update WireGuard completed"
else
echo "Update WireGuard canceled"
fi
else else
echo "No updates needed to update WireGuard" _info "There is no update available for WireGuard"
fi fi
else
_red "WireGuard was not installed, maybe you need to install it at first\n"
fi fi
} }