mirror of
				https://github.com/teddysun/across.git
				synced 2025-11-04 18:55:33 +08:00 
			
		
		
		
	Update wireguard.sh
This commit is contained in:
		
							
								
								
									
										19
									
								
								wireguard.sh
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								wireguard.sh
									
									
									
									
									
								
							@@ -637,23 +637,20 @@ install_from_source() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
update_from_source() {
 | 
			
		||||
    if check_version; then
 | 
			
		||||
    if check_version > /dev/null 2>&1; then
 | 
			
		||||
        _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
 | 
			
		||||
            echo "Do you want to upgrade WireGuard? (y/n)"
 | 
			
		||||
            read -p "(Default: n):" update_wg
 | 
			
		||||
            [ -z "${update_wg}" ] && update_wg="n"
 | 
			
		||||
            if [ "${update_wg}" = "y" -o "${update_wg}" = "Y" ]; then
 | 
			
		||||
            _info "Starting upgrade WireGuard"
 | 
			
		||||
            install_wg_2
 | 
			
		||||
                systemctl restart wg-quick@${SERVER_WG_NIC}
 | 
			
		||||
                echo "Update WireGuard completed"
 | 
			
		||||
            _error_detect "systemctl restart wg-quick@${SERVER_WG_NIC}"
 | 
			
		||||
            _info "Update WireGuard completed"
 | 
			
		||||
        else
 | 
			
		||||
                echo "Update WireGuard canceled"
 | 
			
		||||
            _info "There is no update available for WireGuard"
 | 
			
		||||
        fi
 | 
			
		||||
    else
 | 
			
		||||
            echo "No updates needed to update WireGuard"
 | 
			
		||||
        fi
 | 
			
		||||
        _red "WireGuard was not installed, maybe you need to install it at first\n"
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user