mirror of
https://github.com/Gathin23/cleanyourtv.git
synced 2026-11-04 20:56:39 +00:00
disable.ps1, restore.ps1 and build-and-install.ps1 mirror the bash scripts. The build script finds Android Studio's bundled JDK and the default SDK, and only disables the stock launcher after the install and set-home-activity both report success. tv.py --batch now decodes stdin as utf-8-sig: Windows PowerShell 5.1 prepends a BOM to piped text, which broke the first command of every batch. Tested on Windows 11 with a OnePlus TV (Android 14). Co-Authored-By: Claude Opus 5.5 <[email protected]>
23 lines
1.2 KiB
PowerShell
23 lines
1.2 KiB
PowerShell
# Windows version of disable.sh: disable every package listed in a debloat file on the TV
|
|
# (one package per line, # comments allowed). Packages are disabled for user 0, never uninstalled.
|
|
# Undo with tools\restore.ps1 <same file>.
|
|
#
|
|
# Usage: tools\disable.ps1 -TvHost 192.168.1.50 examples\xiaomi-mi-tv-4a\debloat.txt
|
|
param(
|
|
[Parameter(Mandatory = $true, Position = 0)][string]$List,
|
|
[string]$TvHost = $env:TV_HOST
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
# Pipe plain UTF-8 to native commands; the default here prepends a BOM that corrupts the first command.
|
|
$OutputEncoding = New-Object System.Text.UTF8Encoding $false
|
|
$repo = Split-Path -Parent $PSScriptRoot
|
|
$List = (Resolve-Path $List).Path
|
|
$py = Join-Path $repo 'tools\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' }
|
|
if (-not $TvHost) { throw 'pass -TvHost <tv ip> or set $env:TV_HOST' }
|
|
$env:TV_HOST = $TvHost
|
|
|
|
$pkgs = Get-Content $List | ForEach-Object { ($_ -replace '#.*$', '').Trim() } | Where-Object { $_ }
|
|
$cmds = @($pkgs | ForEach-Object { "pm disable-user --user 0 $_" }) + 'pm list packages -d'
|
|
$cmds | & $py -I (Join-Path $repo 'tools\tv.py') --batch
|