现在的位置: 首页 > 综合 > 正文

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

2013年12月01日 ⁄ 综合 ⁄ 共 1974字 ⁄ 字号 评论关闭

设置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."

 

 

 

抱歉!评论已关闭.