スクリプトの問題

スクリプトの問題

私はすぐに使用する新しいMacに一連のアプリケーションをインストールするために、OS X 10.10用の単純なシェルスクリプトを作成しようとしています。各アプリケーションをインストールするために一度に1つのインストーラを実行したいと思います。私はbashスクリプトを使用していますが、GUIインストーラを呼び出して「次へ」、「次へ」、「次へ...」をクリックしてこのようにインストールするいくつかのインストールを除いてうまくいきます。なぜなら、この特定のアプリケーションが正しくインストールされていないからです。ターミナルを通して。 (これはいい)

私の問題は、スクリプトがアプリケーション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には、次の関連オプションがopenあります。-W--wait-apps

% open -h
...
      -W, --wait-apps   Blocks until the used applications are
                        closed (even if they were already running).

しかし、どのOSバージョンにこの機能を追加したかはわかりません。

おすすめ記事