Files
YaMusek/tools/install.sh
T
Thorgathis acd50280bc Yandex Music client for Apple TV
tvOS 17+ SwiftUI client for the unofficial Yandex Music API: rotor stations
with feedback, library, search, artist and album pages, synced lyrics, and
system Now Playing integration.
2026-09-17 20:38:19 +03:00

67 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build YaMusek and install it on a paired Apple TV.
#
# ./tools/install.sh <TEAM_ID> [BUNDLE_ID] [DEVICE_NAME_OR_UDID]
#
# TEAM_ID comes from Xcode > Settings > Accounts > Manage Certificates,
# or from `security find-identity -v -p codesigning` (the 10-char id in
# parentheses of "Apple Development: you (XXXXXXXXXX)").
#
# The Apple TV must already be paired: Xcode > Window > Devices and Simulators,
# with the TV on Settings > Remotes and Devices > Remote App and Devices.
set -euo pipefail
cd "$(dirname "$0")/.."
TEAM="${1:-}"
BUNDLE="${2:-com.yamusek.tv}"
DEVICE="${3:-}"
if [[ -z "$TEAM" ]]; then
echo "usage: $0 <TEAM_ID> [BUNDLE_ID] [DEVICE_NAME_OR_UDID]" >&2
exit 2
fi
if ! command -v xcodegen >/dev/null; then
echo "xcodegen is required: brew install xcodegen" >&2
exit 1
fi
echo "==> regenerating project"
xcodegen generate
DERIVED="build"
echo "==> building for tvOS device (team $TEAM, bundle $BUNDLE)"
xcodebuild \
-project YaMusek.xcodeproj \
-scheme YaMusek \
-configuration Release \
-destination 'generic/platform=tvOS' \
-derivedDataPath "$DERIVED" \
DEVELOPMENT_TEAM="$TEAM" \
PRODUCT_BUNDLE_IDENTIFIER="$BUNDLE" \
CODE_SIGN_STYLE=Automatic \
-allowProvisioningUpdates \
build
APP="$DERIVED/Build/Products/Release-appletvos/YaMusek.app"
if [[ ! -d "$APP" ]]; then
echo "build produced no app at $APP" >&2
exit 1
fi
if [[ -z "$DEVICE" ]]; then
echo "==> paired devices"
xcrun devicectl list devices
echo
read -r -p "Device name or UDID: " DEVICE
fi
echo "==> installing to $DEVICE"
xcrun devicectl device install app --device "$DEVICE" "$APP"
echo
echo "Installed. Launch YaMusek from the Apple TV home screen."
echo "With a free Apple ID the signature expires after 7 days - rerun this script to refresh it."