Mac OS X Server 1.x: Adding NetBoot Images To NetInfo

How do I add the NetBoot images to NetInfo?
Note: This article pertains to Mac OS X Server versions 1.x, which were released prior to May 2001.

The following script can be used to add the private_image_volume and shared_image_volume to NetInfo. This is useful if the NetInfo database (/etc/netinfo/local.db) is replaced with the template.


#!/bin/sh
# This script looks for Netboot HD.img and Applications HD.img in
# the following paths /<HFS+ Volume>/<HFS+ Volume>_NBS/SharedImages/
# If it finds them it adds the shared_image_volume and
# private_image_volume properties to netinfo
#
# Written by Scott George with help from Dieter Siegmund

##
# Constants
##
PrivateImage="NetBoot HD.img"
SharedImage="Applications HD.img"
PartialPath="_NBS/SharedImages/"

##
# get the list of mounted HFS volumes
##
mount -t hfs | while read line
do
   RealDrive=`echo $line | sed 's/.*on \\/\\(.*\\) (local)/\\1/'`
   ImagePath="/${RealDrive}/${RealDrive}${PartialPath}"
   if [ -e "${ImagePath}${PrivateImage}" ] && \\
      [ -e "${ImagePath}${SharedImage}" ]; then
niutil -createprop . /config/NetBootServer \\
           private_image_volume "${RealDrive}"
niutil -createprop . /config/NetBootServer \\
           shared_image_volume "${RealDrive}"
exit 0
   fi
done

echo "No images found"
exit 1

Published Date: Feb 18, 2012