#!/usr/bin/env bash # Re-sign and reinstall YaMusek so a free 7-day provisioning profile never # expires in your face. Meant to be run by launchd once a day; see # tools/install-autorefresh.sh. # # Config comes from tools/.autorefresh.env (written by install-autorefresh.sh): # TEAM=XXXXXXXXXX # BUNDLE=com.yamusek.tv # DEVICE= set -uo pipefail cd "$(dirname "$0")/.." LOG="${TMPDIR:-/tmp}/yamusek-autorefresh.log" exec >>"$LOG" 2>&1 echo "=== $(date '+%Y-%m-%d %H:%M:%S') refresh start" ENV_FILE="tools/.autorefresh.env" if [[ ! -f "$ENV_FILE" ]]; then echo "no $ENV_FILE - run tools/install-autorefresh.sh first" exit 1 fi # shellcheck disable=SC1090 source "$ENV_FILE" export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" # Nothing to do if the Apple TV is off or off-network; launchd will try again. if ! xcrun devicectl list devices 2>/dev/null | grep -q -- "$DEVICE"; then echo "device '$DEVICE' not reachable, skipping" exit 0 fi ./tools/install.sh "$TEAM" "$BUNDLE" "$DEVICE" status=$? echo "=== refresh finished with status $status" exit $status