Update wireguard.sh

This commit is contained in:
Teddysun 2020-04-03 16:00:19 +09:00 committed by GitHub
parent 811a96200a
commit 47505558cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,7 +220,7 @@ check_os() {
# Check linux kernel version # Check linux kernel version
check_kernel_version() { check_kernel_version() {
kernel_version="$(uname -r | cut -d- -f1)" kernel_version="$(uname -r | cut -d- -f1)"
if _version_ge ${kernel_version} 5.6; then if _version_ge ${kernel_version} 5.6.0; then
return 0 return 0
else else
return 1 return 1
@ -791,10 +791,12 @@ Options:
} }
install_from_repo() { install_from_repo() {
_is_installed && check_version && _red "WireGuard was already installed\n" && exit 0
check_os check_os
_is_installed _is_installed
rt=$? rt=$?
if [ ${rt} -eq 0 ]; then
_red "WireGuard was already installed\n" && exit 0
fi
if check_kernel_version && [ ${rt} -eq 2 ]; then if check_kernel_version && [ ${rt} -eq 2 ]; then
install_wg_3 install_wg_3
else else
@ -809,10 +811,12 @@ install_from_repo() {
} }
install_from_source() { install_from_source() {
_is_installed && check_version && _red "WireGuard was already installed\n" && exit 0
check_os check_os
_is_installed _is_installed
rt=$? rt=$?
if [ ${rt} -eq 0 ]; then
_red "WireGuard was already installed\n" && exit 0
fi
if check_kernel_version && [ ${rt} -eq 2 ]; then if check_kernel_version && [ ${rt} -eq 2 ]; then
install_wg_4 install_wg_4
else else