Merge branch 'main' into sonoma-development

This commit is contained in:
Mykola Grymalyuk
2023-06-08 10:19:03 -06:00
3 changed files with 41 additions and 5 deletions

View File

@@ -4,6 +4,8 @@
- Update non-Metal Binaries: - Update non-Metal Binaries:
- Improve experimental Menubar implementation stability - Improve experimental Menubar implementation stability
- Implement reduce transparency Menubar - Implement reduce transparency Menubar
- Resolve app not updating in `/Applications` after an update
- Work-around users manually copying app to `/Applications` instead of allowing Root Volume Patcher to create a proper alias
- Increment Binaries: - Increment Binaries:
- PatcherSupportPkg 1.1.3 - release - PatcherSupportPkg 1.1.3 - release

View File

@@ -4,6 +4,9 @@ import sys
import logging import logging
import threading import threading
import webbrowser import webbrowser
import subprocess
from pathlib import Path
from resources.wx_gui import ( from resources.wx_gui import (
gui_build, gui_build,
@@ -11,7 +14,6 @@ from resources.wx_gui import (
gui_support, gui_support,
gui_help, gui_help,
gui_settings, gui_settings,
gui_sys_patch_start,
gui_sys_patch_display, gui_sys_patch_display,
gui_update, gui_update,
) )
@@ -204,6 +206,8 @@ class MainFrame(wx.Frame):
self.on_build_and_install() self.on_build_and_install()
return return
self._fix_local_install()
if "--update_installed" in sys.argv and self.constants.has_checked_updates is False and gui_support.CheckProperties(self.constants).host_can_build(): if "--update_installed" in sys.argv and self.constants.has_checked_updates is False and gui_support.CheckProperties(self.constants).host_can_build():
# Notify user that the update has been installed # Notify user that the update has been installed
self.constants.has_checked_updates = True self.constants.has_checked_updates = True
@@ -235,6 +239,34 @@ class MainFrame(wx.Frame):
threading.Thread(target=self._check_for_updates).start() threading.Thread(target=self._check_for_updates).start()
def _fix_local_install(self) -> None:
"""
Work-around users manually copying the app to /Applications
We'll delete the app, and create a proper symlink
Note: This *shouldn't* be needed with installs after 0.6.7, but it's a good catch-all
"""
if "--update_installed" not in sys.argv:
return
if self.constants.has_checked_updates is True:
return
# Check if app exists in /Applications, and is not a symlink
if Path("/Applications/OpenCore-Patcher.app").exists() and Path("/Applications/OpenCore-Patcher.app").is_symlink() is False:
logging.info("Found user-installed app in /Applications, replacing with symlink")
# Delete app
result = subprocess.run(["rm", "-rf", "/Applications/OpenCore-Patcher.app"], capture_output=True)
if result.returncode != 0:
print("Failed to delete app from /Applications")
return
# Create symlink
result = subprocess.run(["ln", "-s", "/Library/Application Support/Dortania/OpenCore-Patcher.app", "/Applications/OpenCore-Patcher.app"], capture_output=True)
if result.returncode != 0:
print("Failed to create symlink to /Applications")
return
def _check_for_updates(self): def _check_for_updates(self):
if self.constants.has_checked_updates is True: if self.constants.has_checked_updates is True:
return return

View File

@@ -226,18 +226,20 @@ if [ ! -d "/Library/Application Support/Dortania" ]; then
mkdir -p "/Library/Application Support/Dortania" mkdir -p "/Library/Application Support/Dortania"
fi fi
# Check if '/Library/Application Support/Dortania/OpenCore-Patcher.app' exists # Check if 'OpenCore-Patcher.app' exists
if [ -d "/Library/Application Support/Dortania/OpenCore-Patcher.app" ]; then if [ -d "/Library/Application Support/Dortania/OpenCore-Patcher.app" ]; then
rm -rf "/Library/Application Support/Dortania/OpenCore-Patcher.app" rm -rf "/Library/Application Support/Dortania/OpenCore-Patcher.app"
fi fi
if [ -d "/Applications/OpenCore-Patcher.app" ]; then
rm -rf "/Applications/OpenCore-Patcher.app"
fi
# Move '/tmp/OpenCore-Patcher.app' to '/Library/Application Support/Dortania' # Move '/tmp/OpenCore-Patcher.app' to '/Library/Application Support/Dortania'
mv "{str(self.application_path)}" "/Library/Application Support/Dortania/OpenCore-Patcher.app" mv "{str(self.application_path)}" "/Library/Application Support/Dortania/OpenCore-Patcher.app"
# Check if '/Applications/OpenCore-Patcher.app' exists # Check if '/Applications/OpenCore-Patcher.app' exists
if [ ! -d "/Applications/OpenCore-Patcher.app" ]; then ln -s "/Library/Application Support/Dortania/OpenCore-Patcher.app" "/Applications/OpenCore-Patcher.app"
ln -s "/Library/Application Support/Dortania/OpenCore-Patcher.app" "/Applications/OpenCore-Patcher.app"
fi
# Create update.plist with info about update # Create update.plist with info about update
cat << EOF > "/Library/Application Support/Dortania/update.plist" cat << EOF > "/Library/Application Support/Dortania/update.plist"