Skip to content

Commit

Permalink
fix actionButtonPath for major upgrades and add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
erikng committed Feb 27, 2024
1 parent c29a2fe commit 039296c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 2 additions & 4 deletions Nudge/UI/Main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion Nudge/Utilities/SoftwareUpdate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion Nudge/Utilities/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand All @@ -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")
}

Expand Down

0 comments on commit 039296c

Please sign in to comment.