diff --git a/install.ps1 b/install.ps1 index d9063e832c..f5768ac0cc 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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" } diff --git a/scripts/uninstall.ps1 b/scripts/uninstall.ps1 index 6174e7e494..16f309f687 100644 --- a/scripts/uninstall.ps1 +++ b/scripts/uninstall.ps1 @@ -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." diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 94ca04b204..699cff9d3c 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -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