Skip to content

Commit eb6f604

Browse files
authored
Add support for Logos v39+ (#263)
via an mst to modify the msi at runtime allowing it to fail to install the LogosStub.MSIX but continue installation. LogosStub is not needed (it was just used for URL redirection on windows).
1 parent 13a15bf commit eb6f604

File tree

6 files changed

+54
-9
lines changed

6 files changed

+54
-9
lines changed

ou_dedetai.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ a = Analysis(
66
pathex=[],
77
#binaries=[('/usr/bin/tclsh8.6', '.')],
88
binaries=[],
9-
datas=[('ou_dedetai/img/*icon.png', 'ou_dedetai/img')],
9+
datas=[('ou_dedetai/img/*icon.png', 'ou_dedetai/img'),('ou_dedetai/assets/LogosStubFailOK.mst', 'assets')],
1010
hiddenimports=[],
1111
hookspath=[],
1212
hooksconfig={},

ou_dedetai/assets/LogosStubFailOK.mst

20 KB
Binary file not shown.

ou_dedetai/constants.py

+13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
import logging
22
import os
3+
import sys
4+
35
from pathlib import Path
46

57
# This is relative to this file itself
68
APP_IMAGE_DIR = Path(__file__).parent / "img"
79

10+
# Are we running from binary or src?
11+
if getattr(sys, 'frozen', False):
12+
# We are running inside a PyInstaller bundle
13+
BUNDLE_DIR = Path(sys._MEIPASS)
14+
else:
15+
# We are running in normal development mode
16+
BUNDLE_DIR = Path(__file__).resolve().parent
17+
18+
# Now define an assets directory that works in both modes:
19+
APP_ASSETS_DIR = BUNDLE_DIR / 'assets'
20+
821
# Define app name variables.
922
APP_NAME = 'Ou Dedetai'
1023
BINARY_NAME = 'oudedetai'

ou_dedetai/installer.py

+9
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def ensure_product_installer_download(app: App):
184184
logging.debug(f"> '{downloaded_file}' exists?: {Path(downloaded_file).is_file()}") # noqa: E501
185185

186186

187+
187188
def ensure_wineprefix_init(app: App):
188189
app.installer_step_count += 1
189190
ensure_product_installer_download(app=app)
@@ -292,6 +293,14 @@ def ensure_product_installed(app: App):
292293
app.conf._installed_faithlife_product_release = None
293294

294295
# Clean up temp files, etc.
296+
mst_destination = Path(app.conf.install_dir) / "data/wine64_bottle/drive_c/LogosStubFailOK.mst"
297+
if mst_destination and mst_destination.is_file():
298+
try:
299+
mst_destination.unlink()
300+
logging.debug(f"Deleted MST file: {mst_destination}")
301+
except Exception as e:
302+
logging.warning(f"Could not delete MST file: {e}")
303+
295304
utils.clean_all()
296305

297306
logging.debug(f"> {app.conf.logos_exe=}")

ou_dedetai/network.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,12 @@ def _get_faithlife_product_releases(
568568
# if len(releases) == 5:
569569
# break
570570

571-
# Logos 39+ doesn't install
572-
filtered_releases = utils.filter_versions(releases, 39, 1)
573-
logging.debug(f"Available releases: {', '.join(releases)}")
574-
logging.debug(f"Filtered releases: {', '.join(filtered_releases)}")
571+
#Filtering not needed at the moment but left here in case we want it later.
572+
#filtered_releases = utils.filter_versions(releases, 40, 1)
573+
#logging.debug(f"Available releases: {', '.join(releases)}")
574+
#logging.debug(f"Filtered releases: {', '.join(filtered_releases)}")
575575

576-
return filtered_releases
576+
return releases
577577

578578

579579
def update_lli_binary(app: App):

ou_dedetai/wine.py

+26-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import tempfile
1010
from typing import Optional
1111

12+
from ou_dedetai import constants
1213
from ou_dedetai.app import App
1314

1415
from . import network
@@ -271,13 +272,35 @@ def disable_winemenubuilder(app: App, wine64_binary: str):
271272

272273
def install_msi(app: App):
273274
app.status(f"Running MSI installer: {app.conf.faithlife_installer_name}.")
274-
# Execute the .MSI
275+
# Define the Wine executable and initial arguments for msiexec
275276
wine_exe = app.conf.wine64_binary
276-
exe_args = ["/i", f"{app.conf.install_dir}/data/{app.conf.faithlife_installer_name}"] #noqa: E501
277+
exe_args = ["/i", f"{app.conf.install_dir}/data/{app.conf.faithlife_installer_name}"] # noqa: E501
278+
279+
# Add passive mode if specified
277280
if app.conf._overrides.faithlife_install_passive is True:
278-
exe_args.append('/passive')
281+
exe_args.append("/passive")
282+
283+
# Add MST transform if needed
284+
release_version = app.conf.installed_faithlife_product_release or app.conf.faithlife_product_version # noqa: E501
285+
if release_version is not None and utils.check_logos_release_version(release_version, 39, 1):
286+
# Define source and destination for the MST file
287+
mst_source = constants.APP_ASSETS_DIR / "LogosStubFailOK.mst"
288+
mst_destination = Path(app.conf.install_dir) / "data/wine64_bottle/drive_c/LogosStubFailOK.mst"
289+
290+
# Copy the MST file if it doesn't already exist
291+
if not mst_destination.is_file():
292+
shutil.copy(mst_source, mst_destination)
293+
logging.debug(f"MST present: {mst_destination.is_file()}")
294+
295+
# Hard-code the Windows path for the MST file
296+
transform_winpath = r"C:\LogosStubFailOK.mst"
297+
exe_args.append(f'TRANSFORMS="{transform_winpath}"')
298+
logging.debug(f"Hard-coded TRANSFORMS path added: {transform_winpath}")
299+
300+
# Log the msiexec command and run the process
279301
logging.info(f"Running: {wine_exe} msiexec {' '.join(exe_args)}")
280302
process = run_wine_proc(wine_exe, app, exe="msiexec", exe_args=exe_args)
303+
281304
return process
282305

283306

0 commit comments

Comments
 (0)