Mac OS X:跨网段Netboot

 

1最简单的命令:

/usr/sbin/bless --netboot --server bsdp://bootServerIP

 

2.复杂的

下面的可以定义更复杂的参数,适用于复杂的环境,把其中的前部参数都设置好。

 

#!/bin/sh    
## Set the following variables
server="server.school.edu"  # Enter IP or FQDN of netboot server   
sharepoint="NetBootSP0"    # Won't need to change in most cases 
setName="DeployStudioRuntime-intel.nbi"   # Enter netboot set name for Intel machines
ppcSetName="DeployStudioRuntime-ppc.nbi" # Enter PPC netboot set name - typically Tiger or Leopard
imageName="DeployStudioRuntime.sparseimage"      # Enter image name, if using DeployStudio, no need to change
protocol="nfs"  # Enter protocol, nfs or http
simple="false" -- If set to true, will boot from default netboot image
nextboot="--nextonly"
## You shouln't need to change anything below
if [ $simple == true ]; then
    if [ "`arch`" == "ppc" ]; then
        /usr/sbin/nvram boot-device="enet:${server}" boot-args="" boot-file=""
    else
        /usr/sbin/bless --netboot --server "bsdp://${server}" $nextboot
    fi
else
    if [ "`arch`" == "ppc" ]; then
        /usr/sbin/nvram boot-args="rp=${protocol}:${server}:/private/tftpboot/NetBoot/${sharepoint}:${ppcSetName}/${imageName}" boot-file="enet:${server},NetBoot//${sharepoint}//${ppcSetName}//ppc//mach.macosx" boot-device="enet:${server},NetBoot//${sharepoint}//${ppcSetName}//ppc//booter"
    else
        /usr/sbin/bless --netboot --booter "tftp://${server}/NetBoot/${sharepoint}/${setName}/i386/booter" --kernel "tftp://${server}/NetBoot/${sharepoint}/${setName}/i386/mach.macosx" --options "rp=${protocol}:${server}:/private/tftpboot/NetBoot/${sharepoint}:${setName}/${imageName}" $nextboot
    fi
fi

 

3. AppleScript的方法

 

(*
Set NetBoot Across Subnets.scpt
© 2011 Patrick Gallagher
http://blog.macadmincorner.com
This script may be freely modified. 
Use at your own risk, no warranty. 	
Based on NBAS from Mike Bombich
	
*)
-- Set the following options
set server to "server.school.edu" --Enter IP or FQDN of netboot server
set sharepoint to "NetBootSP0" --In most cases this will not need to change
set setName to "DeployStudioRuntime-Intel.nbi" --Enter your Intel compatible netboot set name
set ppcSetName to "DeployStudioRuntime-PPC.nbi" --Enter your PPC netboot set name, if you have one
set imageName to "DeployStudioRuntime.sparseimage" --Enter image name, if using DeployStudio, no need to change
set protocol to "nfs" --Enter nfs or http
set nextboot to "--nextonly"
set arch to do shell script "arch"
--No modification should be needed below
if arch is equal to "i386" then
	do shell script "usr/sbin/bless --netboot --booter tftp://" & server & "/NetBoot/" & sharepoint & "/" & setName & "/i386/booter --kernel tftp://" & server & "/NetBoot/" & sharepoint & "/" & setName & "/i386/mach.macosx --options rp=nfs:" & server & ":/private/tftpboot/NetBoot/" & sharepoint & ":" & setName & "/" & imageName & space & "--nextonly" with administrator privileges
	
else
	do shell script "/usr/sbin/nvram boot-args=rp=" & protocol & ":" & server & ":/private/tftpboot/NetBoot/" & sharepoint & ":" & ppcSetName & "/" & imageName & space & "boot-file=enet:" & server & ",NetBoot////" & sharepoint & "////" & ppcSetName & "////ppc////mach.macosx/" boot-device=enet:" & server & ",NetBoot////" & sharepoint & "////" & ppcSetName & "////ppc////booter/"" with administrator privileges
end if
tell application "loginwindow"
	«event aevtrrst»
end tell


原文链接: http://blog.csdn.net/afatgoat/article/details/6538812

你可能感兴趣的:(Mac OS X:跨网段Netboot)