mas/script/install

34 lines
711 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
2023-11-25 16:04:18 -07:00
MAS_VERSION=$(script/version)
2023-11-25 16:59:53 -07:00
PREFIX=$(brew --prefix)
2018-10-17 16:18:30 -06:00
2021-05-07 11:33:39 -07:00
while test -n "$1"; do
if [[ "$1" == '--universal' ]]; then
ARCH=universal
2023-11-28 20:25:43 -07:00
RELEASE=.build/apple/Products/Release
2021-05-07 11:33:39 -07:00
else
# Override default prefix path with optional arg
PREFIX="$1"
fi
shift
done
2023-11-25 16:04:18 -07:00
echo "==> 📲 Installing mas ($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" \
2023-11-28 20:25:43 -07:00
"$PREFIX/bin/mas"