tools/dmg_pkg_install.sh
author Wuzzy <Wuzzy2@mail.ru>
Sat, 27 Oct 2018 15:55:19 +0200
changeset 14014 f09276eb0c27
parent 11587 cf83d9cb5590
permissions -rw-r--r--
Add 7 new taunts New sounds: * Bugger, Drat: Hog damages self only * Thisoneismine: Crate drop * Whatthe: Something is going to blow up close to hog * Solong, Ohdear: Death * Gonnagetyou: Vow for revenge Fallback code is added for existing voicepacks Thisoneismine is not used in Robot because the text in this sound file is "Threat detected.", which does not make sense.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11587
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     1
#!/bin/bash
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     2
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     3
# Downloads and install a .dmg from a URL
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     4
#
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     5
# Usage
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     6
# $ dmg_pkg_install [url]
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     7
#
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     8
# Adopted from https://gist.github.com/afgomez/4172338
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     9
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    10
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    11
if [[ $# -lt 1 ]]; then
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    12
  echo "Usage: dmg_pkg_install [url]"
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    13
  exit 1
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    14
fi
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    15
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    16
url=$*
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    17
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    18
# Generate a random file name
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    19
tmp_file=/tmp/`openssl rand -base64 10 | tr -dc '[:alnum:]'`.dmg
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    20
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    21
# Download file
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    22
echo "Downloading $url..."
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    23
curl -# -L -o $tmp_file $url
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    24
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    25
echo "Mounting image..."
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    26
volume=`hdiutil mount $tmp_file | tail -n1 | perl -nle '/(\/Volumes\/[^ ]+)/; print $1'`
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    27
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    28
# Locate .pkg
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    29
app_pkg=`find $volume/. -name *.pkg -maxdepth 1 -print0`
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    30
echo "Install pkg..."
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    31
installer -pkg $app_pkg -target /
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    32
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    33
# Unmount volume, delete temporal file
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    34
echo "Cleaning up..."
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    35
hdiutil unmount $volume -quiet
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    36
rm $tmp_file
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    37
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    38
echo "Done!"
cf83d9cb5590 - Enable CI builds with travis for hw iOS
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    39
exit 0