mirror of
https://github.com/FAUSheppy/homelab_gamevault
synced 2025-12-06 06:51:36 +01:00
feat: support linux & basic wine functions
This commit is contained in:
@@ -4,6 +4,7 @@ import yaml
|
||||
import software
|
||||
import ftplib
|
||||
import tqdm
|
||||
import ssl
|
||||
|
||||
class SESSION_REUSE_FTP_TLS(ftplib.FTP_TLS):
|
||||
"""Explicit FTPS, with shared TLS session"""
|
||||
@@ -138,6 +139,7 @@ class FTP(DataBackend):
|
||||
ftp = ftplib.FTP()
|
||||
else:
|
||||
ftp = SESSION_REUSE_FTP_TLS()
|
||||
ftp.ssl_version = ssl.PROTOCOL_TLSv1_2
|
||||
|
||||
ftp.connect(server, port=port or 0)
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
|
||||
# windows imports #
|
||||
if os.name == "nt":
|
||||
import win32com.client
|
||||
else:
|
||||
os.environ.update({"WINEARCH": "win64"})
|
||||
|
||||
def _template_registry_file(template_file, game_path=None):
|
||||
'''Template the registry file before installation'''
|
||||
@@ -16,9 +22,15 @@ def install_registry_file(registry_file, game_path=None):
|
||||
# test path:
|
||||
# ./example_software_root/FreeDink/registry_files/game_path_example_1.reg
|
||||
|
||||
if sys.platform.startswith("linux"):
|
||||
p = subprocess.Popen(["wine64", "start", "regedit", registry_file],
|
||||
subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
||||
print("Running regedit for wine..")
|
||||
else:
|
||||
# windows sucky sucky #
|
||||
if not os.path.isabs(registry_file):
|
||||
registry_file = os.path.join(os.getcwd(), registry_file)
|
||||
|
||||
p = subprocess.Popen(["python", "regedit.py", registry_file],
|
||||
subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
||||
|
||||
@@ -29,13 +41,21 @@ def install_extra_files(extra_files_list, path):
|
||||
pass
|
||||
|
||||
def resolve_lnk(lnk_file_path):
|
||||
|
||||
if os.name == "nt":
|
||||
shell = win32com.client.Dispatch("WScript.Shell")
|
||||
shortcut = shell.CreateShortcut(lnk_file_path)
|
||||
return shortcut.TargetPath
|
||||
else:
|
||||
return lnk_file_path # not required on linux
|
||||
|
||||
def run_exe(path, synchronous=False):
|
||||
'''Launches a given software'''
|
||||
|
||||
if os.name != "nt":
|
||||
subprocess.Popen(["wine64", path], cwd=os.path.dirname(path))
|
||||
return
|
||||
|
||||
if synchronous:
|
||||
raise NotImplementedError("SYNC not yet implemented")
|
||||
|
||||
|
||||
@@ -4,4 +4,4 @@ customtkinter
|
||||
tqdm
|
||||
Jinja2
|
||||
pyyaml
|
||||
pywin32
|
||||
pywin32==<version>; platform_system=="Windows"
|
||||
|
||||
Reference in New Issue
Block a user