2019-01-03 23:30:33 +00:00
|
|
|
#!/bin/bash -e
|
2018-12-21 04:16:11 +00:00
|
|
|
#
|
|
|
|
# script/install
|
2019-01-19 04:37:51 +00:00
|
|
|
# mas
|
|
|
|
#
|
2021-04-28 21:49:54 +00:00
|
|
|
# Installs mas into PREFIX.
|
2019-01-19 04:37:51 +00:00
|
|
|
#
|
|
|
|
# NOTE: This script is called by the mas Homebrew formula so it has only system
|
2021-04-28 21:49:54 +00:00
|
|
|
# dependencies aside from Swift.
|
2019-01-19 04:37:51 +00:00
|
|
|
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/mas.rb
|
2018-12-21 04:16:11 +00:00
|
|
|
#
|
2018-10-17 21:43:02 +00:00
|
|
|
|
2021-05-07 18:33:39 +00:00
|
|
|
ARCH=$(uname -m)
|
|
|
|
RELEASE=.build/${ARCH}-apple-macosx/release
|
2019-01-13 07:58:51 +00:00
|
|
|
VERSION=$(script/version)
|
2018-12-21 01:58:39 +00:00
|
|
|
|
2021-05-07 18:33:39 +00:00
|
|
|
if [[ $(uname -m) == 'arm64' ]]; then
|
2021-03-21 23:50:09 +00:00
|
|
|
PREFIX=/opt/homebrew
|
2021-01-28 21:10:48 +00:00
|
|
|
else
|
2021-03-21 23:50:09 +00:00
|
|
|
PREFIX=/usr/local
|
2018-10-17 22:18:30 +00:00
|
|
|
fi
|
|
|
|
|
2021-05-07 18:33:39 +00:00
|
|
|
while test -n "$1"; do
|
|
|
|
if [[ "$1" == '--universal' ]]; then
|
|
|
|
ARCH=universal
|
|
|
|
RELEASE=.build/apple/Products/Release
|
|
|
|
else
|
|
|
|
# Override default prefix path with optional arg
|
|
|
|
PREFIX="$1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2021-04-28 21:49:54 +00:00
|
|
|
echo "==> 📲 Installing mas ($VERSION) for $ARCH to $PREFIX"
|
2018-10-17 22:48:35 +00:00
|
|
|
ditto -v \
|
2021-05-07 18:33:39 +00:00
|
|
|
"$RELEASE/mas" \
|
2021-04-28 21:49:54 +00:00
|
|
|
"$PREFIX/bin/"
|