mas/script/install

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