Spelling fixes for Munki 7 branch (#1263)

* Fix SidebarViewController.swift file name

* Fix spelling in comments

* Fix spelling in strings and output

* Fix spelling in variables and key names

* One more pass at spelling fixes
This commit is contained in:
Elliot Jordan
2025-08-27 12:27:12 -07:00
committed by GitHub
parent d92e30f7ef
commit 41e6d38cc5
59 changed files with 103 additions and 103 deletions
+1 -1
View File
@@ -227,7 +227,7 @@ func main() async -> Int32 {
// get socket file descriptor from launchd
guard let socketFD = try? getSocketFd(APPNAME) else {
munkiLog("Could not get socket decriptor from launchd", logFile: APPUSAGED_LOGFILENAME)
munkiLog("Could not get socket descriptor from launchd", logFile: APPUSAGED_LOGFILENAME)
usleep(1_000_000 * 10)
return -1
}
+2 -2
View File
@@ -46,7 +46,7 @@ class FDEUtil {
}
}
/// Convenience method: logs a message, then returns it so we can thow an error
/// Convenience method: logs a message, then returns it so we can throw an error
/// with the same message
func logAndReturn(_ message: String) -> String {
server.log(message)
@@ -322,7 +322,7 @@ func main() async -> Int32 {
// get socket file descriptor from launchd
guard let socketFD = try? getSocketFd(APPNAME) else {
munkiLog("Could not get socket decriptor from launchd", logFile: LOGFILENAME)
munkiLog("Could not get socket descriptor from launchd", logFile: LOGFILENAME)
usleep(1_000_000 * 10)
return -1
}
+2 -2
View File
@@ -18,7 +18,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// original Python implmentation by Ben Toms @ Jamf (dataJAR)
// original Python implementation by Ben Toms @ Jamf (dataJAR)
import Foundation
import SystemConfiguration
@@ -417,7 +417,7 @@ func main() {
rotateLog(LOGFILENAME, ifLargerThan: 1_000_000)
log("Starting \(APP_NAME) \(APP_VERSION)")
// get our launch group from either the enviroment or the first argument
// get our launch group from either the environment or the first argument
var group = "<none>"
var manualLaunch = true
let env = ProcessInfo.processInfo.environment
+1 -1
View File
@@ -121,7 +121,7 @@ func main() -> Int32 {
var logoutTimeOverride: Date?
var logoutTime = Date.distantFuture
// minimium notification of 60 minutes + 3 seconds
// minimum notification of 60 minutes + 3 seconds
let minimumNotificationMinutes = Double(MANDATORY_NOTIFICATIONS.max() ?? 60)
let minimumNotificationsLogoutTime = Date().addingTimeInterval(60 * minimumNotificationMinutes + 30)
@@ -220,7 +220,7 @@ func notifyUserOfUpdates(force: Bool = false) {
// doesn't require exactly 24 hours to elapse
// subtract 6 hours
// IOW, if we notify today at 4pm, we don't really want to wait
// until after 4pm tomorrow to notifiy again.
// until after 4pm tomorrow to notify again.
Double((daysBetweenNotifications * 24 * 60 * 60) - (6 * 60 * 60))
} else {
0.0
@@ -124,7 +124,7 @@ extension ManifestUtil {
}
}
/// Prints contents of a given manifest, expanding included maniifests
/// Prints contents of a given manifest, expanding included manifests
extension ManifestUtil {
struct ExpandIncludedManifests: AsyncParsableCommand {
static var configuration = CommandConfiguration(
@@ -296,7 +296,7 @@ extension ManifestUtil {
}
}
/// Add an inlcuded_manifest to a manifest
/// Add an included_manifest to a manifest
extension ManifestUtil {
struct AddIncludedManifest: AsyncParsableCommand {
static var configuration = CommandConfiguration(
@@ -57,7 +57,7 @@ func copyOrRenameManifest(repo: Repo, sourceName: String, destinationName: Strin
do {
let data = try await repo.get("manifests/\(sourceName)")
try await repo.put("manifests/\(destinationName)", content: data)
// TODO: on a case-insenstive file system this can end up deleting the file
// TODO: on a case-insensitive file system this can end up deleting the file
// (If you rename "test" to "TEST", then delete "test" you actually delete "TEST")
if deleteSource {
try await repo.delete("manifests/\(sourceName)")
@@ -77,7 +77,7 @@ class TabCompleter {
/// this is a singleton, so only one instance, please
private init() {}
/// retreive our lists of repo items and store them
/// retrieve our lists of repo items and store them
func cache(manifestsOnly: Bool = false) async {
debugLog("Caching completion data. manifestsOnly: \(manifestsOnly)")
if let repo = RepoConnection.shared.repo {
@@ -26,7 +26,7 @@ struct MunkiVersionTests {
#expect(version1 == version2)
}
/// Test that less-than comparision is numeric and not alpha
/// Test that less-than comparison is numeric and not alpha
@Test func versionsCompareFoo() async throws {
let version1 = MunkiVersion("1.2")
let version2 = MunkiVersion("1.10")
+1 -1
View File
@@ -167,7 +167,7 @@ struct MunkiImport: AsyncParsableCommand {
guard let repoURL = munkiImportOptions.repoURL,
let plugin = munkiImportOptions.plugin
else {
// won"t happen because we validated it earlier
// won't happen because we validated it earlier
throw ExitCode(1)
}
+1 -1
View File
@@ -114,7 +114,7 @@ func parseArgumentData(_ data: Data) throws -> [String] {
//
// <https://opensource.apple.com/source/adv_cmds/adv_cmds-176/ps/print.c.auto.html>
// returns a list of strings: [0] is the execuatable path,
// returns a list of strings: [0] is the executable path,
// the rest is `argv[0]` through `argv[argc - 1]
// Parse `argc`. Were assuming the value is little endian here, which is
@@ -103,7 +103,7 @@ struct CatalogsMaker {
return iconHashes
}
/// Returns a case-insentitive match for installer_item from pkgsList, if any
/// Returns a case-insensitive match for installer_item from pkgsList, if any
func caseInsensitivePkgsListContains(_ installer_item: String) -> String? {
for repo_pkg in pkgsList {
if installer_item.lowercased() == repo_pkg.lowercased() {
@@ -358,10 +358,10 @@ func getIconIdentifier(_ pkginfo: PlistDict) -> String {
/// Returns true if there is an icon for this item in the repo
func iconIsInRepo(_ repo: Repo, pkginfo: PlistDict) async -> Bool {
let iconIdentifer = getIconIdentifier(pkginfo)
let iconIdentifier = getIconIdentifier(pkginfo)
do {
let iconList = try await listItemsOfKind(repo, "icons")
return iconList.contains(iconIdentifer)
return iconList.contains(iconIdentifier)
} catch let error as MunkiError {
printStderr("Unable to get list of icons: \(error.description)")
return false
+3 -3
View File
@@ -85,7 +85,7 @@ func createInstallsItem(_ itempath: String) -> PlistDict {
if let minOSVers = plist["LSMinimumSystemVersion"] as? String {
info["minosversion"] = minOSVers
} else if let minOSVersByArch = plist["LSMinimumSystemVersionByArchitecture"] as? [String: String] {
// get the highest/latest of all the minmum os versions
// get the highest/latest of all the minimum os versions
let minOSVersions = minOSVersByArch.values
let versions = minOSVersions.map { MunkiVersion($0) }
if let maxVersion = versions.max() {
@@ -249,7 +249,7 @@ func createPkgInfoForDragNDrop(_ mountpoint: String, options: PkginfoOptions) th
/// Mounts a disk image if it"s not already mounted
/// Builds pkginfo for the first installer item found at the root level,
/// or a specific one if specified by options.pkgname or options.item
/// Unmounts the disk image if it wasn"t already mounted
/// Unmounts the disk image if it wasn't already mounted
func createPkgInfoFromDmg(_ dmgpath: String,
options: PkginfoOptions) throws -> PlistDict
{
@@ -544,7 +544,7 @@ func makepkginfo(_ filepath: String?,
}
}
if let minimumMunkiVersion = options.other.minimumMunkiVersion {
pkginfo["miminum_munki_version"] = minimumMunkiVersion
pkginfo["minimum_munki_version"] = minimumMunkiVersion
}
if options.other.onDemand {
pkginfo["OnDemand"] = true
+2 -2
View File
@@ -8,7 +8,7 @@
import Foundation
/// This is a function that is called by our custom signal handlers that react to SIGINT or SIGTERM.
/// Wtihout this, the terminal can be a mess if someone hits Control-C to interrupt the process while
/// Without this, the terminal can be a mess if someone hits Control-C to interrupt the process while
/// `readline` is waiting for input
func cleanupReadline() {
if rl_line_buffer != nil {
@@ -29,7 +29,7 @@ func cleanupReadline() {
/// to insert the prompt and default text _after_ we fire up _readline_. Like I said, a nasty hack.
func getInput(prompt: String? = nil, defaultText: String? = nil) -> String? {
// A really awful hack to get default text since
// the readline implmentation is so broken
// the readline implementation is so broken
let queue = OperationQueue()
let insertOperation = BlockOperation {
usleep(10000) // 0.01 seconds
+1 -1
View File
@@ -121,7 +121,7 @@ func filterOutMajorOSUpgrades(_ appleUpdates: [PlistDict]) -> [PlistDict] {
// There's a couple of strategies we could use here:
//
// 1) Match update names that start with "macOS" and end with a version
// number matching the uupdate version, then compare the first part
// number matching the update version, then compare the first part
// of that version against the currently installed OS. IOW,
// if we are currently running 13.6.9, an update to 14.6.1 or 15.0
// would be a major update. This could break if Apple changes its
+2 -2
View File
@@ -106,7 +106,7 @@ func getAuthRestartKey(quiet: Bool = false) -> String? {
let recoveryKey = recoveryKeyDict["RecoveryKey"] as? String
else {
if !quiet {
Authrestart.logger.error("Could not retreive recovery key from \(recoveryKeyPlist).")
Authrestart.logger.error("Could not retrieve recovery key from \(recoveryKeyPlist).")
}
return nil
}
@@ -195,7 +195,7 @@ func doAuthorizedOrNormalRestart(
// notify that it did then perform a normal restart
Authrestart.logger.warning("Authorized Restart failed. Performing normal restart...")
} else {
// we sucessfully triggered an authrestart
// we successfully triggered an authrestart
return
}
}
@@ -83,7 +83,7 @@ class AuthRestartClient {
return result.hasPrefix("OK")
}
/// Returns Ttue if we are ready to attempt an auth restart
/// Returns True if we are ready to attempt an auth restart
func verifyCanAttemptAuthRestart() throws -> Bool {
let request = ["task": "verify_can_attempt_auth_restart"]
let result = try process(request)
+1 -1
View File
@@ -104,7 +104,7 @@ func setBootstrapMode() throws {
atPath: CHECKANDINSTALLATSTARTUPFLAG, contents: nil
) {
resetFDEAutoLogin()
throw MunkiError("Could not reate bootstrapping flag file")
throw MunkiError("Could not create bootstrapping flag file")
}
}
+2 -2
View File
@@ -220,8 +220,8 @@ func predicateInfoObject() async -> PlistDict {
}
/// Evaluates predicate against the info object; returns a boolean
/// Calls out to an Objective-C function because NSPrediacte methods can
/// raise NSExecption, whcih Swift cannot catch
/// Calls out to an Objective-C function because NSPredicate methods can
/// raise NSException, which Swift cannot catch
func predicateEvaluatesAsTrue(
_ predicateString: String,
infoObject: PlistDict,
@@ -197,7 +197,7 @@ func installItem(_ item: PlistDict) async -> (Int, Bool) {
if item["preinstall_script"] is String {
let retcode = await runEmbeddedScript(name: "preinstall_script", pkginfo: item)
if retcode != 0 {
// if preinstall_script fails, do not proceeed
// if preinstall_script fails, do not proceed
return (retcode, false)
}
}
@@ -437,7 +437,7 @@ func uninstallItem(_ item: PlistDict) async -> (Int, Bool) {
if item["preuninstall_script"] is String {
let retcode = await runEmbeddedScript(name: "preuninstall_script", pkginfo: item)
if retcode != 0 {
// if preuninstall_script fails, do not proceeed
// if preuninstall_script fails, do not proceed
return (retcode, false)
}
}
+1 -1
View File
@@ -575,7 +575,7 @@ func removePackages(
throw MunkiError("No matching pkgs found in database")
}
} catch {
display.error("Error retreiving pkg keys: \(error)")
display.error("Error retrieving pkg keys: \(error)")
return -4
}
if stopRequested() {
+3 -3
View File
@@ -124,7 +124,7 @@ func munkiLogRotateMainLog() {
}
/// A nicer abstraction for the various Munki logging functions.
/// The "classic" UNIX logging levels each have a method, though tradtionally Munki has
/// The "classic" UNIX logging levels each have a method, though traditionally Munki has
/// not used many of these levels.
class MunkiLogger {
// an easy way to get the standard logger. can't use the name "default"
@@ -183,14 +183,14 @@ class MunkiLogger {
debug1(message)
}
/// These aren't traditional UNIX logging levels, but Munki has traditonally used them
/// These aren't traditional UNIX logging levels, but Munki has traditionally used them
func debug1(_ message: String) {
if level > 1 {
munkiLog("DEBUG1: \(message)", logFile: logname)
}
}
/// These aren't traditional UNIX logging levels, but Munki has traditonally used them
/// These aren't traditional UNIX logging levels, but Munki has traditionally used them
func debug2(_ message: String) {
if level > 2 {
munkiLog("DEBUG2: \(message)", logFile: logname)
@@ -262,7 +262,7 @@ class FileRepo: Repo {
}
/// Returns the filesystem path to the item in the repo
/// Non-filesystem Repo sublcasses should implement this but return nil
/// Non-filesystem Repo subclasses should implement this but return nil
func pathFor(_ identifier: String) -> String? {
return fullPath(identifier)
}
@@ -41,7 +41,7 @@ class GitFileRepo: FileRepo {
return runCLI(cmd, arguments: args)
}
/// Returns True if file referred to by identifer will be ignored by Git
/// Returns True if file referred to by identifier will be ignored by Git
/// (usually due to being in a .gitignore file)
func isGitIgnored(_ identifier: String) -> Bool {
let results = runGit(
@@ -51,7 +51,7 @@ class GitFileRepo: FileRepo {
return results.exitcode == 0
}
/// Returns True if file referred to by identifer is in a Git repo, false otherwise.
/// Returns True if file referred to by identifier is in a Git repo, false otherwise.
func isInGitRepo(_ identifier: String) -> Bool {
let results = runGit(
args: ["-C", parentDir(identifier),
+1 -1
View File
@@ -17,7 +17,7 @@ func composedURLWithBase(_ baseURLString: String, adding path: String) -> String
/// Returns a URL to something in a Munki repo.
/// If type is empty, returns the base URL for the Munki repo.
/// If type is one of the supported types, returns the type-specific URL.
/// If type is specifiied and resource is also specifiied, a full URL to the resource is
/// If type is specified and resource is also specified, a full URL to the resource is
/// constructed and returned
func munkiRepoURL(_ type: String = "", resource: String = "") -> String? {
// we could use composedURLWithBase, but that doesn't handle
@@ -18,7 +18,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// functions for retreiving info about osinstallers
// functions for retrieving info about osinstallers
// may not call display* functions or munkilog* functions
import Foundation
@@ -148,7 +148,7 @@ func makeStartOSInstallPkgInfo(mountpoint: String, item: String) throws -> Plist
let minimumOSVersion = "10.9"
if version.hasPrefix("10.14") {
// https://support.apple.com/en-us/HT201475
// use inital values
// use initial values
} else if version.hasPrefix("11.") {
// https://support.apple.com/en-us/HT211238
installedSize = Int(35.5 * 1024 * 1024)
@@ -207,7 +207,7 @@ func makeStageOSInstallerPkgInfo(_ appPath: String) throws -> PlistDict {
let minimumOSVersion = "10.9"
if version.hasPrefix("11.") {
// https://support.apple.com/en-us/HT211238
// use intial values
// use initial values
} else if version.hasPrefix("12.") {
// https://support.apple.com/en-us/HT212551
installedSize = Int(26 * 1024 * 1024)
@@ -463,7 +463,7 @@ func getItemDetail(
display.debug1("Our Munki version is \(munkiVersion)")
if MunkiVersion(munkiVersion) < MunkiVersion(minimumMunkiVersion) {
rejectedItems.append(
"Rejected item \(name), version \(version) with minumum Munki version required \(minimumMunkiVersion). Our Munki version is \(munkiVersion)."
"Rejected item \(name), version \(version) with minimum Munki version required \(minimumMunkiVersion). Our Munki version is \(munkiVersion)."
)
return false
}
@@ -653,7 +653,7 @@ func getCatalogs(_ catalogList: [String]) {
throw PlistError.readError(description: "plist is in wrong format")
}
} catch {
display.error("Retreived catalog is invalid: \(error.localizedDescription)")
display.error("Retrieved catalog is invalid: \(error.localizedDescription)")
}
}
}
@@ -202,7 +202,7 @@ func compareApplicationVersion(_ appItem: PlistDict) throws -> MunkiComparisonRe
///
/// If item has md5checksum attribute, compares on disk file's checksum.
///
/// Throws a MunkiError if there's a problwm with the input
/// Throws a MunkiError if there's a problem with the input
func filesystemItemStatus(_ item: PlistDict) throws -> MunkiComparisonResult {
guard let filepath = item["path"] as? String else {
throw MunkiError("No path specified for filesystem item")
@@ -91,7 +91,7 @@ func enoughDiskSpaceFor(
/// Downloads an (un)installer item.
/// Returns true if the item was downloaded, false if it was already cached.
/// Thows an error if there are issues
/// Throws an error if there are issues
func downloadInstallerItem(
_ item: PlistDict,
installInfo: PlistDict,
@@ -197,7 +197,7 @@ func getIconHashes() -> [String: String] {
)
return try readPlist(fromFile: iconsHashesPlist) as? [String: String] ?? [:]
} catch {
display.debug1("Error while retreiving icon hashes: \(error.localizedDescription)")
display.debug1("Error while retrieving icon hashes: \(error.localizedDescription)")
return [String: String]()
}
}
@@ -427,7 +427,7 @@ func uncache(_ spaceNeededInKB: Int) {
var deletedKB = 0
let filemanager = FileManager.default
for (path, size) in itemsWithSize {
// we delete the smallest item first, proceeeding until
// we delete the smallest item first, proceeding until
// we've freed up enough space or deleted all the items
if deletedKB >= spaceNeededInKB {
break
@@ -196,8 +196,8 @@ func someVersionInstalled(_ pkginfo: PlistDict) async -> Bool {
if pkginfo["version_script"] is String {
// if there's a version_script, let's use that to determine
// if some version installed
let comparsionResult = await compareUsingVersionScript(pkginfo)
if comparsionResult == .notPresent {
let comparisonResult = await compareUsingVersionScript(pkginfo)
if comparisonResult == .notPresent {
return false
}
return true
@@ -242,7 +242,7 @@ func someVersionInstalled(_ pkginfo: PlistDict) async -> Bool {
}
/// Checks to see if there is any evidence that the item described
/// by pkginfo (any version) is currenly installed.
/// by pkginfo (any version) is currently installed.
/// If any tests pass, the item might be installed.
/// This is used when determining if we can remove the item, thus
/// the attention given to the uninstall method.
@@ -23,7 +23,7 @@ extension ManifestError: LocalizedError {
case let .invalid(description):
return "Manifest is invalid: \(description)"
case let .notRetrieved(description):
return "Manifest was not retreived: \(description)"
return "Manifest was not retrieved: \(description)"
case let .connection(errorCode, description):
return "There was a connection error: \(errorCode): \(description)"
case let .http(errorCode, description):
@@ -118,7 +118,7 @@ func getManifest(_ name: String, suppressErrors: Bool = false) throws -> String
}
// got a valid plist
display.detail("Retreived manifest \(name)")
display.detail("Retrieved manifest \(name)")
Manifests.shared.set(name, path: manifestLocalPath)
return manifestLocalPath
}
@@ -141,7 +141,7 @@ func getPrimaryManifest(alternateIdentifier: String? = nil) throws -> String {
if !clientIdentifier.isEmpty {
manifest = try getManifest(clientIdentifier)
} else {
// no clientIdentifer specified. Try a variety of possible identifiers
// no clientIdentifier specified. Try a variety of possible identifiers
display.detail("No client identifier specified. Trying default manifest resolution...")
var identifiers = [String]()
@@ -169,7 +169,7 @@ func getPrimaryManifest(alternateIdentifier: String? = nil) throws -> String {
display.detail("Manifest \(identifier) not found...")
continue // try the next identifier
} else {
// juse rethrow it
// just rethrow it
throw error
}
}
@@ -264,13 +264,13 @@ func checkForUpdates(clientID: String? = nil, localManifestPath: String? = nil)
}
guard let mainManifest = manifestData(mainManifestPath) else {
display.error("Could not get manifest data from main mainfest \(mainManifestPath)")
display.error("Could not get manifest data from main manifest \(mainManifestPath)")
return .finishedWithErrors
}
guard let mainManifestCatalogsList = mainManifest["catalogs"] as? [String],
!mainManifestCatalogsList.isEmpty
else {
display.error("Main mainfest \(mainManifestPath) does not have a list of catalogs")
display.error("Main manifest \(mainManifestPath) does not have a list of catalogs")
return .finishedWithErrors
}
@@ -446,7 +446,7 @@ func checkForUpdates(clientID: String? = nil, localManifestPath: String? = nil)
installInfo["managed_installs"] = managedInstalls
if startOSInstallItems.count > 1 {
display.warning("There are mulitple startosinstall items in managed_installs. Only the install of the first one will be attempted.")
display.warning("There are multiple startosinstall items in managed_installs. Only the install of the first one will be attempted.")
}
// record detail before we throw it away...
+3 -3
View File
@@ -132,7 +132,7 @@ class ProcessRunner {
// delegate?.processUpdated()
}
// making this a seperate method so the non-timeout calls
// making this a separate method so the non-timeout calls
// don't need to worry about catching exceptions
// NOTE: the timeout here is _not_ an idle timeout;
// it's the maximum time the process can run
@@ -193,7 +193,7 @@ class ProcessRunner {
/// Runs a command line tool synchronously, returns CLIResults
/// this implementation attempts to handle scenarios in which a large amount of stdout
/// or sterr output is generated
/// or stderr output is generated
func runCLI(_ tool: String,
arguments: [String] = [],
environment: [String: String] = [:],
@@ -408,7 +408,7 @@ class AsyncProcessRunner {
delegate?.processUpdated()
}
// making this a seperate method so the non-timeout calls
// making this a separate method so the non-timeout calls
// don't need to worry about catching exceptions
// NOTE: the timeout here is _not_ an idle timeout;
// it's the maximum time the process can run
+1 -1
View File
@@ -497,7 +497,7 @@ func getFlatPackageInfo(_ pkgpath: String) throws -> PlistDict {
errors.append("No receipts found in Distribution or PackageInfo files within the package.")
}
} else {
errors.append("An error occurred while geting table of contents for \(pkgpath): \(tocResults.error)")
errors.append("An error occurred while getting table of contents for \(pkgpath): \(tocResults.error)")
}
// change back to original working dir
filemanager.changeCurrentDirectoryPath(cwd)
+1 -1
View File
@@ -109,7 +109,7 @@ func plistToString(_ dataObject: Any) throws -> String {
}
/// Parses a string, looking for the first thing that looks like a plist.
/// Returns two strings. The first will be a string representaion of a plist (or empty)
/// Returns two strings. The first will be a string representation of a plist (or empty)
/// The second is any characters remaining after the found plist
func parseFirstPlist(fromString str: String) -> (String, String) {
let header = "<?xml version"