From 039296cf877e284849c397e88c475f6f2928e2be Mon Sep 17 00:00:00 2001 From: Erik Gomez Date: Tue, 27 Feb 2024 13:24:05 -0600 Subject: [PATCH] fix actionButtonPath for major upgrades and add more logs --- Nudge/UI/Main.swift | 6 ++---- Nudge/Utilities/SoftwareUpdate.swift | 2 +- Nudge/Utilities/Utils.swift | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Nudge/UI/Main.swift b/Nudge/UI/Main.swift index f07a1fa1..4f37100e 100644 --- a/Nudge/UI/Main.swift +++ b/Nudge/UI/Main.swift @@ -354,9 +354,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { private func handleNoAttemptToFetchMajorUpgrade() { if !majorUpgradeAppPathExists && !majorUpgradeBackupAppPathExists { - LogManager.error("Unable to find major upgrade application, exiting Nudge", logger: uiLog) - nudgePrimaryState.shouldExit = true - exit(1) + LogManager.error("Unable to find major upgrade application, reverting to actionButtonPath", logger: uiLog) } } @@ -386,7 +384,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { handleNoAttemptToFetchMajorUpgrade() } } else { - LogManager.warning("actionButtonPath is nil or empty - actionButton will be unable to trigger any action required for major upgrades", logger: prefsProfileLog) + LogManager.warning("actionButtonPath is nil or empty - actionButton will be attempt to use /System/Library/CoreServices/Software Update.app for major upgrades", logger: prefsProfileLog) return } } diff --git a/Nudge/Utilities/SoftwareUpdate.swift b/Nudge/Utilities/SoftwareUpdate.swift index f799eae9..fed909fa 100644 --- a/Nudge/Utilities/SoftwareUpdate.swift +++ b/Nudge/Utilities/SoftwareUpdate.swift @@ -43,7 +43,7 @@ class SoftwareUpdate { GlobalVariables.fetchMajorUpgradeSuccessful = true // Update the state based on the download result } - } else { + } else if majorUpgradeAppPathExists || majorUpgradeBackupAppPathExists { LogManager.notice("Found major upgrade application or backup - skipping download", logger: softwareupdateListLog) } } else { diff --git a/Nudge/Utilities/Utils.swift b/Nudge/Utilities/Utils.swift index 07eb39db..2a57f48d 100644 --- a/Nudge/Utilities/Utils.swift +++ b/Nudge/Utilities/Utils.swift @@ -791,7 +791,7 @@ struct UIUtilities { private func determineUpdateURL() -> URL? { if let actionButtonPath = FeatureVariables.actionButtonPath { if actionButtonPath.isEmpty { - LogManager.warning("actionButtonPath is set but contains an empty string. Defaulting to out of box behavior.", logger: utilsLog) + LogManager.warning("actionButtonPath is set but contains an empty string. Defaulting to /System/Library/CoreServices/Software Update.app.", logger: utilsLog) return URL(fileURLWithPath: "/System/Library/CoreServices/Software Update.app") } @@ -818,6 +818,7 @@ struct UIUtilities { } } + LogManager.warning("Defaulting actionButtonPath to /System/Library/CoreServices/Software Update.app.", logger: utilsLog) return URL(fileURLWithPath: "/System/Library/CoreServices/Software Update.app") }