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

MacOSX Tiger NetBoot服务设置
该脚本为MacOSX 10.4 Tiger客户端设置NetBoot服务,包括创建必要的文件夹、符号链接、配置NFS共享、设置AFP共享点及启动相关服务。

设置Mac OS X 10.4 Tiger打开NetBoot服务的脚本

#!/bin/bash
#This script sets up netbooting on a Tiger (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 Tiger (Client)
if [[ "`sw_vers -productName`" != "Mac OS X" ]] || [[ "`sw_vers -productVersion`" < "10.4" ]] || [[ "`sw_vers -productVersion`" > "10.5" ]] ; then
echo "The script is designed to be run on Mac OS X Tiger, on a non-server version."
exit 2
fi;

echo "This will now setup NetBooting on your machine.
Press Enter to continue."
read junk

# CREATE FOLDERS AND SYMLINKS
# ---------------------------

mkdir -p /Library/NetBoot/NetBootSP0
mkdir /Library/NetBoot/NetBootClients0

chown root:admin /Library/NetBoot/NetBoot*
chmod 775 /Library/NetBoot/NetBoot*

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

# EXPORT NETBOOTING FOLDERS OVER NFS
# ----------------------------------

nicl . -create /exports
nicl . -create '/exports///Library//NetBoot//NetBootSP0' opts ro
service com.apple.portmap start
mountd
nfsd -t -u

# SETUP AFP SHAREPOINTS AND BSDP
# ------------------------------
nicl . -create /config/SharePoints/NetBootSP0
nicl . -create /config/SharePoints/NetBootSP0 afp_name NetBootSP0
nicl . -create /config/SharePoints/NetBootSP0 afp_shared 1
nicl . -create /config/SharePoints/NetBootSP0 afp_guest 0
nicl . -create /config/SharePoints/NetBootSP0 directory_path /Library/NetBoot/NetBootSP0

nicl . -create /config/SharePoints/NetBootClients0
nicl . -create /config/SharePoints/NetBootClients0 afp_name NetBootClients0
nicl . -create /config/SharePoints/NetBootClients0 afp_shared 1
nicl . -create /config/SharePoints/NetBootClients0 afp_guest 0
nicl . -create /config/SharePoints/NetBootClients0 directory_path /Library/NetBoot/NetBootClients0

nicl . -create /config/NetBootServer
nicl . -create /config/dhcp netboot_enabled en0
service bootps start

# SETUP TFTP SYMLINK
# ------------------
ln -s /Library/NetBoot /private/tftpboot/NetBoot
service tftp start

echo "NetBoot setup script complete."

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值