### 设置Mac OS X 10.5 Leopard打开NetBoot服务
注:
无论是[Mac OS X: 实用脚本程序(bash scripts)系列-4](http://blog.csdn.net/afatgoat/archive/2009/07/04/4321379.aspx),还是这里的脚本,都是在默认的当前系统的根/下面设置NetBoot的,也就是在/Library/NetBoot目录里面,通过修改可以变更这个目录到其它的分区/盘的其它目录中。
简单介绍NetBoot服务,NetBoot/NetInstall服务用于网络启动Mac电脑/安装Mac系统的服务,它的启动功能如同无盘工作站,而安装可以即时网络更新客户端的Mac操作系统。
<table id="ep:e" style="width: 100%;" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000"><tbody><tr><td width="100%"><span style="font-family: Courier New; color: #660000;">#!/bin/bash</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">#This script sets up netbooting on a Leopard (Client) machine.</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># START WITH SOME SANITY CHECKS</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># -----------------------------</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># Make sure only root can run our script</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">if [ "$(id -u)" != "0" ]; then</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> echo "You must run this script as the root user. (Try /"sudo $0/")"</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> exit 1</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">fi;</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># check that this is Mac OS X Leopard (Client)</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">if [[ "`sw_vers -productName`" != "Mac OS X" ]] || [[ "`sw_vers -productVersion`" < "10.5" ]]; then</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> echo "The script is designed to be run on Mac OS X Leopard, on a non-server version."</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> exit 2</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">fi;</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">echo "Make sure Internet Sharing is turned OFF Before continuing! (System Preferences > Sharing)</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">Press Enter to continue."</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">read junk</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># CREATE DIRECTORIES AND SIMLINKS NEEDED FOR NETBOOTING</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># -----------------------------------------------------</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">mkdir -p /Library/NetBoot/NetBootSP0</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">mkdir /Library/NetBoot/NetBootClients0</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">chown root:admin /Library/NetBoot/NetBoot*</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">chmod 775 /Library/NetBoot/NetBoot*</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">cd /Library/NetBoot</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">ln -s NetBootSP0 /Library/NetBoot/.sharepoint</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">ln -s NetBootClients0 /Library/NetBoot/.clients</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># EXPORT NETBOOTING FOLDERS OVER NFS (NETWORK FILE SYSTEM)</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># --------------------------------------------------------</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">echo "/Library/NetBoot/NetBootSP0 -ro" >> /etc/exports</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># Note that as soon as the file changes, the OS restarts the NFS daemon</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># CREATE DIRECTORIES AND SIMLINKS NEEDED FOR NETBOOTING</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># --------------------------------Boot</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">ln -s /Library/NetBoot /private/tftpboot/NetBoot</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">service tftp start</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># SET UP BSDP (BOOT SERVICE DISCOVERY PROTOCOL)</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># ---------------------------------------------</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># Create the /etc/bootpd.plist file.</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># This file below is based on information from the bootpd man page.</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">echo '<?xml version="1.0" encoding="UTF-8"?></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"><plist version="1.0"></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"><dict></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> <key>bootp_enabled</key></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> <string>en0</string></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> <key>netboot_enabled</key></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> <string>en0</string></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> <key>old_netboot_enabled</key></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"> <string>en0</string></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"></dict></span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"></plist>' > /etc/bootpd.plist</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">service bootps start</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># WE ARE FINISHED</span><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;"># ---------------</span><br style="font-family: Courier New; color: #660000;"/><br style="font-family: Courier New; color: #660000;"/><span style="font-family: Courier New; color: #660000;">echo"NetBoot setup script complete. Please make sure to add the NetBootSP0and NetBootClients0 folders to your Shared Folders (System Preferences> Sharing > File Sharing)."</span><br style="font-family: Courier New; color: #660000;"/><br/></td></tr></tbody></table>
- 前言
- Mac OS X:如何将个人文件夹从默认卷移到其他卷(适合OSX10.5 Leopard)
- Mac OS X:Finder菜单中的Connect to Server选项禁止和打开
- Mac OS X: 苹果机支持的分区表类型及问题解决
- Mac OS X: 偏好Preferences基础(1)
- Mac OS X: 如何变更Office for Mac的注册码
- Mac OS X: 禁止/防止网络用户复制app程序到桌面
- Mac OS X: 用户帐户的选择
- Mac OS X: 实用脚本程序(bash scripts)系列
- Mac OS X: 共享iPhoto图片
- Mac OS X: 实用脚本程序(bash scripts)系列-2
- Mac OS X: 实用脚本程序(bash scripts)系列-3
- Mac OS X: 实用脚本程序(bash scripts)系列-4
- Mac OS X: 实用脚本程序(bash scripts)系列-5
- Mac OS X: 实用脚本程序(bash scripts)系列-6
- Mac OS X:升级rsync和同步应用实例
- Mac OS X: XAMP在Mac上的实现
- Mac OS X瘦身多法
- Mac OS X 10.5快速系统部署实践-计划(2) v1
- Mac OS X 10.5快速系统部署实践-制作核心系统镜像(1) v1
- Mac OS X数据备份方案一例
- Mac OS X数据备份方案一例(2)
- Mac OS X 10.5快速系统部署实践-制作核心系统镜像(2) v1
- Mac OS X: 打印系统治疗
- Mac OS X:禁止崩溃报告
- Mac OS X:Snow Leopard的几个改动(管理员相关)
- Mac OS X排错:雪豹的最新更新Airport可能不支持无线802.11n网络
- Mac OS X:雪豹内置支持读写NTFS卷
- Mac OS X:定制生成新用户的程序包
- Mac OS X:在Windows里面使用命令行设置启动系统
- Mac OS X: 实用脚本程序(bash scripts)系列-7
- Mac OS X:一种从APP中获得PKG的方法
- Mac OS X: bash脚本实现添加无线SSID(Update2009-10-09)
- Mac OS X: 实用脚本程序(bash scripts)系列-8
- Mac OS X 10.5快速系统部署实践-制作核心系统镜像(4) v1
- Mac OS X: 彻底删除GeekTool(bash脚本)
- Mac OS X: 实用脚本程序(bash scripts)系列-9
- 把你的Leopard变成Mac OS X的系统发布服务器(1)
- 把你的Leopard变成Mac OS X的系统发布服务器(2)
- 把你的Leopard变成Mac OS X的系统发布服务器(3)
- Mac OS X: 访问控制远程CUPS服务
- Mac &amp; Win混合平台访问和工具
- Mac OS X: DeployStudio更新v1.0rc16
- Mac: 想当Apple菜鸟不容易(1)
- Mac: 想当 Apple菜鸟不容易(2)
- Mac: 想当 Apple菜鸟不容易(3)
- Mac: 想当 Apple菜鸟不容易(4完)
- Mac电脑上处理摄像机上的存储内容
- Mac OS X: Google自动更新程序的卸载
- 雪豹系统和SMB不兼容的问题的解决汇总
- Mac OS X: 实用脚本程序(bash scripts)系列-10
- Mac OS X:MagicPrefs介绍
- Mac OS X: 系统部署后程序安装的用户提示
- Mac OS X:开启单程序模式
- Mac OS X: 在脚本里关闭Airport
- Mac笔记本电池:十点建议和其它
- Mac OS X: Launchd执行程序的一个例子
- Mac OS X:修改SMART Utility期限限制
- Mac OS X:网络用户环境个性配置实例
- Mac OS X:强制退出CD/DVD盘
- Mac OS X: launchd plist在线编辑器
- Mac OS X: 实用脚本程序(bash scripts)系列-11
- Mac OS X: 实用脚本程序(bash scripts)系列-12
- Mac: 卸载Safari 5.0.2
- Mac OS X: 实用脚本程序(bash scripts)系列-13
- Mac OS X: 文件图标制作和变更(Resource Fork)
- Mac OS X 10.6.6更新之后NTFS只读的解决
- Mac: 网络用户遇到Adobe Reader 9.x/10.x异常退出的解决
- Mac OS X: airport命令的参数
- Mac OS X的Spotlight综述
- Mac OS X:AFP和SMB共享配置详细配置
- Mac OS X:详细解读Munki和应用
- Mac OS X:显示/设置分辨率的命令(源程序)
- Mac OS X: 是否升级到Lion?
- OSX: 禁止Flash Player 10.3自动更新
- OSX脚本:禁止系统自动添加AppStore图标到用户Dock上
- 狮子GM版本的安装
- OS X Lion狮子安装盘的初步研究
- OS X Lion狮子的恢复盘的删除二法
- OSX: Finder的侧边栏(Sidebar)不显示已装载的网络共享
- OSX:隐藏文件或文件夹
- OS X: 实用脚本程序(bash scripts)系列-13
- OS X: 实用脚本程序(bash scripts)系列-14
- OSX:Lion支持登录窗口的Policy Banner
- OSX: 让狮子说中文