fix daemons not restoring + file ownership

This commit is contained in:
leminlimez
2024-12-02 16:10:43 -05:00
parent 3374957deb
commit 3c10a6fce8
8 changed files with 99 additions and 113 deletions

View File

@@ -14,6 +14,7 @@ class Tweak:
value: any = 1,
edit_type: TweakModifyType = TweakModifyType.TOGGLE,
min_version: Version = Version("1.0"),
owner: int = 501, group: int = 501,
divider_below: bool = False
):
self.label = label
@@ -22,6 +23,8 @@ class Tweak:
self.value = value
self.min_version = min_version
self.edit_type = edit_type
self.owner = owner
self.group = group
self.divider_below = divider_below
self.enabled = False
@@ -49,10 +52,11 @@ class BasicPlistTweak(Tweak):
value: any = True,
edit_type: TweakModifyType = TweakModifyType.TOGGLE,
min_version: Version = Version("1.0"),
owner: int = 501, group: int = 501,
is_risky: bool = False,
divider_below: bool = False
):
super().__init__(label=label, key=key, subkey=None, value=value, edit_type=edit_type, min_version=min_version, divider_below=divider_below)
super().__init__(label=label, key=key, subkey=None, value=value, edit_type=edit_type, min_version=min_version, owner=owner, group=group, divider_below=divider_below)
self.file_location = file_location
self.is_risky = is_risky
@@ -72,10 +76,15 @@ class AdvancedPlistTweak(BasicPlistTweak):
keyValues: dict,
edit_type: TweakModifyType = TweakModifyType.TOGGLE,
min_version: Version = Version("1.0"),
owner: int = 501, group: int = 501,
is_risky: bool = False,
divider_below: bool = False
):
super().__init__(label=label, file_location=file_location, key=None, value=keyValues, edit_type=edit_type, min_version=min_version, is_risky=is_risky, divider_below=divider_below)
super().__init__(label=label, file_location=file_location, key=None, value=keyValues, edit_type=edit_type, min_version=min_version, owner=owner, group=group, is_risky=is_risky, divider_below=divider_below)
def set_multiple_values(self, keys: list[str], value: any):
for key in keys:
self.value[key] = value
def apply_tweak(self, other_tweaks: dict, risky_allowed: bool = False) -> dict:
if not self.enabled or (self.is_risky and not risky_allowed):

View File

@@ -2,15 +2,6 @@ from devicemanagement.constants import Version
from .tweak_classes import MobileGestaltTweak, MobileGestaltMultiTweak, MobileGestaltPickerTweak, FeatureFlagTweak, TweakModifyType, BasicPlistTweak, AdvancedPlistTweak, RdarFixTweak
from .eligibility_tweak import EligibilityTweak, AITweak
from .basic_plist_locations import FileLocation
default_disabled_daemons = {
"com.apple.magicswitchd.companion": True,
"com.apple.security.otpaird": True,
"com.apple.dhcp6d": True,
"com.apple.bootpd": True,
"com.apple.ftp-proxy-embedded": False,
"com.apple.relevanced": True
}
tweaks = {
## MobileGestalt Tweaks
@@ -278,66 +269,18 @@ tweaks = {
),
## Daemons
"DisableThermalmonitord": AdvancedPlistTweak(
"Disable thermalmonitord",
"Daemons": AdvancedPlistTweak(
"Disable Daemons",
FileLocation.disabledDaemons,
default_disabled_daemons.copy().update({"com.apple.thermalmonitord": True})
),
"DisableOTADaemon": AdvancedPlistTweak(
"Disable OTA (daemon)",
FileLocation.disabledDaemons,
default_disabled_daemons.copy().update({
"com.apple.mobile.softwareupdated": True,
"com.apple.OTATaskingAgent": True,
"com.apple.softwareupdateservicesd": True
})
),
"DisableUsageTracking": AdvancedPlistTweak(
"Disable Usage Tracking",
FileLocation.disabledDaemons,
default_disabled_daemons.copy().update({
"com.apple.UsageTrackingAgent": True
})
),
"DisableGameCenter": AdvancedPlistTweak(
"Disable Game Center",
FileLocation.disabledDaemons,
default_disabled_daemons.copy().update({"com.apple.gamed": True})
),
"DisableScreenTime": AdvancedPlistTweak(
"Disable Screen Time Agent",
FileLocation.disabledDaemons,
default_disabled_daemons.copy().update({"com.apple.ScreenTimeAgent": True})
),
"DisableCrashReports": AdvancedPlistTweak(
"Disable Usage Tracking",
FileLocation.disabledDaemons,
default_disabled_daemons.copy().update({
"com.apple.ReportCrash": True,
"com.apple.ReportCrash.Jetsam": True,
"com.apple.ReportMemoryException": True,
"com.apple.OTACrashCopier": True,
"com.apple.analyticsd": True,
"com.apple.aslmanager": True,
"com.apple.coresymbolicationd": True,
"com.apple.crash_mover": True,
"com.apple.crashreportcopymobile": True,
"com.apple.DumpBasebandCrash": True,
"com.apple.DumpPanic": True,
"com.apple.logd": True,
"com.apple.logd.admin": True,
"com.apple.logd.events": True,
"com.apple.logd.watchdog": True,
"com.apple.logd_reporter": True,
"com.apple.logd_reporter.report_statistics": True,
"com.apple.system.logger": True,
"com.apple.syslogd": True
})
),
"DisableTips": AdvancedPlistTweak(
"Disable Tips",
FileLocation.disabledDaemons,
default_disabled_daemons.copy().update({"com.apple.tipsd": True})
{
"com.apple.magicswitchd.companion": True,
"com.apple.security.otpaird": True,
"com.apple.dhcp6d": True,
"com.apple.bootpd": True,
"com.apple.ftp-proxy-embedded": False,
"com.apple.relevanced": True
},
owner=0, group=0
),
## Risky Options