This is where I'll store a couple scripts that help you tidy up your Munki repository. For now, there's only one:
This script attempts to determine which package names are not "used" in your Munki repo. For example, you may have imported something into Munki once (perhaps while testing an AutoPkg recipe) but never added it to any manifests. Therefore, it's just taking up space.
The methodology used by the script is as follows:
- Iterate through your pkgsinfo folder, collecting all package names.
- Ignore any packages that are listed as an
update_for
. - Ignore any
apple_update_metadata
.
- Ignore any packages that are listed as an
- While doing the above, also collect any packages listed in
requires
. - Collect all package names used in any manifest.
- Remove the results of #2 and #3 from the total list of packages in #1, and you're left with the unused packages.
Known issues:
- If a package is listed as an
update_for
but the thing it's updating isn't used in a manifest, it will be incorrectly omitted from the "unused" list (in other words, a false negative, which is safer than a false positive).