47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
from setuphelpers import *
|
|
from setupdevhelpers import *
|
|
|
|
|
|
def update_package():
|
|
# Declaring local variables
|
|
package_updated = False
|
|
proxies = get_proxies()
|
|
if not proxies:
|
|
proxies = get_proxies_from_wapt_console()
|
|
download_url = control.sources
|
|
latest_bin = "rustdesk.exe"
|
|
|
|
# Deleting binaries
|
|
remove_outdated_binaries("*")
|
|
|
|
# Downloading latest binaries
|
|
print("Download URL is: %s" % download_url)
|
|
if not isfile(latest_bin):
|
|
print("Downloading: %s" % latest_bin)
|
|
wget(download_url, latest_bin, proxies=proxies)
|
|
else:
|
|
print("Binary is present: %s" % latest_bin)
|
|
|
|
# Checking version from file
|
|
if get_os_name() == "Windows" and "windows" in control.target_os.lower():
|
|
file_version = get_file_properties(latest_bin)["FileVersion"]
|
|
if len(file_version.split(".")) > 3:
|
|
version = ".".join(file_version.split(".")[:3])
|
|
else:
|
|
version = file_version
|
|
else:
|
|
version = control.get_software_version()
|
|
|
|
# Changing version of the package
|
|
if Version(version, 4) > Version(control.get_software_version(), 4):
|
|
print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
|
|
package_updated = True
|
|
else:
|
|
print("Software version up-to-date (%s)" % Version(version))
|
|
control.set_software_version(version)
|
|
control.save_control_to_wapt()
|
|
|
|
# Validating update-package-sources
|
|
return package_updated
|