@@ -40,13 +40,46 @@ def ensure_choices(app: App):
4040
4141 app .status ("Install is running…" )
4242
43+ def ensure_install_dirs (app : App ):
44+ app .installer_step_count += 1
45+ ensure_choices (app = app )
46+ app .installer_step += 1
47+ app .status ("Ensuring installation directories…" )
48+ wine_dir = Path ("" )
49+
50+ bin_dir = Path (app .conf .installer_binary_dir )
51+ bin_dir .mkdir (parents = True , exist_ok = True )
52+ logging .debug (f"> { bin_dir } exists?: { bin_dir .is_dir ()} " )
53+
54+ logging .debug (f"> { app .conf .install_dir = } " )
55+ logging .debug (f"> { app .conf .installer_binary_dir = } " )
56+
57+ wine_dir = Path (f"{ app .conf .wine_prefix } " )
58+ wine_dir .mkdir (parents = True , exist_ok = True )
59+
60+ logging .debug (f"> { wine_dir } exists: { wine_dir .is_dir ()} " )
61+ logging .debug (f"> { app .conf .wine_prefix = } " )
62+
63+
64+ def ensure_sys_deps (app : App ):
65+ app .installer_step_count += 1
66+ ensure_install_dirs (app = app )
67+ app .installer_step += 1
68+ app .status ("Ensuring system dependencies are met…" )
69+
70+ if not app .conf .skip_install_system_dependencies :
71+ utils .install_dependencies (app )
72+ logging .debug ("> Done." )
73+ else :
74+ logging .debug ("> Skipped." )
75+
4376
4477def check_for_known_bugs (app : App ):
4578 """Checks for any known bug conditions and recommends user action.
4679 This is a best-effort check
4780 """
4881 app .installer_step_count += 1
49- ensure_choices (app = app )
82+ ensure_sys_deps (app = app )
5083 app .installer_step += 1
5184
5285 # Begin workaround #435
@@ -66,43 +99,47 @@ def check_for_known_bugs(app: App):
6699 )
67100 if result :
68101 command_output : str = result .stdout
69- command_output = command_output .strip ().lower ()
102+ desktop_file_name = command_output .strip ()
103+ command_output = desktop_file_name .lower ()
70104
71105 # Abbr. list from https://en.wikipedia.org/wiki/Chromium_(web_browser)#Browsers_based_on_Chromium
72106 # Known chromium based .desktops:
73107 # chromium_chromium.desktop - Debian Chromium (.deb and snap)
74108 # google-chrome and com.google.Chrome.desktop - Debian Google Chrome
75109 # brave-browser.desktop and com.brave.Browser.desktop - Debian Brave
76110 # vivaldi-stable.desktop - Debian Vivaldi
111+ # dooble.desktop - Debian Dooble
112+ # opera.desktop - Debian Opera
113+ # org.qutebrowser.qutebrowser.desktop - Debian Qutebrowser
114+ # org.kde.falkon.desktop - Debian Falkon
77115 if (
78116 "chromium" in command_output
79117 or "chrome" in command_output
80118 or "brave" in command_output
81119 or "vivaldi" in command_output
82120 or "dooble" in command_output
83- or "dooble" in command_output
84121 or "falkon" in command_output
85- or "otter" in command_output
86122 or "qutebrowser" in command_output
87- or "supermium" in command_output
88- or "ecosia" in command_output
89- or "edge" in command_output
90123 or "opera" in command_output
91- or "puffin" in command_output
92124 ):
93125 chromium_detected = True
94126
95127 # Now check the .desktop's Exec line for either "flatpak" or "/snap/bin" if either are found, fail as well.
96128 xdg_data_dirs = os .getenv ("XDG_DATA_DIRS" , "/usr/local/share:/usr/share" )
97129
130+ found : bool = False
131+
98132 for xdg_data_dir in xdg_data_dirs .split (":" ):
99- desktop_file_path = (Path (xdg_data_dir ) / command_output )
133+ desktop_file_path = (Path (xdg_data_dir ) / "applications" / desktop_file_name )
100134 if desktop_file_path .exists ():
135+ found = True
101136 lines = desktop_file_path .read_text ().splitlines ()
102137 lines = list (filter (lambda line : line .lower ().startswith ("exec=" ), lines ))
103138 if any ("/snap/bin" in line or "flatpak" in line for line in lines ):
104139 snap_or_flatpak_detected = True
105- break
140+
141+ if not found :
142+ logging .warning ("Cannot find the desktop file in question" )
106143 except subprocess .CalledProcessError as e :
107144 logging .warning (
108145 "Failed to check if chromium will be used - "
@@ -118,53 +155,22 @@ def check_for_known_bugs(app: App):
118155 if app .conf .wine_binary == constants .WINE_RECOMMENDED_SIGIL :
119156 logging .info ("Switching user to the beta wine branch due to issue #435" )
120157 app .conf .wine_binary = constants .WINE_BETA_SIGIL
158+ elif app .conf .wine_binary == constants .WINE_BETA_SIGIL :
159+ # No need to do anything
160+ pass
121161 else :
122162 logging .warning ("Sign In button may not launch the browser due to issue #435" )
123163
124164 # End workaround #435
125165
126166
127- def ensure_install_dirs (app : App ):
167+ def ensure_appimage_download (app : App ):
128168 app .installer_step_count += 1
129169 try :
130170 check_for_known_bugs (app = app )
131171 except Exception :
132172 logging .exception ("Failed to check for known bugs - assuming everything is fine and continuing install." )
133173 app .installer_step += 1
134- app .status ("Ensuring installation directories…" )
135- wine_dir = Path ("" )
136-
137- bin_dir = Path (app .conf .installer_binary_dir )
138- bin_dir .mkdir (parents = True , exist_ok = True )
139- logging .debug (f"> { bin_dir } exists?: { bin_dir .is_dir ()} " )
140-
141- logging .debug (f"> { app .conf .install_dir = } " )
142- logging .debug (f"> { app .conf .installer_binary_dir = } " )
143-
144- wine_dir = Path (f"{ app .conf .wine_prefix } " )
145- wine_dir .mkdir (parents = True , exist_ok = True )
146-
147- logging .debug (f"> { wine_dir } exists: { wine_dir .is_dir ()} " )
148- logging .debug (f"> { app .conf .wine_prefix = } " )
149-
150-
151- def ensure_sys_deps (app : App ):
152- app .installer_step_count += 1
153- ensure_install_dirs (app = app )
154- app .installer_step += 1
155- app .status ("Ensuring system dependencies are met…" )
156-
157- if not app .conf .skip_install_system_dependencies :
158- utils .install_dependencies (app )
159- logging .debug ("> Done." )
160- else :
161- logging .debug ("> Skipped." )
162-
163-
164- def ensure_appimage_download (app : App ):
165- app .installer_step_count += 1
166- ensure_sys_deps (app = app )
167- app .installer_step += 1
168174 if (
169175 app .conf .faithlife_product_version != '9'
170176 and not str (app .conf .wine_binary ).lower ().endswith ('appimage' )
@@ -175,12 +181,29 @@ def ensure_appimage_download(app: App):
175181
176182 downloaded_file = None
177183 appimage_path = app .conf .wine_appimage_recommended_file_name
184+ download_url = app .conf .wine_appimage_recommended_url
185+
186+ if (
187+ app .conf .wine_binary == constants .WINE_BETA_SIGIL
188+ or (
189+ app .conf .wine_appimage_beta_file_name is not None
190+ # It was set to this manually.
191+ and app .conf .wine_binary == f"{ constants .RELATIVE_BINARY_DIR } /{ app .conf .wine_appimage_beta_file_name } "
192+ )
193+ ):
194+ if (
195+ app .conf .wine_appimage_beta_file_name is not None
196+ and app .conf .wine_appimage_beta_url is not None
197+ ):
198+ appimage_path = app .conf .wine_appimage_beta_file_name
199+ download_url = app .conf .wine_appimage_beta_url
200+
178201 filename = Path (appimage_path ).name
179202 downloaded_file = utils .get_downloaded_file_path (app .conf .download_dir , filename )
180203 if not downloaded_file :
181204 downloaded_file = f"{ app .conf .download_dir } /{ filename } "
182205 network .logos_reuse_download (
183- app . conf . wine_appimage_recommended_url ,
206+ download_url ,
184207 filename ,
185208 app .conf .download_dir ,
186209 app = app ,
0 commit comments