【发布时间】:2011-01-11 18:22:45
【问题描述】:
在雪豹服务器上使用 SWU 服务器,我正在尝试创建一个脚本来更改 CatalogURL,然后在 SWU 退出后将其重置。它将运行脚本并启动 SWU,但不会运行“退出”提示后指示的 shell 脚本。没有错误,只是在SWU启动后停止运行。
tell application "System Events"
set OSVersion to do shell script "sw_vers -productVersion"
end tell
if OSVersion starts with "10.4" then
-- set up Tiger thing
set catalogURLValue to "http://server.local:8888/index.sucatalog"
else if OSVersion starts with "10.5" then
-- set up Leopard thing
set catalogURLValue to "http://server.local:8888/index-leopard.merged-1.sucatalog"
else if OSVersion starts with "10.6" then
-- set up Snow Leopard thing
set catalogURLValue to "http://server.local:8888/index-leopard-snowleopard.merged-1.sucatalog"
else
return
end if
do shell script "defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL " & catalogURLValue
tell application "Software Update"
activate
end tell
on quit
try
do shell script ¬
"defaults delete /Library/Preferences/com.apple.SoftwareUpdate CatalogURL"
continue quit
on error
do shell script ¬
"rm /Library/Preferences/com.apple.SoftwareUpdate.plist"
end try
end quit
【问题讨论】:
标签: macos shell osx-snow-leopard applescript