Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

theme.sh/theme.ps1: resolve the theme folder from where you run it, not from tools/

Gathin233c26890b1947
diff --git a/tools/theme.ps1 b/tools/theme.ps1
index f5c926805..e04026a3e 100644
--- a/tools/theme.ps1
+++ b/tools/theme.ps1
@@ -12,6 +12,8 @@ $ErrorActionPreference = 'Stop'
$OutputEncoding = New-Object System.Text.UTF8Encoding $false
if (-not $TvHost) { throw 'pass -TvHost <tv ip> or set $env:TV_HOST' }
$env:TV_HOST = $TvHost
+# Resolve the theme folder against the caller's directory before moving into tools\.
+if ($Theme) { $Theme = (Resolve-Path $Theme).Path }
Set-Location $PSScriptRoot
$py = 'venv\Scripts\python.exe'
if (-not (Test-Path $py)) { throw 'run: python -m venv tools\venv; tools\venv\Scripts\python.exe -m pip install -r tools\requirements.txt' }
diff --git a/tools/theme.sh b/tools/theme.sh
index e753189e0..61f3c0f40 100755
--- a/tools/theme.sh
+++ b/tools/theme.sh
@@ -6,6 +6,9 @@
# Usage: TV_HOST=192.168.1.50 tools/theme.sh themes/aurora
# TV_HOST=192.168.1.50 tools/theme.sh --reset # remove the overlay, back to config.xml
set -euo pipefail
+# Resolve the theme folder against the caller's directory before moving into tools/.
+THEME_ARG="${1:-}"
+case "$THEME_ARG" in --reset|"") ;; /*) ;; *) THEME_ARG="$PWD/$THEME_ARG" ;; esac
cd "$(dirname "$0")"
: "${TV_HOST:?set TV_HOST to the TV IP address, e.g. TV_HOST=192.168.1.50 $0 themes/aurora}"
PY=venv/bin/python
@@ -20,7 +23,7 @@ if [ "${1:-}" = --reset ]; then
tv "rm -f $DIR/config.json $DIR/wallpaper.jpg; am force-stop $PKG; am start -n $PKG/.MainActivity >/dev/null; echo reset" | tail -n 1
exit 0
fi
-THEME="${1:?usage: theme.sh <theme folder> | --reset}"
+THEME="${THEME_ARG:?usage: theme.sh <theme folder> | --reset}"
[ -f "$THEME/config.json" ] || { echo "no config.json in $THEME" >&2; exit 1; }
python3 -c 'import json,sys; json.load(open(sys.argv[1]))' "$THEME/config.json" 2>/dev/null \
|| { echo "$THEME/config.json is not valid JSON" >&2; exit 1; }