
저는 새로운 Mac용 응용 프로그램 목록을 설치하기 위해 OS X 10.10용 간단한 쉘 스크립트를 작성하려고 합니다. 각 응용 프로그램을 설치하기 위해 한 번에 하나씩 각 설치 프로그램을 실행하고 싶습니다. 나는 잘 작동하는 bash 스크립트를 사용하고 있습니다. 일부 설치를 제외하고는 GUI 설치 프로그램을 호출하고 다음, 다음 다음을 클릭하여 설치하고 있습니다. 특정 앱이 터미널을 통해 제대로 설치되지 않았기 때문입니다. (괜찮아요)
내 문제는 스크립트가 App A의 GUI 설치 프로그램을 열 때 다음 줄의 명령을 여는 스크립트를 계속 실행한다는 것입니다. 내가 원하는 것은 설치 프로그램 창이 열려 있는 동안 스크립트가 다음 명령을 실행하기를 기다리는 것입니다. Windows DOS는 배치 파일을 만들 수 있고 첫 번째 설치가 완료될 때까지 다음 줄을 실행하지 않는 방식으로 작동합니다. 그래서 비슷한 행동을 찾고 있습니다.
나는 독서를 통해 몇 가지를 시도했지만 그 중 아무것도 효과가 없었습니다. 보시다시피, "wait" 명령을 넣은 곳은 GUI 설치 프로그램이 완료될 때까지 기다리고 싶은 곳입니다.
#!/bin/bash
# Install Script for OS X BYOD Laptops
# Installing Office 2016
open /Volumes/USB30FD/packages/Microsoft_Office_2016_Volume_Installer.pkg
wait
# sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_Office_2016_Volume_Installer.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_AutoUpdate_3.2.0_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_Excel_15.15.0_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_OneNote_15.15.1_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_Outlook_15.15.0_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_PowerPoint_15.15.0_Updater.pkg -target /
sudo installer -verboseR -pkg /Volumes/USB30FD/packages/Microsoft_Word_15.15.0_Updater.pkg -target /
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Word.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Excel.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft PowerPoint.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Outlook.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
killall -HUP Dock
# Install ShareFile\
sudo cp -r /Volumes/USB30FD/apps/ShareFile.app /Applications/
wait
open -a /Applications/ShareFile.app
wait
# Install Absolute Computrace
# sudo installer -verboseR -pkg /Volumes/USB30FD/packages/RPClient.pkg -target /
open /Volumes/USB30FD/packages/RPClient.pkg
wait
open /Volumes/USB30FD/Ctclient103319-304806/ctmweb.app
# Install Symantec Endpoint Protection
# Run the GUI installer instead: open /Volumes/USB30FD/apps/Additional\ Resources/SEP.mpkg
sudo installer -verboseR -pkg /Volumes/USB30FD/apps/Additional\ Resources/SEP.mpkg -target /
wait
/Library/Application\ Support/Symantec/LiveUpdate/LUTool
# Install Trend Disk Encryption
open /Volumes/USB30FD/packages/Trend\ Micro\ Full\ Disk\ Encryption.pkg
나는 쉘 스크립트에 관해서는 매우 초보자이므로 간단할수록 좋습니다. 감사해요!
답변1
Mac OS X에는 관련이 있을 수 있는 or 옵션이 open
있습니다 .-W
--wait-apps
% open -h
...
-W, --wait-apps Blocks until the used applications are
closed (even if they were already running).
하지만 어떤 OS 버전에 추가했는지는 확실하지 않습니다.