We've upgrade our KBE Netboot environment to OS X Lion and the built-in "capture name/replace name" scripts stopped working, below are modified version of the original KACE scripts that seem to work in our Netboot environment hopefully these can help the rest of you that use KACE for imaging MAC's.

(I am by no means a MAC programmer so if anyone has a better suggestion I would love the hear it)

Naming: Collect Mac OS X Computer Name (Preinstallation Task)

#!/bin/bash

MAC=`/usr/sbin/networksetup -getmacaddress Ethernet 2> /dev/null | awk ' { print $3; }' | sed -e s/://g `

TEMP_PATH="/opt/kace/petemp/${MAC}"

IFS=$'\n'
volume=`mount | grep -m 1 disk0`
zeroMount=`echo "$volume" | awk '{ print substr($0,index($0, "on ")+3,index($0, "(")-index($0, "on ")-4) }'`

prefPath=$zeroMount/Library/Preferences/SystemConfiguration/preferences.plist

tComputerName=`/usr/libexec/PlistBuddy -c "Print System:System:ComputerName" $prefPath`
computerName=`echo $tComputerName | awk '{ print index($0,"Not Exist") }'`
if [ x$computerName == x0 ]; then
computerName=$tComputerName
else
computerName="localhost"
fi

echo $computerName > "${TEMP_PATH}"

exit 0


Naming: Apply Mac OS X Computer Name (Postinstallation Task)


#!/bin/bash

MAC=`/usr/sbin/networksetup -getmacaddress Ethernet 2> /dev/null | awk ' { print $3; }' | sed -e s/://g `

TEMP_PATH="/opt/kace/petemp/${MAC}"

if [ -f "${TEMP_PATH}" ]
then
volume=`mount | grep -m 1 disk0`
zeroMount=`echo "$volume" | awk '{ print substr($0,index($0, "on ")+3,index($0, "(")-index($0, "on ")-4) }'`
COMPNAME=`cat ${TEMP_PATH}`
echo "Computer name is going to be ${COMPNAME}"
/usr/libexec/PlistBuddy -c "Set :System:Network:HostNames:LocalHostName ${COMPNAME}" "$zeroMount/Library/Preferences/SystemConfiguration/preferences.plist"
/usr/libexec/PlistBuddy -c "Set :System:System:ComputerName ${COMPNAME}" "$zeroMount/Library/Preferences/SystemConfiguration/preferences.plist"
/bin/rm "${TEMP_PATH}"
fi

exit 0


- If this post helped please consider rating it -
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0

Thanks for the suggestions. We used these modifications with success.

One thing that I am looking at doing with this as well now is that if the preinstall script sees that there is not a hostname, or it is not the standard naming convention then it will prompt for a name to be used.

Thanks!

Answered 05/16/2012 by: rmlawren
Orange Belt

Please log in to comment
Answer this question or Comment on this question for clarity