Using umu-run binary now

This commit is contained in:
Faugus
2025-08-05 23:53:09 -03:00
parent 6391215886
commit 2bf3b65eab
6 changed files with 115 additions and 67 deletions

View File

@@ -5,88 +5,116 @@ import requests
import tarfile
import shutil
UMU_URL_TEMPLATE = "https://github.com/Faugus/umu-launcher/releases/download/{}/umu-run"
UMU_VERSION_API = "https://api.github.com/repos/Faugus/umu-launcher/releases"
xdg_data_home = os.getenv("XDG_DATA_HOME", os.path.expanduser("~/.local/share"))
UMU_INSTALL_DIR = os.path.join(xdg_data_home, "faugus-launcher")
UMU_VERSION_FILE = os.path.join(UMU_INSTALL_DIR, "version.txt")
UMU_BIN_PATH = os.path.join(UMU_INSTALL_DIR, "umu-run")
def get_latest_umu_version():
r = requests.get(UMU_VERSION_API)
if r.status_code == 200:
releases = r.json()
if releases:
return releases[0]["tag_name"]
return None
def get_installed_umu_version():
if os.path.exists(UMU_VERSION_FILE):
with open(UMU_VERSION_FILE) as f:
return f.read().strip()
return None
def download_umu_run(version):
os.makedirs(UMU_INSTALL_DIR, exist_ok=True)
url = UMU_URL_TEMPLATE.format(version)
r = requests.get(url)
if r.status_code == 200:
with open(UMU_BIN_PATH, "wb") as f:
f.write(r.content)
os.chmod(UMU_BIN_PATH, 0o755)
with open(UMU_VERSION_FILE, "w") as f:
f.write(version)
print("Updating UMU-Launcher...", version, flush=True)
else:
print("Failed to download UMU-Launcher:", r.status_code, flush=True)
def update_umu():
latest = get_latest_umu_version()
current = get_installed_umu_version()
if latest and (latest != current or not os.path.exists(UMU_BIN_PATH)):
download_umu_run(latest)
else:
print("UMU-Launcher is up to date.", flush=True)
config_dir = os.getenv('XDG_CONFIG_HOME', os.path.expanduser('~/.config'))
# URLs for .tar.gz files
BE_URL = "https://github.com/Faugus/components/releases/download/{}/be.tar.gz"
EAC_URL = "https://github.com/Faugus/components/releases/download/{}/eac.tar.gz"
DOWNLOAD_DIR = f"{config_dir}/faugus-launcher/components"
REPO_URL = "https://api.github.com/repos/Faugus/components/releases/latest"
VERSION_FILE = f"{DOWNLOAD_DIR}/version.txt"
# Function to get the latest version from GitHub releases
def get_latest_version():
response = requests.get(REPO_URL)
if response.status_code == 200:
release_info = response.json()
return release_info['tag_name'] # Returns the latest tag name
return release_info['tag_name']
else:
print(f"Failed to access {REPO_URL}. Status code: {response.status_code}", flush=True)
return None
# Function to get the installed version from a local file
def get_installed_version():
if os.path.exists(VERSION_FILE):
with open(VERSION_FILE, "r") as f:
return f.read().strip()
return None
# Function to download and extract the tar.gz file
def download_and_extract(url, download_dir):
file_name = url.split('/')[-1]
download_path = os.path.join(download_dir, file_name)
# Download the file
response = requests.get(url, stream=True)
if response.status_code == 200:
with open(download_path, "wb") as f:
f.write(response.content)
# Extract the file with a filter to avoid deprecation warning
with tarfile.open(download_path, "r:gz") as tar:
# The filter function now accepts two arguments: tarinfo and path
tar.extractall(path=download_dir, filter=lambda tarinfo, path: tarinfo)
# Remove the .tar.gz file after extraction
os.remove(download_path)
print("Done!", flush=True)
else:
print(f"Failed to download {file_name}. Status code: {response.status_code}", flush=True)
# Function to check for updates
def check_for_updates():
# Get the latest version from GitHub
latest_version = get_latest_version()
installed_version = get_installed_version()
if latest_version:
# Compare the latest version with the installed version
if latest_version != installed_version:
# URLs for the files with the latest version
be_url = BE_URL.format(latest_version)
eac_url = EAC_URL.format(latest_version)
# Remove old directories if they exist
if os.path.exists(DOWNLOAD_DIR):
shutil.rmtree(DOWNLOAD_DIR) # Remove old files
shutil.rmtree(DOWNLOAD_DIR)
os.makedirs(DOWNLOAD_DIR, exist_ok=True)
# Download and extract the files
print("Updating BattlEye...", flush=True)
download_and_extract(be_url, DOWNLOAD_DIR)
print("Updating Easy Anti-Cheat...", flush=True)
download_and_extract(eac_url, DOWNLOAD_DIR)
# Update the version file with the latest version
with open(VERSION_FILE, "w") as f:
f.write(latest_version)
else:
print("Components are up to date.", flush=True)
def main():
# Execute the update check
update_umu()
check_for_updates()
if __name__ == "__main__":

