update: use Requires to simplify install.ps1
This commit is contained in:
parent
af66c00155
commit
09628f088d
1 changed files with 2 additions and 13 deletions
|
@ -2,22 +2,11 @@
|
||||||
# dotfiles install script for Windows
|
# dotfiles install script for Windows
|
||||||
|
|
||||||
# check administration role
|
# check administration role
|
||||||
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
|
#Requires -RunAsAdministrator
|
||||||
$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
|
# check pwsh version
|
||||||
# ≧ 7
|
# ≧ 7
|
||||||
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
#Requires -Version 7
|
||||||
Write-Warning -Message "pwsh version must be greater than 7
|
|
||||||
please install powershell 7 (Core)
|
|
||||||
you can install via winget"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# check working directory
|
# check working directory
|
||||||
if (!(
|
if (!(
|
||||||
|
|
Loading…
Reference in a new issue