I'm creating an installer to install the KACE agent on a Mac. I've gotten the installer to work correctly, but the issue is that I want to prompt the technician to rename the computer before it installs the KACE agent. Here's what I've got:
!/bin/bash
Prompt for computer name
ComputerName=`/usr/bin/osascript <<EOT
tell application "System Events"
activate
set ComputerName to text returned of (display dialog "Please Input New Computer Name" default answer "" with icon 2)
end tell
EOT`
Set New Computer Name
echo $ComputerName
scutil --set HostName $ComputerName
scutil --set LocalHostName $ComputerName
scutil --set ComputerName $ComputerName
echo Rename Successful
Installs KACE Agent
mkdir -p "/Library/Application Support/Quest/KACE/data"
sleep 15
sh -c 'KACE_SERVER=cu-k1100.eservices.virginia.edu installer -pkg AMPAgent_8.0.152.pkg -target /'
Forces inventory
<<'KBOT'
tell application "Terminal.app"
activate
delay 0.5
do shell script sudo("/Library/Application Support/Quest/KACE/bin/runkbot 1 0")
delay 1
do shell script sudo("/Library/Application Support/Quest/KACE/bin/runkbot 2 0")
end tell
KBOT
The issue is that the installer does not wait until the technician changes the computer name. I've tried separating the two steps into pre and post flight scripts, but it still doesn't wait.
So basically what I need to happen is Prompt For Computer Name > Update JAMF w/ Recon > Confirm Name Has Been Changed > Install KACE Agent.