I have some updates on this: I was able to get the right name from the start by inserting this into the rc.netboot file in the portion originally specified. Then on the web server I will show the core of the code for that end too:
# Get the System S/N using the quicker method than systemprofiler
machine_sn=`ioreg -l | grep IOPlatformSerialNumber | awk '{print $4}'`
machine_sn=${machine_sn:1:12}
# do NOT query the ComputerName based on what the NetBoot server told us it was
##machine_name=$(ipconfig netbootoption machine_name 2>&1)
# No machine name from netboot server, trying HTTP request to workflow
machine_name=`curl -F "machine_sn=$machine_sn" http://###.###.###.###/ComputerName/`
## Test to make sure name is not blank
if [ -z "$machine_name" ]
then
## This is a empty string
scutil --set LocalHostName "INVALID_NAME"
scutil --set ComputerName "$INVALID_NAME"
scutil --set HostName "$INVALID_NAME"
else
## Name from the CURL command
scutil --set LocalHostName "$machine_name"
scutil --set ComputerName "$machine_name"
scutil --set HostName "$machine_name"
fi
Then at that URL (Keep in mind the CURL command is using IP address on purpose as DNS services are not running at this point of the boot process). On that server is a simple PHP set of pages with code similar to below. This code currently just get's the machine name for our 6.9 database, but I will be adding to it next week to pull from the 7.5 DB and another proprietary DB.
so the PHP at the url ComputerName in index.php looks like this (this is thanks to a colleage of mine who worked up this part of code.) Keep in mind you will need the db.php page in the same folder with the connection string.
<?php
require_once 'db.php';
dbOpen();
if ( isset( $_POST['machine_sn'] ) && ! empty( $_POST['machine_sn'] ) ) {
$tsql = "select computer.computer_name, computer.serial_num from computer where computer.serial_num = ?";
$params = array( $_POST['machine_sn'] );
$result = dbQ( $tsql, $params );
if ( $result !== false ) {
$numrows = sqlsrv_num_rows( $result );
if ( $numrows !== false ) {
if ( $row = sqlsrv_fetch_object( $result ) ) {
echo $row->computer_name;
}
} else {
echo "No computer found with that SN";
}
sqlsrv_free_stmt( $result );
} else {
echo "error";
}
} else {
echo "error";
}
dbClose();
?>
I'll let you know more when I work the PHP to query mutiple databases. So far I've only tried in on one netboot image that I manually modified. Currently loading another one going the symantec way all the way through rather than a manual modification of the DMG.