Fix engine crash in ACF mission 5 when skipping animation after killing wave 2 while the cyborg is talking
Also harden the code against double function calls
#!/bin/bash# Downloads and install a .dmg from a URL## Usage# $ dmg_pkg_install [url]## Adopted from https://gist.github.com/afgomez/4172338if [[ $# -lt 1 ]]; then echo "Usage: dmg_pkg_install [url]" exit 1fiurl=$*# Generate a random file nametmp_file=/tmp/`openssl rand -base64 10 | tr -dc '[:alnum:]'`.dmg# Download fileecho "Downloading $url..."curl -# -L -o $tmp_file $urlecho "Mounting image..."volume=`hdiutil mount $tmp_file | tail -n1 | perl -nle '/(\/Volumes\/[^ ]+)/; print $1'`# Locate .pkgapp_pkg=`find $volume/. -name *.pkg -maxdepth 1 -print0`echo "Install pkg..."installer -pkg $app_pkg -target /# Unmount volume, delete temporal fileecho "Cleaning up..."hdiutil unmount $volume -quietrm $tmp_fileecho "Done!"exit 0