View File

@@ -115,7 +115,7 @@ ea_icon = PathManager.get_icon('faugus-ea.png')
faugus_run = PathManager.find_binary('faugus-run')
faugus_proton_manager = PathManager.find_binary('faugus-proton-manager')
umu_run = PathManager.find_binary('umu-run')
umu_run = PathManager.user_data('faugus-launcher/umu-run')
mangohud_dir = PathManager.find_binary('mangohud')
gamemoderun = PathManager.find_binary('gamemoderun')

View File

@@ -76,10 +76,10 @@ else:
share_dir = PathManager.user_data()
faugus_png = PathManager.get_icon('faugus-launcher.png')
umu_run = PathManager.user_data('faugus-launcher/umu-run')
config_file_dir = PathManager.user_config('faugus-launcher/config.ini')
envar_dir = PathManager.user_config('faugus-launcher/envar.txt')
games_dir = PathManager.user_config('faugus-launcher/games.json')
umu_run = PathManager.find_binary('umu-run')
faugus_launcher_dir = PathManager.user_config('faugus-launcher')
faugus_components = PathManager.find_binary('faugus-components')
faugus_proton_downloader = PathManager.find_binary('faugus-proton-downloader')
@@ -561,8 +561,12 @@ class FaugusRun:
return True
def check_game_output(self, clean_line):
if "Downloading" in clean_line or "Updating BattlEye..." in clean_line or "Updating Easy Anti-Cheat..." in clean_line:
if "Downloading" in clean_line or "Updating BattlEye..." in clean_line or "Updating Easy Anti-Cheat..." in clean_line or "Updating UMU-Launcher..." in clean_line:
self.warning_dialog.show_all()
if "Updating UMU-Launcher..." in clean_line:
self.label.set_text(_("Updating UMU-Launcher..."))
if "UMU-Launcher is up to date." in clean_line:
self.label.set_text(_("UMU-Launcher is up to date"))
if "Updating BattlEye..." in clean_line:
self.label.set_text(_("Updating BattlEye..."))
if "Updating Easy Anti-Cheat..." in clean_line:

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-11 19:48-0300\n"
"POT-Creation-Date: 2025-08-05 23:34-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,84 +17,92 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: /usr/bin/faugus-run:212
#: /usr/bin/faugus-run:216
#, python-format
msgid "%s was not found."
msgstr ""
#: /usr/bin/faugus-run:216
#: /usr/bin/faugus-run:220
msgid "Please install it or use another Proton version."
msgstr ""
#: /usr/bin/faugus-run:219 /usr/bin/faugus-run:632
#: /usr/bin/faugus-run:223 /usr/bin/faugus-run:655
msgid "Ok"
msgstr ""
#: /usr/bin/faugus-run:473
#: /usr/bin/faugus-run:492
#, python-format
msgid "Using %s"
msgstr ""
#: /usr/bin/faugus-run:548
#: /usr/bin/faugus-run:567
msgid "Updating UMU-Launcher..."
msgstr ""
#: /usr/bin/faugus-run:569
msgid "UMU-Launcher is up to date"
msgstr ""
#: /usr/bin/faugus-run:571
msgid "Updating BattlEye..."
msgstr ""
#: /usr/bin/faugus-run:550
#: /usr/bin/faugus-run:573
msgid "Updating Easy Anti-Cheat..."
msgstr ""
#: /usr/bin/faugus-run:552
#: /usr/bin/faugus-run:575
msgid "Components are up to date"
msgstr ""
#: /usr/bin/faugus-run:554
#: /usr/bin/faugus-run:577
msgid "Downloading GE-Proton..."
msgstr ""
#: /usr/bin/faugus-run:556
#: /usr/bin/faugus-run:579
msgid "Downloading UMU-Proton..."
msgstr ""
#: /usr/bin/faugus-run:558
#: /usr/bin/faugus-run:581
msgid "Downloading Steam Runtime..."
msgstr ""
#: /usr/bin/faugus-run:560
#: /usr/bin/faugus-run:583
msgid "Extracting Steam Runtime..."
msgstr ""
#: /usr/bin/faugus-run:562
#: /usr/bin/faugus-run:585
msgid "Extracting GE-Proton..."
msgstr ""
#: /usr/bin/faugus-run:564
#: /usr/bin/faugus-run:587
msgid "Extracting UMU-Proton..."
msgstr ""
#: /usr/bin/faugus-run:566 /usr/bin/faugus-run:572
#: /usr/bin/faugus-run:589 /usr/bin/faugus-run:595
msgid "GE-Proton is up to date"
msgstr ""
#: /usr/bin/faugus-run:568 /usr/bin/faugus-run:574
#: /usr/bin/faugus-run:591 /usr/bin/faugus-run:597
msgid "UMU-Proton is up to date"
msgstr ""
#: /usr/bin/faugus-run:570 /usr/bin/faugus-run:576
#: /usr/bin/faugus-run:593 /usr/bin/faugus-run:599
msgid "Steam Runtime is up to date"
msgstr ""
#: /usr/bin/faugus-run:578
#: /usr/bin/faugus-run:601
msgid "Downloading Proton-EM..."
msgstr ""
#: /usr/bin/faugus-run:580
#: /usr/bin/faugus-run:603
msgid "Extracting Proton-EM..."
msgstr ""
#: /usr/bin/faugus-run:582
#: /usr/bin/faugus-run:605
msgid "Proton-EM is up to date"
msgstr ""
#: /usr/bin/faugus-run:629
#: /usr/bin/faugus-run:652
msgid "The keys and values were successfully added to the registry."
msgstr ""

