#!/bin/sh # pkgSummaryOfApps # This script gives a summary of what apps from a package # were installed under /Applications or /Applications/Utilities # according to the package's "bom" (bill of materials). # The pkg file to be looked at is specified as a command-line argument. # # Cameron Hayne (macdev@hayne.net) August 2007 if [ $# -lt 1 ]; then scriptname=`basename $0` echo "Usage: $scriptname pkg_file" exit fi pkg_path=$1 # We use 'find' to get the .bom files under the .pkg folder # and then run 'lsbom' on them # and then use 'sed' to remove the extraneous dot from the start of each line # and run the results through 'sort | uniq' # (this is useful since there are often two duplicate bom's in a .pkg) # and then use 'grep' to narrow it down to files or folders that are # directly under /Applications or /Applications/Utilities find "$pkg_path" -name '*.bom' -print0 | xargs -0 lsbom -pf \ | sed 's/^\.//' \ | sort | uniq \ | grep -E '^/Applications/(Utilities/|)[^/]+$'