topgrade: win32 trash settings
9410e342b1ea1910445e4c78728c4d157aa1c0ed
Oliver Krylow <o.krylow@isp-insoft.de> ·
SSH signature · not checked
- Parent 1: 83fe0e68b459
bugabingas dorkfiles
9410e342b1ea1910445e4c78728c4d157aa1c0ed
Oliver Krylow <o.krylow@isp-insoft.de> ·
SSH signature · not checked
+110 / −2 text lines
new file mode 100644+42 / −0 text lines
[CmdletBinding()]param()$ErrorActionPreference = 'Stop'$repoPath = '/etc/yum.repos.d/podman-release-copr.repo'$repoRepair = "sh -c 'if grep -q ''podman-container-tools-podman-29249'' ''$repoPath''; then sed -i ''s/^enabled=1`$/enabled=0/'' ''$repoPath''; fi'"& podman.exe machine ssh --username root $repoRepairif ($LASTEXITCODE -ne 0) { throw "Podman machine repository repair failed with exit code $LASTEXITCODE."}$sourcePath = Join-Path $HOME '.config\containers\registries.conf'$directoryPath = Join-Path $env:APPDATA 'containers\registries.conf.d'$targetPath = Join-Path $directoryPath '999-podman-desktop-registries-from-host.conf'$brokenPath = "$targetPath.broken"$sourceContent = if (Test-Path -LiteralPath $sourcePath -PathType Leaf) { Get-Content -LiteralPath $sourcePath -Raw}if ($null -ne $sourceContent -and [string]::IsNullOrWhiteSpace($sourceContent)) { throw "Podman registry source is empty: $sourcePath"}New-Item -ItemType Directory -Path $directoryPath -Force | Out-Nullforeach ($path in @($targetPath, $brokenPath)) { $item = Get-Item -LiteralPath $path -Force -ErrorAction SilentlyContinue if ($null -ne $item -and (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0 -or $path -eq $brokenPath)) { Remove-Item -LiteralPath $path -Force }}if ($null -ne $sourceContent) { $currentContent = if (Test-Path -LiteralPath $targetPath -PathType Leaf) { Get-Content -LiteralPath $targetPath -Raw } if ($currentContent -ne $sourceContent) { Set-Content -LiteralPath $targetPath -Value $sourceContent -NoNewline }}Write-Output "Podman machine config repaired; stale COPR repo disabled."new file mode 100644+65 / −0 text lines
[CmdletBinding()]param()$ErrorActionPreference = 'Stop'$assetName = 'WezTerm-nightly-setup.exe'$releaseApi = 'https://api.github.com/repos/wez/wezterm/releases/tags/nightly'$stampPath = Join-Path $env:LOCALAPPDATA 'topgrade\wezterm-nightly.sha256'if (Get-Process -Name 'wezterm-gui' -ErrorAction SilentlyContinue) { Write-Output 'Skipping WezTerm update because WezTerm is running.' exit 0}$wezterm = Get-Command wezterm.exe -CommandType Application -ErrorAction Stop$release = Invoke-RestMethod -Uri $releaseApi -Headers @{ 'User-Agent' = 'dotfiles-topgrade' }$asset = @($release.assets | Where-Object Name -eq $assetName) | Select-Object -First 1if ($null -eq $asset -or $asset.digest -notmatch '^sha256:[0-9a-fA-F]{64}$') { throw "GitHub nightly release does not contain a verified $assetName asset."}if ($asset.browser_download_url -ne "https://github.com/wez/wezterm/releases/download/nightly/$assetName") { throw "Unexpected WezTerm download URL: $($asset.browser_download_url)"}$digest = $asset.digest.ToLowerInvariant()$knownDigest = if (Test-Path -LiteralPath $stampPath -PathType Leaf) { (Get-Content -LiteralPath $stampPath -Raw).Trim().ToLowerInvariant()}if ($knownDigest -eq $digest) { $version = & $wezterm.Source --version if ($LASTEXITCODE -ne 0) { throw "Installed WezTerm failed version check with exit code $LASTEXITCODE." } Write-Output "WezTerm nightly already current: $version" exit 0}$tempPath = Join-Path ([IO.Path]::GetTempPath()) "WezTerm-nightly-setup-$PID.exe"try { Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $tempPath $actualHash = (Get-FileHash -LiteralPath $tempPath -Algorithm SHA256).Hash.ToLowerInvariant() if ("sha256:$actualHash" -ne $digest) { throw "WezTerm installer checksum mismatch: expected $digest, got sha256:$actualHash" } $installer = Start-Process -FilePath $tempPath -ArgumentList @( '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART' ) -Wait -PassThru if ($installer.ExitCode -ne 0) { throw "WezTerm installer failed with exit code $($installer.ExitCode)." } $version = & $wezterm.Source --version if ($LASTEXITCODE -ne 0) { throw "Updated WezTerm failed version check with exit code $LASTEXITCODE." } New-Item -ItemType Directory -Path (Split-Path -Parent $stampPath) -Force | Out-Null Set-Content -LiteralPath $stampPath -Value $digest -NoNewline Write-Output "Updated WezTerm nightly: $version"}finally { Remove-Item -LiteralPath $tempPath -Force -ErrorAction SilentlyContinue}+3 / −2 text lines
"00 Winget Export" = 'winget export --source winget --nowarn --output C:\Users\okr\Tools\winget_installed_apps.json'"01 Podman Machine" = "podman machine ssh dnf upgrade --refresh -y""00 Cleanup Downloads Folder" = "nu --commands 'ls ~/Downloads | where modified < ((date now) - 30day) | par-each { rm -rf $in.name }'""Windows Update" = "powershell -NoProfile -Command 'Get-WindowsUpdate -MicrosoftUpdate -UpdateType Software -AcceptAll -Install -IgnoreReboot'""WezTerm Nightly" = "winget install --id wez.wezterm.nightly --exact --source winget --accept-package-agreements --accept-source-agreements""WezTerm Nightly" = '& "C:\Users\okr\Workspace\dotfiles\topgrade\update-wezterm-nightly.ps1"'