repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

topgrade: win32 trash settings

9410e342b1ea1910445e4c78728c4d157aa1c0ed

Oliver Krylow <o.krylow@isp-insoft.de> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (3)

+110 / −2 text lines

Diff layout

topgrade/repair-podman-machine.ps1

Added
new file mode 100644

+42 / −0 text lines

1[CmdletBinding()]
2param()
3
4$ErrorActionPreference = 'Stop'
5$repoPath = '/etc/yum.repos.d/podman-release-copr.repo'
6$repoRepair = "sh -c 'if grep -q ''podman-container-tools-podman-29249'' ''$repoPath''; then sed -i ''s/^enabled=1`$/enabled=0/'' ''$repoPath''; fi'"
7
8& podman.exe machine ssh --username root $repoRepair
9if ($LASTEXITCODE -ne 0) {
10 throw "Podman machine repository repair failed with exit code $LASTEXITCODE."
11}
13$sourcePath = Join-Path $HOME '.config\containers\registries.conf'
14$directoryPath = Join-Path $env:APPDATA 'containers\registries.conf.d'
15$targetPath = Join-Path $directoryPath '999-podman-desktop-registries-from-host.conf'
16$brokenPath = "$targetPath.broken"
18$sourceContent = if (Test-Path -LiteralPath $sourcePath -PathType Leaf) {
19 Get-Content -LiteralPath $sourcePath -Raw
20}
21if ($null -ne $sourceContent -and [string]::IsNullOrWhiteSpace($sourceContent)) {
22 throw "Podman registry source is empty: $sourcePath"
23}
25New-Item -ItemType Directory -Path $directoryPath -Force | Out-Null
26foreach ($path in @($targetPath, $brokenPath)) {
27 $item = Get-Item -LiteralPath $path -Force -ErrorAction SilentlyContinue
28 if ($null -ne $item -and (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0 -or $path -eq $brokenPath)) {
29 Remove-Item -LiteralPath $path -Force
30 }
31}
33if ($null -ne $sourceContent) {
34 $currentContent = if (Test-Path -LiteralPath $targetPath -PathType Leaf) {
35 Get-Content -LiteralPath $targetPath -Raw
36 }
37 if ($currentContent -ne $sourceContent) {
38 Set-Content -LiteralPath $targetPath -Value $sourceContent -NoNewline
39 }
40}
42Write-Output "Podman machine config repaired; stale COPR repo disabled."

topgrade/update-wezterm-nightly.ps1

Added
new file mode 100644

+65 / −0 text lines

1[CmdletBinding()]
2param()
3
4$ErrorActionPreference = 'Stop'
5$assetName = 'WezTerm-nightly-setup.exe'
6$releaseApi = 'https://api.github.com/repos/wez/wezterm/releases/tags/nightly'
7$stampPath = Join-Path $env:LOCALAPPDATA 'topgrade\wezterm-nightly.sha256'
8
9if (Get-Process -Name 'wezterm-gui' -ErrorAction SilentlyContinue) {
10 Write-Output 'Skipping WezTerm update because WezTerm is running.'
11 exit 0
12}
14$wezterm = Get-Command wezterm.exe -CommandType Application -ErrorAction Stop
15$release = Invoke-RestMethod -Uri $releaseApi -Headers @{ 'User-Agent' = 'dotfiles-topgrade' }
16$asset = @($release.assets | Where-Object Name -eq $assetName) | Select-Object -First 1
17if ($null -eq $asset -or $asset.digest -notmatch '^sha256:[0-9a-fA-F]{64}$') {
18 throw "GitHub nightly release does not contain a verified $assetName asset."
19}
20if ($asset.browser_download_url -ne "https://github.com/wez/wezterm/releases/download/nightly/$assetName") {
21 throw "Unexpected WezTerm download URL: $($asset.browser_download_url)"
22}
24$digest = $asset.digest.ToLowerInvariant()
25$knownDigest = if (Test-Path -LiteralPath $stampPath -PathType Leaf) {
26 (Get-Content -LiteralPath $stampPath -Raw).Trim().ToLowerInvariant()
27}
28if ($knownDigest -eq $digest) {
29 $version = & $wezterm.Source --version
30 if ($LASTEXITCODE -ne 0) {
31 throw "Installed WezTerm failed version check with exit code $LASTEXITCODE."
32 }
33 Write-Output "WezTerm nightly already current: $version"
34 exit 0
35}
37$tempPath = Join-Path ([IO.Path]::GetTempPath()) "WezTerm-nightly-setup-$PID.exe"
38try {
39 Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $tempPath
40 $actualHash = (Get-FileHash -LiteralPath $tempPath -Algorithm SHA256).Hash.ToLowerInvariant()
41 if ("sha256:$actualHash" -ne $digest) {
42 throw "WezTerm installer checksum mismatch: expected $digest, got sha256:$actualHash"
43 }
45 $installer = Start-Process -FilePath $tempPath -ArgumentList @(
46 '/VERYSILENT',
47 '/SUPPRESSMSGBOXES',
48 '/NORESTART'
49 ) -Wait -PassThru
50 if ($installer.ExitCode -ne 0) {
51 throw "WezTerm installer failed with exit code $($installer.ExitCode)."
52 }
54 $version = & $wezterm.Source --version
55 if ($LASTEXITCODE -ne 0) {
56 throw "Updated WezTerm failed version check with exit code $LASTEXITCODE."
57 }
59 New-Item -ItemType Directory -Path (Split-Path -Parent $stampPath) -Force | Out-Null
60 Set-Content -LiteralPath $stampPath -Value $digest -NoNewline
61 Write-Output "Updated WezTerm nightly: $version"
62}
63finally {
64 Remove-Item -LiteralPath $tempPath -Force -ErrorAction SilentlyContinue
65}

topgrade/win32.toml

Modified

+3 / −2 text lines

1111[pre_commands]
1212"00 Winget Export" = 'winget export --source winget --nowarn --output C:\Users\okr\Tools\winget_installed_apps.json'
13"01 Podman Machine" = "podman machine ssh dnf upgrade --refresh -y"
13"01 Podman Machine Repair" = '& "C:\Users\okr\Workspace\dotfiles\topgrade\repair-podman-machine.ps1"'
14"02 Podman Machine" = "podman machine ssh dnf upgrade --refresh -y"
1516[post_commands]
1617"00 Cleanup Downloads Folder" = "nu --commands 'ls ~/Downloads | where modified < ((date now) - 30day) | par-each { rm -rf $in.name }'"
2021[commands]
2122"WSL ArchLinux-dev" = "wsl --distribution ArchLinux-dev --exec /usr/sbin/topgrade -y"
2223"Windows Update" = "powershell -NoProfile -Command 'Get-WindowsUpdate -MicrosoftUpdate -UpdateType Software -AcceptAll -Install -IgnoreReboot'"
23"WezTerm Nightly" = "winget install --id wez.wezterm.nightly --exact --source winget --accept-package-agreements --accept-source-agreements"
24"WezTerm Nightly" = '& "C:\Users\okr\Workspace\dotfiles\topgrade\update-wezterm-nightly.ps1"'
2425"WSL Cgroup Workaround" = '& "C:\Users\okr\Workspace\dotfiles\topgrade\sync-wsl-cgroup-workaround.ps1"'
2627[containers]