Binary file not shown.

View File

@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-11 19:48-0300\n"
"PO-Revision-Date: 2025-07-11 19:49-0300\n"
"POT-Creation-Date: 2025-08-05 23:34-0300\n"
"PO-Revision-Date: 2025-08-05 23:35-0300\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pt_BR\n"
@@ -18,84 +18,92 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.6\n"
#: /usr/bin/faugus-run:212
#: /usr/bin/faugus-run:216
#, python-format
msgid "%s was not found."
msgstr "%s não encontrado."
#: /usr/bin/faugus-run:216
#: /usr/bin/faugus-run:220
msgid "Please install it or use another Proton version."
msgstr "Por favor instale-o ou use outra versão do Proton."
#: /usr/bin/faugus-run:219 /usr/bin/faugus-run:632
#: /usr/bin/faugus-run:223 /usr/bin/faugus-run:655
msgid "Ok"
msgstr "Confirmar"
#: /usr/bin/faugus-run:473
#: /usr/bin/faugus-run:492
#, python-format
msgid "Using %s"
msgstr "Usando %s"
#: /usr/bin/faugus-run:548
#: /usr/bin/faugus-run:567
msgid "Updating UMU-Launcher..."
msgstr "Atualizando UMU-Launcher..."
#: /usr/bin/faugus-run:569
msgid "UMU-Launcher is up to date"
msgstr "UMU-Launcher está atualizado"
#: /usr/bin/faugus-run:571
msgid "Updating BattlEye..."
msgstr "Atualizando BattlEye..."
#: /usr/bin/faugus-run:550
#: /usr/bin/faugus-run:573
msgid "Updating Easy Anti-Cheat..."
msgstr "Atualizando Easy Anti-Cheat..."
#: /usr/bin/faugus-run:552
#: /usr/bin/faugus-run:575
msgid "Components are up to date"
msgstr "Componentes estão atualizados"
#: /usr/bin/faugus-run:554
#: /usr/bin/faugus-run:577
msgid "Downloading GE-Proton..."
msgstr "Baixando GE-Proton..."
#: /usr/bin/faugus-run:556
#: /usr/bin/faugus-run:579
msgid "Downloading UMU-Proton..."
msgstr "Baixando UMU-Proton..."
#: /usr/bin/faugus-run:558
#: /usr/bin/faugus-run:581
msgid "Downloading Steam Runtime..."
msgstr "Baixando Steam Runtime..."
#: /usr/bin/faugus-run:560
#: /usr/bin/faugus-run:583
msgid "Extracting Steam Runtime..."
msgstr "Extraindo Steam Runtime..."
#: /usr/bin/faugus-run:562
#: /usr/bin/faugus-run:585
msgid "Extracting GE-Proton..."
msgstr "Extraindo GE-Proton..."
#: /usr/bin/faugus-run:564
#: /usr/bin/faugus-run:587
msgid "Extracting UMU-Proton..."
msgstr "Extraindo UMU-Proton..."
#: /usr/bin/faugus-run:566 /usr/bin/faugus-run:572
#: /usr/bin/faugus-run:589 /usr/bin/faugus-run:595
msgid "GE-Proton is up to date"
msgstr "GE-Proton está atualizado"
#: /usr/bin/faugus-run:568 /usr/bin/faugus-run:574
#: /usr/bin/faugus-run:591 /usr/bin/faugus-run:597
msgid "UMU-Proton is up to date"
msgstr "UMU-Proton está atualizado"
#: /usr/bin/faugus-run:570 /usr/bin/faugus-run:576
#: /usr/bin/faugus-run:593 /usr/bin/faugus-run:599
msgid "Steam Runtime is up to date"
msgstr "Steam Runtime está atualizado"
#: /usr/bin/faugus-run:578
#: /usr/bin/faugus-run:601
msgid "Downloading Proton-EM..."
msgstr "Baixando Proton-EM..."
#: /usr/bin/faugus-run:580
#: /usr/bin/faugus-run:603
msgid "Extracting Proton-EM..."
msgstr "Extraindo Proton-EM..."
#: /usr/bin/faugus-run:582
#: /usr/bin/faugus-run:605
msgid "Proton-EM is up to date"
msgstr "Proton-EM está atualizado"
#: /usr/bin/faugus-run:629
#: /usr/bin/faugus-run:652
msgid "The keys and values were successfully added to the registry."
msgstr "As chaves e valores foram adicionados ao registro corretamente."