Mac OS X: 实用脚本程序(bash scripts)系列-5

设置Mac OS X 10.5 Leopard打开NetBoot服务

注:

无论是Mac OS X: 实用脚本程序(bash scripts)系列-4 ,还是这里的脚本,都是在默认的当前系统的根/下面设置NetBoot的,也就是在/Library/NetBoot目录里面,通过修改可以变更这个目录到其它的分区/盘的其它目录中。

 

简单介绍NetBoot服务,NetBoot/NetInstall服务用于网络启动Mac电脑/安装Mac系统的服务,它的启动功能如同无盘工作站,而安装可以即时网络更新客户端的Mac操作系统。

 

#!/bin/bash
#This script sets up netbooting on a Leopard (Client) machine.


# START WITH SOME SANITY CHECKS
# -----------------------------

# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
        echo "You must run this script as the root user.  (Try /"sudo $0/")"
        exit 1
fi;

# check that this is Mac OS X Leopard (Client)
if [[ "`sw_vers -productName`" != "Mac OS X" ]] || [[ "`sw_vers -productVersion`" < "10.5" ]]; then
        echo "The script is designed to be run on Mac OS X Leopard, on a non-server version."
        exit 2
fi;

echo "Make sure Internet Sharing is turned OFF Before continuing! (System Preferences > Sharing)
Press Enter to continue."
read junk

# CREATE DIRECTORIES AND SIMLINKS NEEDED FOR NETBOOTING
# -----------------------------------------------------

mkdir -p /Library/NetBoot/NetBootSP0
mkdir /Library/NetBoot/NetBootClients0
chown root:admin /Library/NetBoot/NetBoot*
chmod 775 /Library/NetBoot/NetBoot*

cd /Library/NetBoot
ln -s NetBootSP0 /Library/NetBoot/.sharepoint
ln -s NetBootClients0 /Library/NetBoot/.clients

# EXPORT NETBOOTING FOLDERS OVER NFS (NETWORK FILE SYSTEM)
# --------------------------------------------------------

echo "/Library/NetBoot/NetBootSP0 -ro" >> /etc/exports
# Note that as soon as the file changes, the OS restarts the NFS daemon

# CREATE DIRECTORIES AND SIMLINKS NEEDED FOR NETBOOTING
# --------------------------------Boot
ln -s /Library/NetBoot /private/tftpboot/NetBoot
service tftp start

# SET UP BSDP (BOOT SERVICE DISCOVERY PROTOCOL)
# ---------------------------------------------

# Create the /etc/bootpd.plist file.

# This file below is based on information from the bootpd man page.

echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>bootp_enabled</key>
        <string>en0</string>
        <key>netboot_enabled</key>
        <string>en0</string>
        <key>old_netboot_enabled</key>
        <string>en0</string>
</dict>
</plist>' > /etc/bootpd.plist

service bootps start


# WE ARE FINISHED
# ---------------

echo "NetBoot setup script complete. Please make sure to add the NetBootSP0 and NetBootClients0 folders to your Shared Folders (System Preferences > Sharing > File Sharing)."

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值