aboutsummaryrefslogtreecommitdiff
path: root/install-win.ps1
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2026-07-27 10:06:17 +0200
committerThomas Schmucker <ts@its1.de>2026-07-27 10:06:17 +0200
commit19b0f50dcdcb517e0ea1362b3644a42a91844ab8 (patch)
tree3d02e30cf1da103a9757878b9aafc0fbd95c40b6 /install-win.ps1
parent9433e7e35499ba5aa7a643b51c3d2101e174aa31 (diff)
parent7d29d60f7ca96cd0d76008345ec788671cfb7573 (diff)
downloaddotfiles-19b0f50dcdcb517e0ea1362b3644a42a91844ab8.tar.gz
dotfiles-19b0f50dcdcb517e0ea1362b3644a42a91844ab8.tar.bz2
dotfiles-19b0f50dcdcb517e0ea1362b3644a42a91844ab8.zip
Merge branch 'windows-port'
Diffstat (limited to 'install-win.ps1')
-rw-r--r--install-win.ps1113
1 files changed, 113 insertions, 0 deletions
diff --git a/install-win.ps1 b/install-win.ps1
new file mode 100644
index 0000000..aa77243
--- /dev/null
+++ b/install-win.ps1
@@ -0,0 +1,113 @@
1#Requires -Version 5.1
2<#
3 Windows-natives Pendant zu install.sh - kopiert (statt zu verlinken) die
4 relevanten Konfigurationen an ihre nativen Windows-Zielorte. Keine
5 Admin-Rechte noetig (keine Symlinks).
6
7 Aufruf:
8 .\install-win.ps1
9#>
10
11$ErrorActionPreference = "Stop"
12
13function Write-Ok($msg) {
14 Write-Host "OK $msg" -ForegroundColor Green
15}
16
17function Write-Step($msg) {
18 Write-Host "==> $msg" -ForegroundColor Cyan
19}
20
21function Write-SkipMsg($msg) {
22 Write-Host "- $msg" -ForegroundColor DarkGray
23}
24
25$RepoRoot = $PSScriptRoot
26
27$NvimSrc = Join-Path $RepoRoot "nvim"
28$NvimDst = Join-Path $env:LOCALAPPDATA "nvim"
29
30$GitConfigSrc = Join-Path $RepoRoot "git\config"
31$GitConfigDst = Join-Path $env:USERPROFILE ".gitconfig"
32
33$GitUp2partsSrc = Join-Path $RepoRoot "git\config-up2parts"
34$GitXdgDir = Join-Path $env:USERPROFILE ".config\git"
35$GitUp2partsDst = Join-Path $GitXdgDir "config-up2parts"
36
37$NpmrcSrc = Join-Path $RepoRoot "npm\npmrc"
38$NpmrcDst = Join-Path $env:USERPROFILE ".npmrc"
39
40function Copy-NvimConfig {
41 Write-Step "nvim -> $NvimDst"
42
43 if (Test-Path $NvimDst) {
44 Remove-Item -Recurse -Force $NvimDst
45 }
46
47 Copy-Item -Recurse -Force $NvimSrc $NvimDst
48 Write-Ok $NvimDst
49}
50
51function Copy-GitConfig {
52 Write-Step "git\config -> $GitConfigDst"
53 Copy-Item -Force $GitConfigSrc $GitConfigDst
54 Write-Ok $GitConfigDst
55
56 if (-not (Test-Path $GitXdgDir)) {
57 New-Item -ItemType Directory -Path $GitXdgDir -Force | Out-Null
58 }
59
60 Write-Step "git\config-up2parts -> $GitUp2partsDst"
61 Copy-Item -Force $GitUp2partsSrc $GitUp2partsDst
62 Write-Ok "$GitUp2partsDst (wird per includeIf aus .gitconfig eingebunden)"
63}
64
65function Copy-Npmrc {
66 if (Test-Path $NpmrcDst) {
67 Write-SkipMsg "$NpmrcDst existiert bereits, uebersprungen"
68 return
69 }
70
71 # HOME ist unter Windows i.d.R. nicht gesetzt, ${HOME} in npm/npmrc wuerde
72 # nicht expandieren - Zeile daher auskommentieren statt zweite npmrc-Datei
73 # zu pflegen.
74 Write-Step "npm\npmrc -> $NpmrcDst (prefix-Zeile auskommentiert)"
75 $lines = Get-Content -Path $NpmrcSrc | ForEach-Object {
76 if ($_ -match "^\s*prefix\s*=") {
77 "; $_ (unter Windows auskommentiert)"
78 } else {
79 $_
80 }
81 }
82 Set-Content -Path $NpmrcDst -Value $lines
83 Write-Ok $NpmrcDst
84}
85
86function Add-BinToUserPath {
87 $binDir = Join-Path $RepoRoot "windows\bin"
88 $userPath = [Environment]::GetEnvironmentVariable("PATH", "User")
89 $entries = $userPath -split ";"
90
91 if ($entries -contains $binDir) {
92 Write-SkipMsg "$binDir bereits im User-PATH"
93 return
94 }
95
96 Write-Step "$binDir zum User-PATH hinzufuegen (enthaelt gmake.cmd)"
97 [Environment]::SetEnvironmentVariable("PATH", "$userPath;$binDir", "User")
98 Write-Ok "$binDir (wirkt erst in neuen Terminal-Sitzungen)"
99}
100
101function Main {
102 Copy-NvimConfig
103 Copy-GitConfig
104 Copy-Npmrc
105 Add-BinToUserPath
106
107 Write-Host ""
108 Write-Host "Fertig. Dateien wurden KOPIERT, nicht verlinkt." -ForegroundColor Green
109 Write-Host "Nach Aenderungen im Repo dieses Skript erneut ausfuehren."
110 Write-Host "Neues Terminal oeffnen, damit PATH-Aenderungen wirksam werden." -ForegroundColor Yellow
111}
112
113Main