mas/script/install

39 lines
766 B
Text
Raw Normal View History

2019-01-03 23:30:33 +00:00
#!/bin/bash -e
#
# script/install
# mas
#
2021-04-28 21:49:54 +00:00
# Installs mas into PREFIX.
#
# 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.
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/mas.rb
#
2021-05-07 18:33:39 +00:00
ARCH=$(uname -m)
RELEASE=.build/${ARCH}-apple-macosx/release
VERSION=$(script/version)
2021-05-07 18:33:39 +00:00
if [[ $(uname -m) == 'arm64' ]]; then
2021-03-21 23:50:09 +00:00
PREFIX=/opt/homebrew
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/"