Created
May 19, 2020 20:23
-
-
Save peterkelm/ffc2a29853d55ea45b80f621bc819d06 to your computer and use it in GitHub Desktop.
Want to know which pkgs files are referenced in which plists in a munki repository? Great, this script is for you!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########################################################################## | |
# | |
# (c) 2020 KelmMoyles / Peter Kelm <info@kelmmoyles.com> | |
# All rights reserved | |
# | |
# Want to know which pkgs files are referenced in which plists? | |
# Great, this script is for you! | |
# | |
# Note that this does not show orphan plist files | |
# (which would be a simple comparison against 'ls <path_to_munki_repo>/pkginfo')! | |
# | |
# Output: | |
# 1) Lines that do not start with "<path_to_munki_repo>/pkgsinfo" | |
# indicate that that pkg isn't referenced in any plist file | |
# 2) Duplicate references of the same plist should typically not occur | |
# (except e.g. if you use the pkg name somewhere in a comment inside the plist) | |
# | |
########################################################################## | |
if [ "$#" -ne 1 ]; then | |
echo "usage: scrape-repo.sh <path_to_munki_repo>" | |
exit 0 | |
fi | |
ls -1 "${1}/pkgs" | while read pkgs; | |
do | |
echo `grep --include=\*.plist -rnw "${1}/pkgsinfo" -e "${pkgs}"` "${pkgs}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment