Pregunta de secuencia de comandos

Pregunta de secuencia de comandos

Estoy intentando escribir un script de shell simple para OS X 10.10, para instalar una lista de aplicaciones para las nuevas Mac que estamos incorporando. Solo quiero ejecutar cada instalador uno a la vez para instalar cada aplicación. Estoy usando un script bash, que funciona bien, excepto para algunas instalaciones. Simplemente llamo al instalador de la GUI y lo instalo de esa manera haciendo clic en Siguiente, Siguiente Siguiente... porque esa aplicación en particular no se instaló correctamente a través del terminal. (lo cual está bien)

Mi problema es que cuando el script abre el instalador de la GUI para la Aplicación A, seguirá ejecutando el script abriendo los siguientes comandos en la línea. Lo que quiero es que el script espere para ejecutar el siguiente comando mientras la ventana del instalador esté abierta. Windows DOS funciona de esta manera, donde puede crear un archivo por lotes y no ejecutará la siguiente línea hasta que se complete la primera instalación. Entonces estoy buscando un comportamiento similar.

Intenté un par de cosas leyendo pero ninguna funcionó. Como puede ver, los lugares donde puse el comando "esperar" es donde quiero esperar a que finalice el instalador de la 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

Soy bastante novato en lo que respecta a scripts de shell, así que cuanto más simples, mejor. ¡Gracias!

Respuesta1

Mac OS X opentiene una opción -Wo --wait-appsque puede ser relevante:

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

Sin embargo, no estoy seguro de en qué versión del sistema operativo agregaron eso.

información relacionada