WSL fallback: fix blank shortcut icons + complete uninstall of WSL-fallback artifacts
- install.ps1: refresh the shell icon cache (ie4uinit -show) right after creating the Desktop/Start Menu shortcuts, so the (valid) .ico renders immediately instead of showing a blank icon (Explorer caches per-.lnk icons; programmatically-created links need a poke). - scripts/uninstall.ps1 + scripts/uninstall.sh: also remove the WSL-fallback artifacts the native uninstall missed -- the %LOCALAPPDATA%\Unsloth shim/launcher/icon dir, its user-PATH entry, and the real Studio install inside each WSL distro (rm ~/.unsloth + any CUDA llama build). Previously the native uninstaller only cleaned the (empty) native venv + .lnk files. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
bb9b7341de
commit
b8f8fbffbf
3 changed files with 49 additions and 1 deletions
|
|
@ -1587,6 +1587,9 @@ shell.Run cmd, 0, False
|
|||
$sc.Save()
|
||||
}
|
||||
step "shortcuts" "created Desktop + Start Menu shortcuts (launch WSL Studio + open browser)" "Green"
|
||||
# Refresh the shell icon cache so the brand-new .lnk icons render immediately instead of
|
||||
# showing blank (Explorer caches per-.lnk icons; programmatically-created links often need a poke).
|
||||
try { & "$env:SystemRoot\System32\ie4uinit.exe" -show 2>$null } catch {}
|
||||
} catch {
|
||||
substep "(could not create shortcuts: $($_.Exception.Message))" "Yellow"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,6 +336,44 @@ function Uninstall-UnslothStudio {
|
|||
Remove-Item -LiteralPath 'HKCU:\Software\Unsloth' -Recurse -Force -ErrorAction SilentlyContinue
|
||||
} catch { }
|
||||
|
||||
# ── Windows-on-Arm WSL-fallback artifacts ──
|
||||
# The ARM64+NVIDIA fallback installs Studio INSIDE WSL and drops a native shim + launcher under
|
||||
# %LOCALAPPDATA%\Unsloth (note: "Unsloth", not "Unsloth Studio") with a PATH entry, while the real
|
||||
# install lives in the WSL distro(s). The native cleanup above misses all of that -- handle it here.
|
||||
_Step "Removing WSL-fallback artifacts (shim, launcher, PATH entry, WSL install)..."
|
||||
$unslothDir = if ($env:LOCALAPPDATA) { Join-Path $env:LOCALAPPDATA "Unsloth" } else { $null }
|
||||
if ($unslothDir) {
|
||||
$shimDir = (Join-Path $unslothDir "bin").TrimEnd('\', '/')
|
||||
try {
|
||||
$rk = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey('Environment', $true)
|
||||
if ($rk) {
|
||||
try {
|
||||
$rp = $rk.GetValue('Path', '', [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames)
|
||||
if ($rp) {
|
||||
$kept = @(); $removed = $false
|
||||
foreach ($e in ($rp -split ';')) {
|
||||
if ([string]::IsNullOrWhiteSpace($e)) { continue }
|
||||
if (([Environment]::ExpandEnvironmentVariables($e).TrimEnd('\', '/')) -ieq $shimDir) { $removed = $true; _Substep "removed PATH entry: $e" "Green"; continue }
|
||||
$kept += $e
|
||||
}
|
||||
if ($removed) { $rk.SetValue('Path', ($kept -join ';'), [Microsoft.Win32.RegistryValueKind]::ExpandString) }
|
||||
}
|
||||
} finally { $rk.Close() }
|
||||
}
|
||||
} catch { }
|
||||
_RemovePath $unslothDir
|
||||
}
|
||||
# Remove the Studio install inside each WSL distro (the real GPU install + any CUDA llama.cpp build).
|
||||
if (Get-Command wsl.exe -ErrorAction SilentlyContinue) {
|
||||
try {
|
||||
$distros = @(((& wsl.exe --list --quiet 2>$null) -join "`n").Replace([char]0, '') -split "`r?`n" | ForEach-Object { $_.Trim() } | Where-Object { $_ })
|
||||
foreach ($d in $distros) {
|
||||
& wsl.exe -d $d -u root -- bash -lc 'pkill -9 -f "unsloth studio" 2>/dev/null; pkill -9 -f "llama-server" 2>/dev/null; rm -rf /root/.unsloth /home/*/.unsloth /root/llama-cuda 2>/dev/null; true' 2>$null
|
||||
if ($LASTEXITCODE -eq 0) { _Substep "cleaned Unsloth from WSL distro: $d" "Green" }
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Unsloth Studio uninstalled."
|
||||
Write-Host "Note: Hugging Face model cache at %USERPROFILE%\.cache\huggingface was left in place."
|
||||
|
|
|
|||
|
|
@ -247,7 +247,6 @@ case "$_os" in
|
|||
# shellcheck disable=SC2016
|
||||
# $env:APPDATA is a PowerShell expansion; intentionally literal at shell level.
|
||||
powershell.exe -NoProfile -Command '
|
||||
$names = @("Desktop","StartMenu");
|
||||
$dirs = @(
|
||||
[Environment]::GetFolderPath("Desktop"),
|
||||
(Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs")
|
||||
|
|
@ -256,6 +255,14 @@ case "$_os" in
|
|||
if (-not $d) { continue }
|
||||
$p = Join-Path $d "Unsloth Studio.lnk";
|
||||
if (Test-Path -LiteralPath $p) { Remove-Item -LiteralPath $p -Force }
|
||||
}
|
||||
# WSL-fallback native shim/launcher dir (%LOCALAPPDATA%\Unsloth) + its PATH entry.
|
||||
$ud = if ($env:LOCALAPPDATA) { Join-Path $env:LOCALAPPDATA "Unsloth" } else { $null };
|
||||
if ($ud) {
|
||||
$shim = (Join-Path $ud "bin").TrimEnd("\","/");
|
||||
$up = [Environment]::GetEnvironmentVariable("Path","User");
|
||||
if ($up) { [Environment]::SetEnvironmentVariable("Path", (($up -split ";" | Where-Object { $_ -and ($_.TrimEnd("\","/") -ine $shim) }) -join ";"), "User") }
|
||||
if (Test-Path -LiteralPath $ud) { Remove-Item -LiteralPath $ud -Recurse -Force -ErrorAction SilentlyContinue }
|
||||
}' >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue