From 5a54b9383d330f372d3866346bf100563858539a Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Sat, 26 Oct 2024 02:35:30 -0700 Subject: [PATCH 01/26] fix: renaming icu file with version Pros: - removes need for state file - doesn't rely on the name of the released icu tarball - similar handling to how we download the Logos msi installer today Cons: - ? Fixes: #220 --- ou_dedetai/wine.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/ou_dedetai/wine.py b/ou_dedetai/wine.py index d2aac240..68ae1ca1 100644 --- a/ou_dedetai/wine.py +++ b/ou_dedetai/wine.py @@ -441,20 +441,12 @@ def enforce_icu_data_files(app=None): icu_url = network.get_first_asset_url(json_data) icu_latest_version = network.get_tag_name(json_data).lstrip('v') - # This file with the tag name of the downloaded release. If it doesn't match latest override the ICU files then write this file - config_dir = os.path.expanduser(f"~/.local/state/FaithLife-Community/") - icu_version_path = Path(f"{config_dir}/ICU_Version.txt") - if icu_version_path.exists() and icu_version_path.read_text().strip() == f"{repo}\n{icu_latest_version}": - logging.debug(f"ICU Data files already up to date, no need to install.") - if hasattr(app, 'status_evt'): - app.status_q.put("ICU files were already up to date.") - app.root.event_generate(app.status_evt) - return - if icu_url is None: logging.critical(f"Unable to set {config.name_app} release without URL.") # noqa: E501 return - icu_filename = os.path.basename(icu_url) + icu_filename = os.path.basename(icu_url).removesuffix(".tar.gz") + # Append the version to the file name so it doesn't collide with previous versions + icu_filename = f"{icu_filename}-{icu_latest_version}.tar.gz" network.logos_reuse_download( icu_url, icu_filename, @@ -462,7 +454,7 @@ def enforce_icu_data_files(app=None): app=app ) drive_c = f"{config.INSTALLDIR}/data/wine64_bottle/drive_c" - utils.untar_file(f"{config.MYDOWNLOADS}/icu-win.tar.gz", drive_c) + utils.untar_file(f"{config.MYDOWNLOADS}/{icu_filename}", drive_c) # Ensure the target directory exists icu_win_dir = f"{drive_c}/icu-win/windows" @@ -474,8 +466,6 @@ def enforce_icu_data_files(app=None): app.status_q.put("ICU files copied.") app.root.event_generate(app.status_evt) - icu_version_path.write_text(f"{repo}\n{icu_latest_version}") - if app: if config.DIALOG == "curses": app.install_icu_e.set() From 68f9032e930229595cffeb975fb286a3e7b4077f Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Wed, 6 Nov 2024 14:18:11 -0800 Subject: [PATCH 02/26] fix: also ensure icu files are up to date in update check --- ou_dedetai/network.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ou_dedetai/network.py b/ou_dedetai/network.py index 02e731ed..1b5cd068 100644 --- a/ou_dedetai/network.py +++ b/ou_dedetai/network.py @@ -14,6 +14,8 @@ from urllib.parse import urlparse from xml.etree import ElementTree as ET +from ou_dedetai import wine + from . import config from . import msg from . import utils @@ -468,6 +470,7 @@ def check_for_updates(): set_logoslinuxinstaller_latest_release_config() utils.compare_logos_linux_installer_version() set_recommended_appimage_config() + wine.enforce_icu_data_files() config.LAST_UPDATED = now.isoformat() utils.write_config(config.CONFIG_FILE) From ac0708563edbd04e6e0b44e0e0a7b0cdadd7b589 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Thu, 7 Nov 2024 08:16:46 -0500 Subject: [PATCH 03/26] Update version and changelog --- CHANGELOG.md | 2 ++ ou_dedetai/config.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f56b9bf1..1c3b1eed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +- 4.0.0-beta.4 + - Fix #224 [N. Shaaban] - 4.0.0-beta.3 - Fix various regressions from beta (e.g., #209, #213) [N. Shaaban] - Fix #191 [N. Shaaban] diff --git a/ou_dedetai/config.py b/ou_dedetai/config.py index 5bd2aa99..fb971b76 100644 --- a/ou_dedetai/config.py +++ b/ou_dedetai/config.py @@ -73,7 +73,7 @@ os.path.expanduser("~/.config/Logos_on_Linux/Logos_on_Linux.conf") # noqa: E501 ] LLI_AUTHOR = "Ferion11, John Goodman, T. H. Wright, N. Marti" -LLI_CURRENT_VERSION = "4.0.0-beta.3" +LLI_CURRENT_VERSION = "4.0.0-beta.4" LLI_LATEST_VERSION: Optional[str] = None LLI_TITLE = name_app LOG_LEVEL = logging.WARNING From 34eda754714612e74db0786bb5359cbdb79ab87d Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Mon, 11 Nov 2024 07:01:18 -0500 Subject: [PATCH 04/26] Typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c3b1eed..d302bf29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog - 4.0.0-beta.4 - - Fix #224 [N. Shaaban] + - Fix #220 [N. Shaaban] - 4.0.0-beta.3 - Fix various regressions from beta (e.g., #209, #213) [N. Shaaban] - Fix #191 [N. Shaaban] From 961fb112d81863cb53739ba48755de3b56b3cd44 Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Thu, 14 Nov 2024 14:05:13 +0100 Subject: [PATCH 05/26] add 'samba' to arch deps --- ou_dedetai/system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index f6f4047c..8eed6e85 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -370,7 +370,7 @@ def get_package_manager(): # config.PACKAGES = "patch wget sed grep cabextract samba glibc samba apparmor libcurl-gnutls winetricks appmenu-gtk-module lib32-libjpeg-turbo wine giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama ncurses lib32-ncurses ocl-icd lib32-ocl-icd libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader" # noqa: E501 config.PACKAGES = ( "fuse2 fuse3 " # appimages - "binutils cabextract wget libwbclient " # wine + "binutils cabextract libwbclient samba wget " # wine "p7zip " # winetricks "openjpeg2 libxcomposite libxinerama " # display "ocl-icd vulkan-icd-loader " # hardware From e0d2776833a712277b8ac3736522e91f68847b7f Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Thu, 14 Nov 2024 23:30:18 +0000 Subject: [PATCH 06/26] fix: ensure local desktop file directory exists Fixes: #230 --- ou_dedetai/installer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ou_dedetai/installer.py b/ou_dedetai/installer.py index ff5fda41..11e8e85e 100644 --- a/ou_dedetai/installer.py +++ b/ou_dedetai/installer.py @@ -776,6 +776,8 @@ def create_desktop_file(name, contents): if launcher_path.is_file(): logging.info(f"Removing desktop launcher at {launcher_path}.") launcher_path.unlink() + # Ensure the parent directory exists + launcher_path.parent.mkdir(parents=True) logging.info(f"Creating desktop launcher at {launcher_path}.") with launcher_path.open('w') as f: From 8aaf85dd320f58c8378dec124544d95ba9885c85 Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Sun, 17 Nov 2024 03:55:42 +0000 Subject: [PATCH 07/26] Fix: exit on --- ou_dedetai/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ou_dedetai/installer.py b/ou_dedetai/installer.py index 11e8e85e..1edfc134 100644 --- a/ou_dedetai/installer.py +++ b/ou_dedetai/installer.py @@ -777,7 +777,7 @@ def create_desktop_file(name, contents): logging.info(f"Removing desktop launcher at {launcher_path}.") launcher_path.unlink() # Ensure the parent directory exists - launcher_path.parent.mkdir(parents=True) + launcher_path.parent.mkdir(parents=True, exist_ok=True) logging.info(f"Creating desktop launcher at {launcher_path}.") with launcher_path.open('w') as f: From 445ab0dbebb992bbffcee2ad5660cb3a17817c7f Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Mon, 18 Nov 2024 17:37:13 +0100 Subject: [PATCH 08/26] make dependencies lists more precise --- ou_dedetai/system.py | 141 +++++++++++++++++++++++++++---------------- 1 file changed, 89 insertions(+), 52 deletions(-) diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index 8eed6e85..993dbf34 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -17,7 +17,7 @@ # TODO: Replace functions in control.py and wine.py with Popen command. -def run_command(command, retries=1, delay=0, **kwargs) -> Optional[subprocess.CompletedProcess[any]]: +def run_command(command, retries=1, delay=0, **kwargs) -> Optional[subprocess.CompletedProcess[any]]: # noqa: E501 check = kwargs.get("check", True) text = kwargs.get("text", True) capture_output = kwargs.get("capture_output", True) @@ -314,15 +314,36 @@ def get_superuser_command(): def get_package_manager(): - # Check for package manager and associated packages - if shutil.which('apt') is not None: # debian, ubuntu + major_ver = distro.major_version() + logging.debug(f"{config.OS_NAME=}; {major_ver=}") + # Check for package manager and associated packages. + # NOTE: cabextract and sed are included in the appimage, so they have been + # removed from the dependencies lists. + if shutil.which('apt') is not None: # debian, ubuntu, & derivatives config.PACKAGE_MANAGER_COMMAND_INSTALL = ["apt", "install", "-y"] config.PACKAGE_MANAGER_COMMAND_DOWNLOAD = ["apt", "install", "--download-only", "-y"] # noqa: E501 config.PACKAGE_MANAGER_COMMAND_REMOVE = ["apt", "remove", "-y"] config.PACKAGE_MANAGER_COMMAND_QUERY = ["dpkg", "-l"] config.QUERY_PREFIX = '.i ' - # NOTE: in 24.04 "p7zip-full" pkg is transitional toward "7zip" - config.PACKAGES = "binutils cabextract fuse3 p7zip-full wget winbind" + # Set default package list. + config.PACKAGES = ( + "libfuse2 " # appimages + "binutils wget winbind " # wine + "p7zip-full " # winetricks + ) + # NOTE: Package names changed together for Ubuntu 24+, Debian 13+, and + # derivatives. This does not include an exhaustive list of distros that + # use 'apt', so others will have to be added as users report issues. + if ( + (config.OS_NAME == 'ubuntu' and major_ver >= '24') + or (config.OS_NAME == 'debian' and major_ver >= '13') + or (config.OS_NAME == 'elementary' and major_ver >= '8') + ): + config.PACKAGES = ( + "libfuse2t64 " # appimages + "binutils wget winbind " # wine + "7zip " # winetricks + ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages config.BADPACKAGES = "" # appimagelauncher handled separately elif shutil.which('dnf') is not None: # rhel, fedora @@ -334,8 +355,8 @@ def get_package_manager(): config.QUERY_PREFIX = '' # config.PACKAGES = "patch fuse3 fuse3-libs mod_auth_ntlm_winbind samba-winbind samba-winbind-clients cabextract bc libxml2 curl" # noqa: E501 config.PACKAGES = ( - "fuse3 fuse3-libs " # appimages - "mod_auth_ntlm_winbind samba-winbind samba-winbind-clients cabextract " # wine # noqa: E501 + "fuse-libs " # appimages + "mod_auth_ntlm_winbind samba-winbind samba-winbind-clients " # wine # noqa: E501 "p7zip-plugins " # winetricks ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages @@ -346,7 +367,12 @@ def get_package_manager(): config.PACKAGE_MANAGER_COMMAND_REMOVE = ["zypper", "--non-interactive", "remove"] # noqa: E501 config.PACKAGE_MANAGER_COMMAND_QUERY = ["zypper", "se", "-si"] config.QUERY_PREFIX = 'i | ' - config.PACKAGES = "fuse patch wget sed grep gawk cabextract 7zip samba curl" # noqa: E501 + config.PACKAGES = ( + "fuse2 " # appimages + "samba wget " # wine + "7zip " # winetricks + "curl gawk grep patch " # other + ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages config.BADPACKAGES = "" # appimagelauncher handled separately elif shutil.which('pamac') is not None: # manjaro @@ -355,7 +381,12 @@ def get_package_manager(): config.PACKAGE_MANAGER_COMMAND_REMOVE = ["pamac", "remove", "--no-confirm"] # noqa: E501 config.PACKAGE_MANAGER_COMMAND_QUERY = ["pamac", "list", "-i"] config.QUERY_PREFIX = '' - config.PACKAGES = "patch wget sed grep gawk cabextract p7zip samba bc libxml2 curl" # noqa: E501 + config.PACKAGES = ( + "fuse2 " # appimages + "samba wget " # wine + "p7zip " # winetricks + "bc curl gawk grep libxml2 patch " # other + ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages config.BADPACKAGES = "" # appimagelauncher handled separately elif shutil.which('pacman') is not None: # arch, steamOS @@ -369,8 +400,8 @@ def get_package_manager(): else: # arch # config.PACKAGES = "patch wget sed grep cabextract samba glibc samba apparmor libcurl-gnutls winetricks appmenu-gtk-module lib32-libjpeg-turbo wine giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama ncurses lib32-ncurses ocl-icd lib32-ocl-icd libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader" # noqa: E501 config.PACKAGES = ( - "fuse2 fuse3 " # appimages - "binutils cabextract libwbclient samba wget " # wine + "fuse2 " # appimages + "binutils libwbclient samba wget " # wine "p7zip " # winetricks "openjpeg2 libxcomposite libxinerama " # display "ocl-icd vulkan-icd-loader " # hardware @@ -380,7 +411,9 @@ def get_package_manager(): ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages config.BADPACKAGES = "" # appimagelauncher handled separately - # Add more conditions for other package managers as needed + else: + # Add more conditions for other package managers as needed. + msg.logos_error("Your package manager is not yet supported. Please contact the developers.") # noqa: E501 # Add logging output. logging.debug(f"{config.PACKAGE_MANAGER_COMMAND_INSTALL=}") @@ -649,16 +682,18 @@ def install_dependencies(packages, bad_packages, logos9_packages=None, app=None) preinstall_command = preinstall_dependencies() - # libfuse: for AppImage use. This is the only known needed library. - if config.OS_NAME == "fedora": - fuse = "fuse" - else: - fuse = "libfuse" + # TODO: Remove the code below when it's confirmed that libfuse is + # properly handled in get_package_manager(). + # # libfuse: for AppImage use. This is the only known needed library. + # if config.OS_NAME == "fedora": + # fuse = "fuse" + # else: + # fuse = "libfuse" - fuse_lib_installed = check_libs([f"{fuse}"], app=app) - logging.debug(f"{fuse_lib_installed=}") - # if not fuse_lib_installed: - # missing_packages.append(fuse) + # fuse_lib_installed = check_libs([f"{fuse}"], app=app) + # logging.debug(f"{fuse_lib_installed=}") + # # if not fuse_lib_installed: + # # missing_packages.append(fuse) if missing_packages: install_command = config.PACKAGE_MANAGER_COMMAND_INSTALL + missing_packages # noqa: E501 @@ -779,37 +814,39 @@ def install_dependencies(packages, bad_packages, logos9_packages=None, app=None) if config.DIALOG == "curses": app.installdeps_e.set() - -def have_lib(library, ld_library_path): - available_library_paths = ['/usr/lib', '/lib'] - if ld_library_path is not None: - available_library_paths = [*ld_library_path.split(':'), *available_library_paths] # noqa: E501 - - roots = [root for root in available_library_paths if not Path(root).is_symlink()] # noqa: E501 - logging.debug(f"Library Paths: {roots}") - for root in roots: - libs = [] - logging.debug(f"Have lib? Checking {root}") - for lib in Path(root).rglob(f"{library}*"): - logging.debug(f"DEV: {lib}") - libs.append(lib) - break - if len(libs) > 0: - logging.debug(f"'{library}' found at '{libs[0]}'") - return True - return False - - -def check_libs(libraries, app=None): - ld_library_path = os.environ.get('LD_LIBRARY_PATH') - for library in libraries: - have_lib_result = have_lib(library, ld_library_path) - if have_lib_result: - logging.info(f"* {library} is installed!") - return True - else: - logging.info(f"* {library} is not installed!") - return False +# TODO: Remove the code below when it's confirmed that libfuse is +# properly handled in get_package_manager(). +# def have_lib(library, ld_library_path): +# available_library_paths = ['/usr/lib', '/lib'] +# if ld_library_path is not None: +# available_library_paths = [*ld_library_path.split(':'), *available_library_paths] # noqa: E501 + +# roots = [root for root in available_library_paths if not Path(root).is_symlink()] # noqa: E501 +# logging.debug(f"Library Paths: {roots}") +# for root in roots: +# libs = [] +# logging.debug(f"Have lib? Checking {root}") +# for lib in Path(root).rglob(f"{library}*"): +# logging.debug(f"DEV: {lib}") +# libs.append(lib) +# break +# if len(libs) > 0: +# logging.debug(f"'{library}' found at '{libs[0]}'") +# return True +# return False + +# TODO: Remove the code below when it's confirmed that libfuse is +# properly handled in get_package_manager(). +# def check_libs(libraries, app=None): +# ld_library_path = os.environ.get('LD_LIBRARY_PATH') +# for library in libraries: +# have_lib_result = have_lib(library, ld_library_path) +# if have_lib_result: +# logging.info(f"* {library} is installed!") +# return True +# else: +# logging.info(f"* {library} is not installed!") +# return False def install_winetricks( From e91d6c8569c80b5575cd3ebb15cab755b6a435f2 Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Mon, 18 Nov 2024 20:04:37 +0100 Subject: [PATCH 09/26] use correct libfuse package for ubuntu 24+ --- ou_dedetai/system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index 993dbf34..4b93f295 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -340,7 +340,7 @@ def get_package_manager(): or (config.OS_NAME == 'elementary' and major_ver >= '8') ): config.PACKAGES = ( - "libfuse2t64 " # appimages + "libfuse3-3 " # appimages "binutils wget winbind " # wine "7zip " # winetricks ) From b5d53675ad1edf4b4babbd201af2e419475c1a41 Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Tue, 19 Nov 2024 15:41:59 +0100 Subject: [PATCH 10/26] fix fedora dependencies --- ou_dedetai/system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index 4b93f295..4f081707 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -355,7 +355,7 @@ def get_package_manager(): config.QUERY_PREFIX = '' # config.PACKAGES = "patch fuse3 fuse3-libs mod_auth_ntlm_winbind samba-winbind samba-winbind-clients cabextract bc libxml2 curl" # noqa: E501 config.PACKAGES = ( - "fuse-libs " # appimages + "fuse fuse-libs " # appimages "mod_auth_ntlm_winbind samba-winbind samba-winbind-clients " # wine # noqa: E501 "p7zip-plugins " # winetricks ) From 6feab0b0a4531fb8d88e1511163574b0ecd25bfe Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Thu, 21 Nov 2024 13:14:12 +0100 Subject: [PATCH 11/26] add script --- scripts/distro-info.sh | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 scripts/distro-info.sh diff --git a/scripts/distro-info.sh b/scripts/distro-info.sh new file mode 100755 index 00000000..586cff77 --- /dev/null +++ b/scripts/distro-info.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# Creates a text file at ~/distro-info.log with output from python's distro +# module and from various known text files that give distro details. This is +# is intended to cover as many Linux distributions as possible. + +# Initialize log file. +logfile=~/distro-info.log +date --utc > "$logfile" +echo >> "$logfile" + +# Determine python executable. +python=python +if which python3 >/dev/null; then + python=python3 +fi + +# Record python's distro output. +if which $python >/dev/null && $python -c 'import distro' 2>/dev/null; then + $python -c 'import distro; print(f"{distro.info()=}")' >> "$logfile" + $python -c 'import distro; print(f"{distro.os_release_info()=}")' >> "$logfile" + $python -c 'import distro; print(f"{distro.lsb_release_info()=}")' >> "$logfile" + $python -c 'import distro; print(f"{distro.distro_release_info()=}")' >> "$logfile" + $python -c 'import distro; print(f"{distro.uname_info()=}")' >> "$logfile" + echo >> "$logfile" +fi + +# As a fallback, gather [mostly] the same info that python.distro gathers. +# Ref: https://distro.readthedocs.io/en/latest/#data-sources +if [ -r /etc/os-release ]; then + echo /etc/os-release >> "$logfile" + cat /etc/os-release >> "$logfile" + echo >> "$logfile" +elif [ -r /usr/lib/os-release ]; then + echo /usr/lib/os-release >> "$logfile" + cat /usr/lib/os-release >> "$logfile" + echo >> "$logfile" +fi + +if which lsb_release >/dev/null 2>&1; then + echo "lsb_release -a" >> "$logfile" + lsb_release -a >> "$logfile" + echo >> "$logfile" +fi + +if which uname >/dev/null; then + echo "uname -rs" >> "$logfile" + uname -rs >> "$logfile" + echo >> "$logfile" +fi From de641f45dc946e18983cb3b817891582d2743db8 Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Fri, 22 Nov 2024 09:08:05 +0100 Subject: [PATCH 12/26] add linuxmint to version check for updated package names --- ou_dedetai/system.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index 4f081707..df56fbb7 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -334,9 +334,15 @@ def get_package_manager(): # NOTE: Package names changed together for Ubuntu 24+, Debian 13+, and # derivatives. This does not include an exhaustive list of distros that # use 'apt', so others will have to be added as users report issues. + # Ref: + # - https://askubuntu.com/a/445496 + # - https://en.wikipedia.org/wiki/Linux_Mint + # - https://en.wikipedia.org/wiki/Elementary_OS + # - https://github.com/which-distro/os-release/tree/main if ( - (config.OS_NAME == 'ubuntu' and major_ver >= '24') - or (config.OS_NAME == 'debian' and major_ver >= '13') + (config.OS_NAME == 'debian' and major_ver >= '13') + or (config.OS_NAME == 'ubuntu' and major_ver >= '24') + or (config.OS_NAME == 'linuxmint' and major_ver >= '22') or (config.OS_NAME == 'elementary' and major_ver >= '8') ): config.PACKAGES = ( @@ -371,7 +377,7 @@ def get_package_manager(): "fuse2 " # appimages "samba wget " # wine "7zip " # winetricks - "curl gawk grep patch " # other + "curl gawk grep " # other ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages config.BADPACKAGES = "" # appimagelauncher handled separately @@ -385,7 +391,7 @@ def get_package_manager(): "fuse2 " # appimages "samba wget " # wine "p7zip " # winetricks - "bc curl gawk grep libxml2 patch " # other + "curl gawk grep " # other ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages config.BADPACKAGES = "" # appimagelauncher handled separately From 12e83f3ded0534994991f6e7630cdde39d8172cc Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Sat, 23 Nov 2024 06:27:19 +0100 Subject: [PATCH 13/26] update comments --- ou_dedetai/system.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index df56fbb7..88c7475f 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -317,8 +317,8 @@ def get_package_manager(): major_ver = distro.major_version() logging.debug(f"{config.OS_NAME=}; {major_ver=}") # Check for package manager and associated packages. - # NOTE: cabextract and sed are included in the appimage, so they have been - # removed from the dependencies lists. + # NOTE: cabextract and sed are included in the appimage, so they are not + # included as system dependencies. if shutil.which('apt') is not None: # debian, ubuntu, & derivatives config.PACKAGE_MANAGER_COMMAND_INSTALL = ["apt", "install", "-y"] config.PACKAGE_MANAGER_COMMAND_DOWNLOAD = ["apt", "install", "--download-only", "-y"] # noqa: E501 @@ -356,7 +356,13 @@ def get_package_manager(): config.PACKAGE_MANAGER_COMMAND_INSTALL = ["dnf", "install", "-y"] config.PACKAGE_MANAGER_COMMAND_DOWNLOAD = ["dnf", "install", "--downloadonly", "-y"] # noqa: E501 config.PACKAGE_MANAGER_COMMAND_REMOVE = ["dnf", "remove", "-y"] + # Fedora < 41 uses dnf4, while Fedora 41 uses dnf5. The dnf list + # command is sligtly different between the two. + # https://discussion.fedoraproject.org/t/after-f41-upgrade-dnf-says-no-packages-are-installed/135391 # noqa: E501 + # Fedora < 41 # config.PACKAGE_MANAGER_COMMAND_QUERY = ["dnf", "list", "installed"] + # Fedora 41 + # config.PACKAGE_MANAGER_COMMAND_QUERY = ["dnf", "list", "--installed"] config.PACKAGE_MANAGER_COMMAND_QUERY = ["rpm", "-qa"] # workaround config.QUERY_PREFIX = '' # config.PACKAGES = "patch fuse3 fuse3-libs mod_auth_ntlm_winbind samba-winbind samba-winbind-clients cabextract bc libxml2 curl" # noqa: E501 From 62520eed9ca15e0d0b2f5a725bb52bf9de7af68e Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Sat, 23 Nov 2024 07:40:35 +0100 Subject: [PATCH 14/26] remove unused system.tl function --- ou_dedetai/system.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index 88c7475f..73513712 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -260,14 +260,6 @@ def reboot(): sys.exit(0) -def tl(library): - try: - __import__(library) - return True - except ImportError: - return False - - def get_dialog(): if not os.environ.get('DISPLAY'): msg.logos_error("The installer does not work unless you are running a display") # noqa: E501 From 14abf75b82eec558c64381b6aeee9c6f6bf46479 Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Sat, 23 Nov 2024 07:41:08 +0100 Subject: [PATCH 15/26] remove unused commented code --- ou_dedetai/system.py | 92 -------------------------------------------- 1 file changed, 92 deletions(-) diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index 73513712..1f1b0861 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -184,35 +184,6 @@ def popen_command(command, retries=1, delay=0, **kwargs): return None -# def wait_on(command): -# try: -# # Start the process in the background -# # TODO: Convert to use popen_command() -# process = subprocess.Popen( -# command, -# stdout=subprocess.PIPE, -# stderr=subprocess.PIPE, -# text=True -# ) -# msg.status(f"Waiting on \"{' '.join(command)}\" to finish.", end='') -# time.sleep(1.0) -# while process.poll() is None: -# msg.logos_progress() -# time.sleep(0.5) -# print() - -# # Process has finished, check the result -# stdout, stderr = process.communicate() - -# if process.returncode == 0: -# logging.info(f"\"{' '.join(command)}\" has ended properly.") -# else: -# logging.error(f"Error: {stderr}") - -# except Exception as e: -# logging.critical(f"{e}") - - def get_pids(query): results = [] for process in psutil.process_iter(['pid', 'name', 'cmdline']): @@ -231,22 +202,6 @@ def get_logos_pids(): config.processes[config.logos_indexer_exe] = get_pids(config.logos_indexer_exe) # noqa: E501 -# def get_pids_using_file(file_path, mode=None): -# # Make list (set) of pids using 'directory'. -# pids = set() -# for proc in psutil.process_iter(['pid', 'open_files']): -# try: -# if mode is not None: -# paths = [f.path for f in proc.open_files() if f.mode == mode] -# else: -# paths = [f.path for f in proc.open_files()] -# if len(paths) > 0 and file_path in paths: -# pids.add(proc.pid) -# except psutil.AccessDenied: -# pass -# return pids - - def reboot(): logging.info("Rebooting system.") command = f"{config.SUPERUSER_COMMAND} reboot now" @@ -686,19 +641,6 @@ def install_dependencies(packages, bad_packages, logos9_packages=None, app=None) preinstall_command = preinstall_dependencies() - # TODO: Remove the code below when it's confirmed that libfuse is - # properly handled in get_package_manager(). - # # libfuse: for AppImage use. This is the only known needed library. - # if config.OS_NAME == "fedora": - # fuse = "fuse" - # else: - # fuse = "libfuse" - - # fuse_lib_installed = check_libs([f"{fuse}"], app=app) - # logging.debug(f"{fuse_lib_installed=}") - # # if not fuse_lib_installed: - # # missing_packages.append(fuse) - if missing_packages: install_command = config.PACKAGE_MANAGER_COMMAND_INSTALL + missing_packages # noqa: E501 else: @@ -818,40 +760,6 @@ def install_dependencies(packages, bad_packages, logos9_packages=None, app=None) if config.DIALOG == "curses": app.installdeps_e.set() -# TODO: Remove the code below when it's confirmed that libfuse is -# properly handled in get_package_manager(). -# def have_lib(library, ld_library_path): -# available_library_paths = ['/usr/lib', '/lib'] -# if ld_library_path is not None: -# available_library_paths = [*ld_library_path.split(':'), *available_library_paths] # noqa: E501 - -# roots = [root for root in available_library_paths if not Path(root).is_symlink()] # noqa: E501 -# logging.debug(f"Library Paths: {roots}") -# for root in roots: -# libs = [] -# logging.debug(f"Have lib? Checking {root}") -# for lib in Path(root).rglob(f"{library}*"): -# logging.debug(f"DEV: {lib}") -# libs.append(lib) -# break -# if len(libs) > 0: -# logging.debug(f"'{library}' found at '{libs[0]}'") -# return True -# return False - -# TODO: Remove the code below when it's confirmed that libfuse is -# properly handled in get_package_manager(). -# def check_libs(libraries, app=None): -# ld_library_path = os.environ.get('LD_LIBRARY_PATH') -# for library in libraries: -# have_lib_result = have_lib(library, ld_library_path) -# if have_lib_result: -# logging.info(f"* {library} is installed!") -# return True -# else: -# logging.info(f"* {library} is not installed!") -# return False - def install_winetricks( installdir, From 39aebb98d5f27f0193cbf82bb5a9ca4468bce0d4 Mon Sep 17 00:00:00 2001 From: Nate Marti Date: Sat, 23 Nov 2024 07:42:04 +0100 Subject: [PATCH 16/26] pep8 fix: remove unneeded comment --- ou_dedetai/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ou_dedetai/utils.py b/ou_dedetai/utils.py index 97dce407..b675d221 100644 --- a/ou_dedetai/utils.py +++ b/ou_dedetai/utils.py @@ -442,7 +442,7 @@ def get_winetricks_options(): # Check if local winetricks version is up-to-date. cmd = ["winetricks", "--version"] local_winetricks_version = subprocess.check_output(cmd).split()[0] - if str(local_winetricks_version) != config.WINETRICKS_VERSION: #noqa: E501 + if str(local_winetricks_version) != config.WINETRICKS_VERSION: winetricks_options.insert(0, local_winetricks_path) else: logging.info("Local winetricks is too old.") From d5e6d48fdb372cce160bebd394469b75673102a4 Mon Sep 17 00:00:00 2001 From: n8marti Date: Sat, 23 Nov 2024 12:28:51 +0100 Subject: [PATCH 17/26] Update autobuild-main.yml --- .github/workflows/autobuild-main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/autobuild-main.yml b/.github/workflows/autobuild-main.yml index e9dc8abf..8fe63a1c 100644 --- a/.github/workflows/autobuild-main.yml +++ b/.github/workflows/autobuild-main.yml @@ -27,7 +27,8 @@ jobs: - name: Upload release to test repo uses: softprops/action-gh-release@v1 with: - tag_name: main-${{ env.DATE }}-${{ needs.build.outputs.sha_short }} + # tag_name: main-${{ env.DATE }}-${{ needs.build.outputs.sha_short }} + tag_name: main-latest prerelease: true files: ${{ needs.build.outputs.bin_name }} repository: FaithLife-Community/test-builds From 3dd5ddd5bee3b9b1dfa4f1aab922cb43314829f4 Mon Sep 17 00:00:00 2001 From: n8marti Date: Sat, 23 Nov 2024 12:37:00 +0100 Subject: [PATCH 18/26] Update autobuild-main.yml --- .github/workflows/autobuild-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autobuild-main.yml b/.github/workflows/autobuild-main.yml index 8fe63a1c..8447bec2 100644 --- a/.github/workflows/autobuild-main.yml +++ b/.github/workflows/autobuild-main.yml @@ -22,7 +22,7 @@ jobs: name: ${{ needs.build.outputs.bin_name }} - name: Run shell tasks run: | - echo "DATE=$(date +%Y%m%d)" >> $GITHUB_ENV + # echo "DATE=$(date +%Y%m%d)" >> $GITHUB_ENV find -name oudedetai -type f -exec chmod +x {} \; - name: Upload release to test repo uses: softprops/action-gh-release@v1 From 726fa2c68255650663f11713a2692cce1e196729 Mon Sep 17 00:00:00 2001 From: n8marti Date: Sat, 23 Nov 2024 12:47:07 +0100 Subject: [PATCH 19/26] Update autobuild-main.yml --- .github/workflows/autobuild-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/autobuild-main.yml b/.github/workflows/autobuild-main.yml index 8447bec2..4910dc5c 100644 --- a/.github/workflows/autobuild-main.yml +++ b/.github/workflows/autobuild-main.yml @@ -29,6 +29,7 @@ jobs: with: # tag_name: main-${{ env.DATE }}-${{ needs.build.outputs.sha_short }} tag_name: main-latest + body: '' prerelease: true files: ${{ needs.build.outputs.bin_name }} repository: FaithLife-Community/test-builds From e1fb2fa9782334307824f09039c08d5c63b01bf2 Mon Sep 17 00:00:00 2001 From: n8marti Date: Sat, 23 Nov 2024 12:54:02 +0100 Subject: [PATCH 20/26] Update autobuild-main.yml --- .github/workflows/autobuild-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/autobuild-main.yml b/.github/workflows/autobuild-main.yml index 4910dc5c..ee943ec5 100644 --- a/.github/workflows/autobuild-main.yml +++ b/.github/workflows/autobuild-main.yml @@ -29,6 +29,7 @@ jobs: with: # tag_name: main-${{ env.DATE }}-${{ needs.build.outputs.sha_short }} tag_name: main-latest + target_commitish: https://github.com/FaithLife-Community/LogosLinuxInstaller/tree/main body: '' prerelease: true files: ${{ needs.build.outputs.bin_name }} From 1e8d6e352be2a683580fa52d87a2822230c3fcb6 Mon Sep 17 00:00:00 2001 From: n8marti Date: Sat, 23 Nov 2024 13:29:34 +0100 Subject: [PATCH 21/26] Update autobuild-main.yml --- .github/workflows/autobuild-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autobuild-main.yml b/.github/workflows/autobuild-main.yml index ee943ec5..8160011a 100644 --- a/.github/workflows/autobuild-main.yml +++ b/.github/workflows/autobuild-main.yml @@ -29,7 +29,7 @@ jobs: with: # tag_name: main-${{ env.DATE }}-${{ needs.build.outputs.sha_short }} tag_name: main-latest - target_commitish: https://github.com/FaithLife-Community/LogosLinuxInstaller/tree/main + target_commitish: ${{ needs.build.outputs.sha_short }} body: '' prerelease: true files: ${{ needs.build.outputs.bin_name }} From 10428314ccb794e8cb409967af7600222c20f4cd Mon Sep 17 00:00:00 2001 From: n8marti Date: Sat, 23 Nov 2024 13:34:28 +0100 Subject: [PATCH 22/26] Update build-branch.yml --- .github/workflows/build-branch.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 762f2542..08cad0da 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -9,6 +9,8 @@ on: bin_name: description: "name of built binary" value: ${{ jobs.build.outputs.bin_name }} + sha: + value: ${{ github.sha }} sha_short: description: "1st few chars of commit SHA" value: ${{ jobs.build.outputs.sha_short }} From 319cffc48f9291a5f71386fedc3776e846cfb168 Mon Sep 17 00:00:00 2001 From: n8marti Date: Sat, 23 Nov 2024 13:35:09 +0100 Subject: [PATCH 23/26] Update autobuild-main.yml --- .github/workflows/autobuild-main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/autobuild-main.yml b/.github/workflows/autobuild-main.yml index 8160011a..ad6e3307 100644 --- a/.github/workflows/autobuild-main.yml +++ b/.github/workflows/autobuild-main.yml @@ -22,14 +22,12 @@ jobs: name: ${{ needs.build.outputs.bin_name }} - name: Run shell tasks run: | - # echo "DATE=$(date +%Y%m%d)" >> $GITHUB_ENV find -name oudedetai -type f -exec chmod +x {} \; - name: Upload release to test repo uses: softprops/action-gh-release@v1 with: - # tag_name: main-${{ env.DATE }}-${{ needs.build.outputs.sha_short }} tag_name: main-latest - target_commitish: ${{ needs.build.outputs.sha_short }} + target_commitish: ${{ needs.build.outputs.sha }} body: '' prerelease: true files: ${{ needs.build.outputs.bin_name }} From 8926435af07585e61a90e82db93ca803221acc3d Mon Sep 17 00:00:00 2001 From: n8marti Date: Sat, 23 Nov 2024 13:50:12 +0100 Subject: [PATCH 24/26] Update autobuild-main.yml --- .github/workflows/autobuild-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autobuild-main.yml b/.github/workflows/autobuild-main.yml index ad6e3307..dfe192f7 100644 --- a/.github/workflows/autobuild-main.yml +++ b/.github/workflows/autobuild-main.yml @@ -27,7 +27,7 @@ jobs: uses: softprops/action-gh-release@v1 with: tag_name: main-latest - target_commitish: ${{ needs.build.outputs.sha }} + # target_commitish: ${{ needs.build.outputs.sha }} body: '' prerelease: true files: ${{ needs.build.outputs.bin_name }} From d407abb00207a2347c5aa180de70f30c4910eb29 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Fri, 27 Sep 2024 22:38:56 -0400 Subject: [PATCH 25/26] Fix #17. Add Alpine Support --- ou_dedetai/logos.py | 2 ++ ou_dedetai/system.py | 38 +++++++++++++++++++++-- ou_dedetai/wine.py | 73 +++++++++++++++++++++++--------------------- 3 files changed, 76 insertions(+), 37 deletions(-) diff --git a/ou_dedetai/logos.py b/ou_dedetai/logos.py index 4e5189ba..6c6c9fe0 100644 --- a/ou_dedetai/logos.py +++ b/ou_dedetai/logos.py @@ -88,6 +88,8 @@ def run_logos(): if not good_wine: msg.logos_error(reason, app=self) else: + if reason is not None: + logging.debug(f"Warning: Wine Check: {reason}") wine.wineserver_kill() app = self.app if config.DIALOG == 'tk': diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index 1f1b0861..5446dae5 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -320,7 +320,7 @@ def get_package_manager(): ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages config.BADPACKAGES = "" # appimagelauncher handled separately - elif shutil.which('zypper') is not None: # manjaro + elif shutil.which('zypper') is not None: # opensuse config.PACKAGE_MANAGER_COMMAND_INSTALL = ["zypper", "--non-interactive", "install"] # noqa: E501 config.PACKAGE_MANAGER_COMMAND_DOWNLOAD = ["zypper", "download"] # noqa: E501 config.PACKAGE_MANAGER_COMMAND_REMOVE = ["zypper", "--non-interactive", "remove"] # noqa: E501 @@ -334,6 +334,22 @@ def get_package_manager(): ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages config.BADPACKAGES = "" # appimagelauncher handled separately + elif shutil.which('apk') is not None: # alpine + config.PACKAGE_MANAGER_COMMAND_INSTALL = ["apk", "--no-interactive", "add"] # noqa: E501 + config.PACKAGE_MANAGER_COMMAND_DOWNLOAD = ["apk", "--no-interactive", "fetch"] # noqa: E501 + config.PACKAGE_MANAGER_COMMAND_REMOVE = ["apk", "--no-interactive", "del"] # noqa: E501 + config.PACKAGE_MANAGER_COMMAND_QUERY = ["apk", "list", "-i"] + config.QUERY_PREFIX = '' + config.PACKAGES = ( + "bash bash-completion" # bash support + "gcompat" # musl to glibc + "fuse-common fuse" # appimages + "wget curl" # network + "7zip" # winetricks + "samba sed grep gawk bash bash-completion" # other + ) + config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages + config.BADPACKAGES = "" # appimagelauncher handled separately elif shutil.which('pamac') is not None: # manjaro config.PACKAGE_MANAGER_COMMAND_INSTALL = ["pamac", "install", "--no-upgrade", "--no-confirm"] # noqa: E501 config.PACKAGE_MANAGER_COMMAND_DOWNLOAD = ["pamac", "install", "--no-upgrade", "--download-only", "--no-confirm"] # noqa: E501 @@ -544,6 +560,19 @@ def postinstall_dependencies_steamos(): return command +def postinstall_dependencies_alpine(): + user = os.getlogin() + command = [ + config.SUPERUSER_COMMAND, "modprobe", "fuse", "&&", + config.SUPERUSER_COMMAND, "rc-update", "add", "fuse", "boot", "&&", + config.SUPERUSER_COMMAND, "sed", "-i", "'s/#user_allow_other/user_allow_other/g'", "/etc/fuse.conf", "&&", + config.SUPERUSER_COMMAND, "addgroup", "fuse", "&&", + config.SUPERUSER_COMMAND, "adduser", f"{user}", "fuse", "&&", + config.SUPERUSER_COMMAND, "rc-service", "fuse", "restart", + ] + return command + + def preinstall_dependencies(app=None): command = [] logging.debug("Performing pre-install dependencies…") @@ -559,6 +588,8 @@ def postinstall_dependencies(app=None): logging.debug("Performing post-install dependencies…") if config.OS_NAME == "Steam": command = postinstall_dependencies_steamos() + if config.OS_NAME == "alpine": + command = postinstall_dependencies_alpine() else: logging.debug("No post-install dependencies required.") return command @@ -582,6 +613,7 @@ def install_dependencies(packages, bad_packages, logos9_packages=None, app=None) conflicting_packages = {} package_list = [] bad_package_list = [] + bad_os = ['fedora', 'arch', 'alpine'] if packages: package_list = packages.split() @@ -605,7 +637,7 @@ def install_dependencies(packages, bad_packages, logos9_packages=None, app=None) ) if config.PACKAGE_MANAGER_COMMAND_INSTALL: - if config.OS_NAME in ['fedora', 'arch']: + if config.OS_NAME in bad_os: message = False no_message = False secondary = False @@ -682,7 +714,7 @@ def install_dependencies(packages, bad_packages, logos9_packages=None, app=None) app.root.event_generate('<>') msg.status("Installing dependencies…", app) final_command = [ - f"{config.SUPERUSER_COMMAND}", 'sh', '-c', "'", *command, "'" + f"{config.SUPERUSER_COMMAND}", 'sh', '-c', '"', *command, '"' ] command_str = ' '.join(final_command) # TODO: Fix fedora/arch handling. diff --git a/ou_dedetai/wine.py b/ou_dedetai/wine.py index 68ae1ca1..844b1d83 100644 --- a/ou_dedetai/wine.py +++ b/ou_dedetai/wine.py @@ -159,54 +159,57 @@ def check_wine_rules(wine_release, release_version): ] major_min, minor_min = required_wine_minimum - major, minor, release_type = wine_release - result = True, "None" # Whether the release is allowed; error message - for rule in rules: - if major == rule["major"]: - # Verify release is allowed - if release_type not in rule["allowed_releases"]: - if minor >= rule.get("devel_allowed", float('inf')): - if release_type not in ["staging", "devel"]: + if wine_release: + major, minor, release_type = wine_release + result = True, "None" # Whether the release is allowed; error message + for rule in rules: + if major == rule["major"]: + # Verify release is allowed + if release_type not in rule["allowed_releases"]: + if minor >= rule.get("devel_allowed", float('inf')): + if release_type not in ["staging", "devel"]: + result = ( + False, + ( + f"Wine release needs to be devel or staging. " + f"Current release: {release_type}." + ) + ) + break + else: result = ( False, ( - f"Wine release needs to be devel or staging. " + f"Wine release needs to be {rule['allowed_releases']}. " # noqa: E501 f"Current release: {release_type}." ) ) break - else: - result = ( - False, - ( - f"Wine release needs to be {rule['allowed_releases']}. " # noqa: E501 - f"Current release: {release_type}." - ) - ) + # Verify version is allowed + if minor in rule.get("minor_bad", []): + result = False, f"Wine version {major}.{minor} will not work." break - # Verify version is allowed - if minor in rule.get("minor_bad", []): - result = False, f"Wine version {major}.{minor} will not work." - break - if major < major_min: - result = ( - False, - ( - f"Wine version {major}.{minor} is " - f"below minimum required ({major_min}.{minor_min}).") - ) - break - elif major == major_min and minor < minor_min: - if not rule["proton"]: + if major < major_min: result = ( False, ( f"Wine version {major}.{minor} is " - f"below minimum required ({major_min}.{minor_min}).") # noqa: E501 + f"below minimum required ({major_min}.{minor_min}).") ) break - logging.debug(f"Result: {result}") - return result + elif major == major_min and minor < minor_min: + if not rule["proton"]: + result = ( + False, + ( + f"Wine version {major}.{minor} is " + f"below minimum required ({major_min}.{minor_min}).") # noqa: E501 + ) + break + logging.debug(f"Result: {result}") + return result + else: + return True, "Default to trusting user override" def check_wine_version_and_branch(release_version, test_binary): @@ -552,6 +555,8 @@ def get_wine_branch(binary): logging.debug("Binary object is not an AppImage.") logging.info(f"'{binary}' resolved to '{binary_obj}'") mscoree64 = binary_obj.parents[1] / 'lib64' / 'wine' / 'x86_64-windows' / 'mscoree.dll' # noqa: E501 + if not mscoree64.exists(): #alpine + mscoree64 = binary_obj.parents[1] / 'lib' / 'wine' / 'x86_64-windows' / 'mscoree.dll' # noqa: E501 return get_mscoree_winebranch(mscoree64) From 4b8f5ed91ddeba4b27ccec60b80a07b367ec20f3 Mon Sep 17 00:00:00 2001 From: "T. H. Wright" Date: Sat, 30 Nov 2024 18:37:08 -0500 Subject: [PATCH 26/26] Add architecture detection --- ou_dedetai/config.py | 3 ++ ou_dedetai/main.py | 5 ++++ ou_dedetai/system.py | 68 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/ou_dedetai/config.py b/ou_dedetai/config.py index fb971b76..341e19ef 100644 --- a/ou_dedetai/config.py +++ b/ou_dedetai/config.py @@ -67,6 +67,9 @@ FLPRODUCTi: Optional[str] = None INSTALL_STEP: int = 0 INSTALL_STEPS_COUNT: int = 0 +architecture = None +bits = None +ELFPACKAGES = None L9PACKAGES = None LEGACY_CONFIG_FILES = [ os.path.expanduser("~/.config/FaithLife-Community/Logos_on_Linux.json"), # noqa: E501 diff --git a/ou_dedetai/main.py b/ou_dedetai/main.py index b9fadb11..f4acbc2c 100755 --- a/ou_dedetai/main.py +++ b/ou_dedetai/main.py @@ -380,6 +380,11 @@ def set_dialog(): logging.error("Dialog version is outdated. The program will fall back to Curses.") # noqa: E501 config.use_python_dialog = False logging.debug(f"Use Python Dialog?: {config.use_python_dialog}") + # Set Architecture + + config.architecture, config.bits = system.get_architecture() + logging.debug(f"Current Architecture: {config.architecture}, {config.bits}bit.") + system.check_architecture() def check_incompatibilities(): diff --git a/ou_dedetai/system.py b/ou_dedetai/system.py index 5446dae5..330187a6 100644 --- a/ou_dedetai/system.py +++ b/ou_dedetai/system.py @@ -3,7 +3,9 @@ import logging import os import psutil +import platform import shutil +import struct import subprocess import sys import time @@ -14,6 +16,7 @@ from . import config from . import msg from . import network +from . import utils # TODO: Replace functions in control.py and wine.py with Popen command. @@ -232,6 +235,67 @@ def get_dialog(): config.DIALOG = 'tk' +def get_architecture(): + machine = platform.machine().lower() + bits = struct.calcsize("P") * 8 + + if "x86_64" in machine or "amd64" in machine: + architecture = "x86_64" + elif "i386" in machine or "i686" in machine: + architecture = "x86_32" + elif "arm" in machine or "aarch64" in machine: + if bits == 64: + architecture = "ARM64" + else: + architecture = "ARM32" + elif "riscv" in machine or "riscv64" in machine: + if bits == 64: + architecture = "RISC-V 64" + else: + architecture = "RISC-V 32" + else: + architecture = "Unknown" + + return architecture, bits + + +def install_elf_interpreter(): + # TODO: This probably needs to be changed to another install step that requests the user to choose a specific + # ELF interpreter between box64, FEX-EMU, and hangover. That or else we have to pursue a particular interpreter + # for the install routine, depending on what's needed + logging.critical("ELF interpretation is not yet coded in the installer.") + # if "x86_64" not in config.architecture: + # if config.ELFPACKAGES is not None: + # utils.install_packages(config.ELFPACKAGES) + # else: + # logging.critical(f"ELFPACKAGES is not set.") + # sys.exit(1) + # else: + # logging.critical(f"ELF interpreter is not needed.") + + +def check_architecture(): + if "x86_64" in config.architecture: + pass + elif "ARM64" in config.architecture: + logging.critical("Unsupported architecture. Requires box64 or FEX-EMU or Wine Hangover to be integrated.") + install_elf_interpreter() + elif "RISC-V 64" in config.architecture: + logging.critical("Unsupported architecture. Requires box64 or FEX-EMU or Wine Hangover to be integrated.") + install_elf_interpreter() + elif "x86_32" in config.architecture: + logging.critical("Unsupported architecture. Requires box64 or FEX-EMU or Wine Hangover to be integrated.") + install_elf_interpreter() + elif "ARM32" in config.architecture: + logging.critical("Unsupported architecture. Requires box64 or FEX-EMU or Wine Hangover to be integrated.") + install_elf_interpreter() + elif "RISC-V 32" in config.architecture: + logging.critical("Unsupported architecture. Requires box64 or FEX-EMU or Wine Hangover to be integrated.") + install_elf_interpreter() + else: + logging.critical("System archictecture unknown.") + + def get_os(): # FIXME: Not working? Returns "Linux" on some systems? On Ubuntu 24.04 it # correctly returns "ubuntu". @@ -298,6 +362,7 @@ def get_package_manager(): "7zip " # winetricks ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages + config.ELFPACKAGES = "" config.BADPACKAGES = "" # appimagelauncher handled separately elif shutil.which('dnf') is not None: # rhel, fedora config.PACKAGE_MANAGER_COMMAND_INSTALL = ["dnf", "install", "-y"] @@ -319,6 +384,7 @@ def get_package_manager(): "p7zip-plugins " # winetricks ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages + config.ELFPACKAGES = "" config.BADPACKAGES = "" # appimagelauncher handled separately elif shutil.which('zypper') is not None: # opensuse config.PACKAGE_MANAGER_COMMAND_INSTALL = ["zypper", "--non-interactive", "install"] # noqa: E501 @@ -363,6 +429,7 @@ def get_package_manager(): "curl gawk grep " # other ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages + config.ELFPACKAGES = "" config.BADPACKAGES = "" # appimagelauncher handled separately elif shutil.which('pacman') is not None: # arch, steamOS config.PACKAGE_MANAGER_COMMAND_INSTALL = ["pacman", "-Syu", "--overwrite", "\\*", "--noconfirm", "--needed"] # noqa: E501 @@ -385,6 +452,7 @@ def get_package_manager(): "libxslt sqlite " # misc ) config.L9PACKAGES = "" # FIXME: Missing Logos 9 Packages + config.ELFPACKAGES = "" config.BADPACKAGES = "" # appimagelauncher handled separately else: # Add more conditions for other package managers as needed.