1515
1616from ...support import (
1717 utilities ,
18- subprocess_wrapper
18+ subprocess_wrapper ,
19+ translate_language
1920)
2021
2122
@@ -26,6 +27,7 @@ class InstallAutomaticPatchingServices:
2627
2728 def __init__ (self , global_constants : constants .Constants ):
2829 self .constants : constants .Constants = global_constants
30+ self .trans = translate_language .TranslateLanguage_sys_patch (global_constants ).auto_patcher ()
2931
3032
3133 def install_auto_patcher_launch_agent (self , kdk_caching_needed : bool = False ):
@@ -36,7 +38,7 @@ def install_auto_patcher_launch_agent(self, kdk_caching_needed: bool = False):
3638 """
3739
3840 if self .constants .launcher_script is not None :
39- logging .info ("- Skipping Auto Patcher Launch Agent, not supported when running from source" )
41+ logging .info (self . trans [ "- Skipping Auto Patcher Launch Agent, not supported when running from source" ] )
4042 return
4143
4244 services = {
@@ -48,16 +50,16 @@ def install_auto_patcher_launch_agent(self, kdk_caching_needed: bool = False):
4850
4951 for service in services :
5052 name = Path (service ).name
51- logging .info (f "- Installing { name } " )
53+ logging .info (self . trans [ "- Installing {name}" ]. format ( name = name ) )
5254 if Path (services [service ]).exists ():
5355 if hashlib .sha256 (open (service , "rb" ).read ()).hexdigest () == hashlib .sha256 (open (services [service ], "rb" ).read ()).hexdigest ():
54- logging .info (f " - { name } checksums match, skipping" )
56+ logging .info (self . trans [ " - {name} checksums match, skipping" ]. format ( name = name ) )
5557 continue
56- logging .info (f " - Existing service found, removing" )
58+ logging .info (self . trans [ " - Existing service found, removing" ] )
5759 subprocess_wrapper .run_as_root_and_verify (["/bin/rm" , services [service ]], stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
5860 # Create parent directories
5961 if not Path (services [service ]).parent .exists ():
60- logging .info (f " - Creating { Path (services [service ]).parent } directory" )
62+ logging .info (self . trans [ " - Creating {path} directory" ]. format ( path = Path (services [service ]).parent ) )
6163 subprocess_wrapper .run_as_root_and_verify (["/bin/mkdir" , "-p" , Path (services [service ]).parent ], stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
6264 subprocess_wrapper .run_as_root_and_verify (generate_copy_arguments (service , services [service ]), stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
6365
@@ -69,11 +71,11 @@ def install_auto_patcher_launch_agent(self, kdk_caching_needed: bool = False):
6971 def _create_rsr_monitor_daemon (self ) -> bool :
7072 # Get kext list in /Library/Extensions that have the 'GPUCompanionBundles' property
7173 # This is used to determine if we need to run the RSRMonitor
72- logging .info ("- Checking if RSRMonitor is needed" )
74+ logging .info (self . trans [ "- Checking if RSRMonitor is needed" ] )
7375
7476 cryptex_path = f"/System/Volumes/Preboot/{ utilities .get_preboot_uuid ()} /cryptex1/current/OS.dmg"
7577 if not Path (cryptex_path ).exists ():
76- logging .info ("- No OS.dmg, skipping RSRMonitor" )
78+ logging .info (self . trans [ "- No OS.dmg, skipping RSRMonitor" ] )
7779 return False
7880
7981 kexts = []
@@ -82,21 +84,21 @@ def _create_rsr_monitor_daemon(self) -> bool:
8284 if not Path (f"{ kext } /Contents/Info.plist" ).exists ():
8385 continue
8486 except Exception as e :
85- logging .info (f " - Failed to check if { kext . name } is a directory: { e } " )
87+ logging .info (self . trans [ " - Failed to check if {name} is a directory: {error}" ]. format ( name = kext . name , error = e ) )
8688 continue
8789 try :
8890 kext_plist = plistlib .load (open (f"{ kext } /Contents/Info.plist" , "rb" ))
8991 except Exception as e :
90- logging .info (f " - Failed to load plist for { kext . name } : { e } " )
92+ logging .info (self . trans [ " - Failed to load plist for {name}: {error}" ]. format ( name = kext . name , error = e ) )
9193 continue
9294 if "GPUCompanionBundles" not in kext_plist :
9395 continue
94- logging .info (f " - Found kext with GPUCompanionBundles: { kext . name } " )
96+ logging .info (self . trans [ " - Found kext with GPUCompanionBundles: {name}" ]. format ( name = kext . name ) )
9597 kexts .append (kext .name )
9698
9799 # If we have no kexts, we don't need to run the RSRMonitor
98100 if not kexts :
99- logging .info ("- No kexts found with GPUCompanionBundles, skipping RSRMonitor" )
101+ logging .info (self . trans [ "- No kexts found with GPUCompanionBundles, skipping RSRMonitor" ] )
100102 return False
101103
102104 # Load the RSRMonitor plist
@@ -109,7 +111,7 @@ def _create_rsr_monitor_daemon(self) -> bool:
109111 rsr_monitor_plist ["ProgramArguments" ] = arguments
110112
111113 # Next add monitoring for '/System/Volumes/Preboot/{UUID}/cryptex1/OS.dmg'
112- logging .info (f " - Adding monitor: { cryptex_path } " )
114+ logging .info (self . trans [ " - Adding monitor: {path}" ]. format ( path = cryptex_path ) )
113115 rsr_monitor_plist ["WatchPaths" ] = [
114116 cryptex_path ,
115117 ]
0 commit comments