/build/static/layout/Breadcrumb_cap_w.png

New administrator (K2000): Mac imaging (pre/post installation tasks help request)

I've gone through the information available here:
http://www.itninja.com/blog/view/capture-deploy-a-mac-image-from-start-to-finish-in-k2000-version-3-4

Great start, got the image built.  Now having difficulties with understanding the pre/post installation tasks.  I come from a PC administrative setting with a user perspective for Macs, so still trying to understand the Mac side scripting.  I've had some success with a manually run script after installing the OS image, but would like to automate the process in order to streamline it for the techs with less familiarity with Macs.  The default script references a file that associates computer names with their mac addresses, but I am uncertain as to the location of this file referenced:

#!/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=${KACE_SYSTEM_DRIVE_PATH}/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


3 Comments   [ + ] Show comments
  • Apparently I've misunderstood the script description and information. The script supposedly above caches the -existing- computer name and restores it after the imaging process is completed. It does not pull computer names from a previously existing file on the KACE appliance. - wtaira 9 years ago
  • I have switched gears and am trying to work with my own post-installation script. The problem is that the post-installation scripts do not appear to trigger, so the computer renaming (or any other tasks) does not occur. I am using the following script as a Mac OSX Post-installation Task Detail:

    #!/bin/bash

    # Set variables
    echo Enter new computer name:
    read NEWCOMPUTERNAME
    echo Enter new domain name:
    read NEWDOMAINNAME
    NEWHOSTNAME=$NEWCOMPUTERNAME.$NEWDOMAINNAME

    # Change hostname
    echo Configuring hostname...
    hostname $NEWHOSTNAME
    scutil --set HostName $NEWHOSTNAME
    echo Done configuring hostname
    echo Configuring local hostname
    scutil --set LocalHostName $NEWHOSTNAME
    echo Done configuring local hostname
    # Change computername (Bonjour and AppleTalk name)
    echo Configuring computername...
    #systemsetup -setcomputername $NEWCOMPUTERNAME
    scutil --set ComputerName $NEWHOSTNAME
    echo Done configuring computername - wtaira 9 years ago
  • After a bit more testing, it appears that you cannot (properly) run scripts that require user input while the script is running.
    Is there a way to run a script that opens the console window and waits for user input? I would prefer to avoid leaving an AD admin account and password in a text file just to add the imaged computers to the domain. - wtaira 9 years ago

Answers (0)

Be the first to answer this question

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