blob: 41b3b5105367709022a51bf51fff6d633fcc6b7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#Requires -Version 5.1
<#
Windows-natives Pendant zu install.sh (ersetzt install-win.cmd).
install.sh bleibt unveraendert - kopiert (statt zu verlinken) die
relevanten Konfigurationen an ihre nativen Windows-Zielorte. Keine
Admin-Rechte noetig (keine Symlinks).
Aufruf:
.\install-win.ps1
Falls die Ausfuehrung durch die Execution Policy blockiert wird:
powershell -ExecutionPolicy Bypass -File .\install-win.ps1
Hinweis: Es wird KOPIERT, nicht verlinkt. Nach Aenderungen im Repo
dieses Skript erneut ausfuehren, um die Kopien zu aktualisieren.
#>
$ErrorActionPreference = "Stop"
function Write-Ok($msg) {
Write-Host "OK $msg" -ForegroundColor Green
}
function Write-Step($msg) {
Write-Host "==> $msg" -ForegroundColor Cyan
}
function Write-SkipMsg($msg) {
Write-Host "- $msg" -ForegroundColor DarkGray
}
$RepoRoot = $PSScriptRoot
$NvimSrc = Join-Path $RepoRoot "nvim"
$NvimDst = Join-Path $env:LOCALAPPDATA "nvim"
$GitConfigSrc = Join-Path $RepoRoot "git\config"
$GitConfigDst = Join-Path $env:USERPROFILE ".gitconfig"
$GitUp2partsSrc = Join-Path $RepoRoot "git\config-up2parts"
$GitXdgDir = Join-Path $env:USERPROFILE ".config\git"
$GitUp2partsDst = Join-Path $GitXdgDir "config-up2parts"
$NpmrcSrc = Join-Path $RepoRoot "npm\npmrc"
$NpmrcDst = Join-Path $env:USERPROFILE ".npmrc"
function Copy-NvimConfig {
Write-Step "nvim -> $NvimDst"
if (Test-Path $NvimDst) {
Remove-Item -Recurse -Force $NvimDst
}
Copy-Item -Recurse -Force $NvimSrc $NvimDst
Write-Ok $NvimDst
}
function Copy-GitConfig {
Write-Step "git\config -> $GitConfigDst"
Copy-Item -Force $GitConfigSrc $GitConfigDst
Write-Ok $GitConfigDst
if (-not (Test-Path $GitXdgDir)) {
New-Item -ItemType Directory -Path $GitXdgDir -Force | Out-Null
}
Write-Step "git\config-up2parts -> $GitUp2partsDst"
Copy-Item -Force $GitUp2partsSrc $GitUp2partsDst
Write-Ok "$GitUp2partsDst (wird per includeIf aus .gitconfig eingebunden)"
}
function Copy-Npmrc {
if (Test-Path $NpmrcDst) {
Write-SkipMsg "$NpmrcDst existiert bereits, uebersprungen"
return
}
Write-Step "npm\npmrc -> $NpmrcDst"
Copy-Item -Force $NpmrcSrc $NpmrcDst
Write-Ok $NpmrcDst
}
function Main {
Copy-NvimConfig
Copy-GitConfig
Copy-Npmrc
Write-Host ""
Write-Host "Fertig. Dateien wurden KOPIERT, nicht verlinkt." -ForegroundColor Green
Write-Host "Nach Aenderungen im Repo dieses Skript erneut ausfuehren."
}
Main
|