Skip to content

Instantly share code, notes, and snippets.

@packetpilot
Created September 19, 2012 09:03
Show Gist options
  • Save packetpilot/3748579 to your computer and use it in GitHub Desktop.
Save packetpilot/3748579 to your computer and use it in GitHub Desktop.
Bundling OS-dependent packages within a unifying OS-agnostic flat pkg
#!/bin/bash
# dc, cops, ooyala
# postflight for bothlions cltools
# 19 Sept 2012
# socialized as a template for OS-agnostic forked packages for leaner package management
# (YMMV depending on how you view package management!)
# postflight intended to install command-line tools across Lion and Mountain Lion
# intended for OS-agnostic pkgcore deployment workflow
# assumes payload of package drops off appropriate folders within /private/var/cltools/
OS=`/usr/bin/sw_vers -productVersion`
payload="/private/var/cltools" # within this should be flat directories containing packages
product="Command Line Tools"
if [[ $OS == 10.8* ]]; then
cd "${payload}"108
for pkg in *.pkg; do
installer -pkg "$pkg" -target "$3" -dumplog -verbose
done
elif [[ $OS == 10.7* ]]; then
cd "${payload}"107
for pkg in *.pkg; do
installer -pkg "$pkg" -target "$3" -dumplog -verbose
done
else
logger "Confused; perhaps this is running on a new major OS?"
exit 428
fi
logger "Successfully installed $product for $OS"
rm -rf "${payload}"
logger "Cleaned up and removed folders"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment