aboutsummaryrefslogtreecommitdiffstats
path: root/whatbuild.sh
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2011-04-04 15:36:26 +0300
committerFilipp Lepalaan <filipp@mac.com>2011-04-04 15:36:26 +0300
commit6dff30e12a9cf14c51675b35a519d1980a0f3ce1 (patch)
tree6b1a4f9822b8d77cb70d571e7b7c799f2e76196f /whatbuild.sh
parente88df52f6c6509bbb422b18fa1e460199512eda0 (diff)
downloadmtk-6dff30e12a9cf14c51675b35a519d1980a0f3ce1.tar.gz
mtk-6dff30e12a9cf14c51675b35a519d1980a0f3ce1.tar.bz2
mtk-6dff30e12a9cf14c51675b35a519d1980a0f3ce1.zip
Added whatbuild
Diffstat (limited to 'whatbuild.sh')
-rwxr-xr-xwhatbuild.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/whatbuild.sh b/whatbuild.sh
new file mode 100755
index 0000000..2a2b77e
--- /dev/null
+++ b/whatbuild.sh
@@ -0,0 +1,22 @@
+#! /usr/bin/env bash
+# whatbuild.sh
+# @description determine build number of OS on target volume
+# @package mtk
+# @author Filipp Lepalaan <filipp@mcare.fi>
+
+USAGE="$(basename $0) [volume=/]"
+VOLUME=${1:-"/"}
+PLIST="${VOLUME}/System/Library/CoreServices/SystemVersion.plist"
+
+if [[ $1 == "-h" ]]; then
+ echo $USAGE
+ exit 0
+fi
+
+if [[ ! -e "${PLIST}" ]]; then
+ echo "invalid volume: ${VOLUME}" 2>&1
+ exit 1
+fi
+
+/usr/libexec/PlistBuddy -c 'Print ProductBuildVersion' "${PLIST}"
+exit 0 \ No newline at end of file