2022-09-20 00:54:55 +09:00
|
|
|
#!/usr/bin/pwsh
|
2022-09-20 15:47:11 +09:00
|
|
|
# dotfiles install script for Windows
|
2022-09-20 00:54:55 +09:00
|
|
|
|
|
|
|
# check administration role
|
|
|
|
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
|
|
|
|
$bool_admin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
|
|
|
if (!$bool_admin) {
|
|
|
|
Write-Warning -Message "require Admin privilage
|
|
|
|
please run as Administrator"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# check pwsh version
|
|
|
|
# ≧ 7
|
|
|
|
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
|
|
|
Write-Warning -Message "pwsh version must be greater than 7
|
|
|
|
please install powershell 7 (Core)
|
|
|
|
you can install via winget"
|
|
|
|
exit 1
|
2022-09-20 01:51:16 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
# check working directory
|
|
|
|
if (!(
|
|
|
|
(Test-Path bin) -and (Test-Path dotfiles)
|
|
|
|
)) {
|
|
|
|
Write-Warning -Message "wrong current path
|
|
|
|
please execute at repo root"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-09-22 22:14:49 +09:00
|
|
|
# install powershell modules
|
|
|
|
Install-Module -Name posh-git
|
|
|
|
Install-Module -Name Pscx -AllowPrerelease
|
|
|
|
Install-Module -Name z
|
|
|
|
|
2022-09-20 01:51:16 +09:00
|
|
|
|
|
|
|
# make symbolic links
|
|
|
|
# neovim
|
2022-09-20 02:04:25 +09:00
|
|
|
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\init.vim -Target (Resolve-Path .\dotfiles\neovim\init.vim) -Force
|
|
|
|
# pwsh
|
|
|
|
New-Item -ItemType SymbolicLink -Path $PROFILE -Target (Resolve-Path .\dotfiles\pwsh\powershell_profile.ps1) -Force
|
2022-09-20 02:10:08 +09:00
|
|
|
New-Item -ItemType SymbolicLink -Path ~\.config\powershell\chezmoi_completion.ps1 -Target (Resolve-Path .\dotfiles\pwsh\chezmoi_completion.ps1) -Force
|
2022-09-20 02:21:10 +09:00
|
|
|
# starship
|
|
|
|
New-Item -ItemType SymbolicLink -Path ~\.config\starship.toml -Target (Resolve-Path .\dotfiles\starship\starship.toml) -Force
|