Created
January 14, 2021 13:12
-
-
Save nikolay-n/1aa315a24428b76a7b3372668eb2a141 to your computer and use it in GitHub Desktop.
Simple tool to find and check pkgs, if there are pkgutil crash reports in ~/Library/Logs/DiagnosticReports
This file contains hidden or 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
#!/usr/bin/env bash | |
exec 3>&2 | |
trap 'exec 2>>/dev/null' DEBUG | |
exec 2>&3 | |
for pkg in $(mdfind "kMDItemContentTypeTree=public.archive" | grep -E "\.pkg$" | sort | uniq) | |
do | |
if [[ -f "$pkg" ]] | |
then | |
fname=$(basename "$pkg") | |
tmp_path="/tmp/pkg-unpacked-$fname-$RANDOM" | |
# trying to unpack package | |
echo -n "Unpacking $pkg ... " | |
pkgutil --expand-full "$pkg" "$tmp_path" >/dev/null 2>&1 | |
retVal=$? | |
if [ $retVal -ne 0 ]; then | |
echo "error" | |
else | |
echo "ok" | |
fi | |
rm -fR "$tmp_path" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment