mas/script/install

39 lines
766 B
Text
Raw Normal View History

2019-01-03 15:30:33 -08:00
#!/bin/bash -e
#
# script/install
# mas
#
2021-04-28 14:49:54 -07:00
# Installs mas into PREFIX.
#
# NOTE: This script is called by the mas Homebrew formula so it has only system
2021-04-28 14:49:54 -07:00
# dependencies aside from Swift.
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/mas.rb
#
2021-05-07 11:33:39 -07:00
ARCH=$(uname -m)
RELEASE=.build/${ARCH}-apple-macosx/release
VERSION=$(script/version)
2021-05-07 11:33:39 -07:00
if [[ $(uname -m) == 'arm64' ]]; then
2021-03-21 16:50:09 -07:00
PREFIX=/opt/homebrew
else
2021-03-21 16:50:09 -07:00
PREFIX=/usr/local
2018-10-17 16:18:30 -06:00
fi
2021-05-07 11:33:39 -07: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 14:49:54 -07:00
echo "==> 📲 Installing mas ($VERSION) for $ARCH to $PREFIX"
2018-10-17 16:48:35 -06:00
ditto -v \
2021-05-07 11:33:39 -07:00
"$RELEASE/mas" \
2021-04-28 14:49:54 -07:00
"$PREFIX/bin/"