Help with an install script

Hello all.

I have a script I have written which runs a silent install of Mcafee AV and ePO for Mac OS X.

The issue I am wondering about is what happens when the script launches the installers.

The script is fairly simple, and just invokes the shell installer for each app:

#! /bin/sh

# script to install Mcafee VirusScan and ePolicy Orchestrator 3.6

# cd to temp install directory

cd /tmp/Mcafee_Install/

# Launch AV installer

installer -pkg VirusScan.pkg -target /

# Sleep while AV installer completes install

sleep 60

# Next installs ePolicy Orchestrator

./cmdinstall 10.44.112.40:82

# Sleep while ePO installer completes.

sleep 120

# Reboot to complete install.

reboot

You'll notice that I have told the script to sleep after launching the installer for each app. My question is: "Is this necessary?"

My thinking was that once the script has launched the installer, that's a separate process and as far as I am aware, my script would simply continue with the second install immediately. I don't want both apps installing at the same time, or the system rebooting halfway through the second install, so I told the script to sleep for a moment, to give the installs a chance to complete.

Am I being silly here? Are the sleep commands necessary? Will the script wait for the install to complete before launching the next install, or rebooting in the case of the second install?

Any thoughts?

Cheers

If you were to run the install scripts manually, do they immediatly exit but keep working in the background?

If so, then you'll need to find a way to wait for them to finish (a sleep is dangerous as you don't know how quickly they will run). I'd suggest looking for the process that the install script triggers in the process table and looping round waiting for it to vanish.

If it doesn't run in the background, then yes, the sleeps are totally unnecessary.