mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 22:20:53 +10:00
Remove legacy _fix_file_permission()
Required for when OCLP would run as root
This commit is contained in:
@@ -28,7 +28,6 @@ class GlobalEnviromentSettings:
|
|||||||
|
|
||||||
self._generate_settings_file()
|
self._generate_settings_file()
|
||||||
self._convert_defaults_to_global_settings()
|
self._convert_defaults_to_global_settings()
|
||||||
self._fix_file_permission()
|
|
||||||
|
|
||||||
|
|
||||||
def read_property(self, property_name: str) -> str:
|
def read_property(self, property_name: str) -> str:
|
||||||
@@ -105,19 +104,4 @@ class GlobalEnviromentSettings:
|
|||||||
Path(defaults_path).unlink()
|
Path(defaults_path).unlink()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Error: Unable to delete defaults plist")
|
logging.error("Error: Unable to delete defaults plist")
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
|
|
||||||
|
|
||||||
def _fix_file_permission(self) -> None:
|
|
||||||
"""
|
|
||||||
Fixes file permission for log file
|
|
||||||
|
|
||||||
If OCLP was invoked as root, file permission will only allow root to write to settings file
|
|
||||||
This in turn breaks normal OCLP execution to write to settings file
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Set file permission to allow any user to write to log file
|
|
||||||
result = subprocess_wrapper.run_as_root(["/bin/chmod", "777", self.global_settings_plist], capture_output=True)
|
|
||||||
if result.returncode != 0:
|
|
||||||
logging.warning("Failed to fix settings file permissions:")
|
|
||||||
subprocess_wrapper.log(result)
|
|
||||||
@@ -61,7 +61,6 @@ class InitializeLoggingSupport:
|
|||||||
self._attempt_initialize_logging_configuration()
|
self._attempt_initialize_logging_configuration()
|
||||||
self._start_logging()
|
self._start_logging()
|
||||||
self._implement_custom_traceback_handler()
|
self._implement_custom_traceback_handler()
|
||||||
self._fix_file_permission()
|
|
||||||
self._clean_prior_version_logs()
|
self._clean_prior_version_logs()
|
||||||
|
|
||||||
|
|
||||||
@@ -123,26 +122,6 @@ class InitializeLoggingSupport:
|
|||||||
logging.error(f"Failed to delete log file: {e}")
|
logging.error(f"Failed to delete log file: {e}")
|
||||||
|
|
||||||
|
|
||||||
def _fix_file_permission(self) -> None:
|
|
||||||
"""
|
|
||||||
Fixes file permission for log file
|
|
||||||
|
|
||||||
If OCLP was invoked as root, file permission will only allow root to write to log file
|
|
||||||
This in turn breaks normal OCLP execution to write to log file
|
|
||||||
"""
|
|
||||||
|
|
||||||
paths = [
|
|
||||||
self.log_filepath, # ~/Library/Logs/Dortania/OpenCore-Patcher_{version}_{date}.log
|
|
||||||
self.log_filepath.parent, # ~/Library/Logs/Dortania
|
|
||||||
]
|
|
||||||
|
|
||||||
for path in paths:
|
|
||||||
result = subprocess_wrapper.run_as_root(["/bin/chmod", "777", path], capture_output=True)
|
|
||||||
if result.returncode != 0:
|
|
||||||
logging.error(f"Failed to fix log file permissions")
|
|
||||||
subprocess_wrapper.log(result)
|
|
||||||
|
|
||||||
|
|
||||||
def _initialize_logging_configuration(self, log_to_file: bool = True) -> None:
|
def _initialize_logging_configuration(self, log_to_file: bool = True) -> None:
|
||||||
"""
|
"""
|
||||||
Initialize logging framework configuration
|
Initialize logging framework configuration
|
||||||
|
|||||||
Reference in New Issue
Block a user