From 6dff30e12a9cf14c51675b35a519d1980a0f3ce1 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 4 Apr 2011 15:36:26 +0300 Subject: Added whatbuild --- netbless.sh | 9 +++++---- whatbuild.sh | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100755 whatbuild.sh diff --git a/netbless.sh b/netbless.sh index 934a975..b604cf2 100755 --- a/netbless.sh +++ b/netbless.sh @@ -14,26 +14,27 @@ if [[ $1 == "help" ]]; then exit 0 fi -SERVER_PATH=${3:-"/data/nb"} SERVER=${2:-"sw.mcare.fi"} +SERVER_PATH=${3:-"/data/nb"} SERVER_IP=$(/usr/bin/dig +short ${SERVER}) -ME=${1:-$(/usr/sbin/sysctl -n hw.model)} MACHINE=$(sysctl -n hw.machine) if [[ $MACHINE == "x86_64" ]]; then MACHINE="i386/${MACHINE}" fi +ME=${1:-$(/usr/sbin/sysctl -n hw.model)} + if [[ -z $ME ]]; then echo "Error: could not determine hardware model" 2>&1 exit 1 fi -IMAGES=$(/usr/bin/curl -s http://${SERVER}/mh/) +IMAGES=$(/usr/bin/curl -s "http://${SERVER}/mh/") if [[ $1 == "list" ]]; then - echo -e "Available images: [${IMAGES}]" 2>&1 + echo -e "Available images: ${IMAGES}" 2>&1 exit 0 fi 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 + +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 -- cgit v1.2.3