feat: enable using chocolatey
This commit is contained in:
parent
2626baa858
commit
c535f038a9
3 changed files with 6 additions and 11 deletions
2
handlers/chocolatey/install
Normal file
2
handlers/chocolatey/install
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
powershell -Command "Start-Process 'choco' -Verb runAs -ArgumentList 'install $*'"
|
|
@ -2,15 +2,12 @@ Param(
|
||||||
[string]$Loc
|
[string]$Loc
|
||||||
)
|
)
|
||||||
|
|
||||||
$Delay = 2
|
|
||||||
|
|
||||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
|
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
|
||||||
[Security.Principal.WindowsBuiltInRole] 'Administrator')
|
[Security.Principal.WindowsBuiltInRole] 'Administrator')
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Write-Host "Not elevated, restarting in $Delay seconds ..."
|
Write-Host "Not elevated, restarting..."
|
||||||
$Loc = Get-Location
|
$Loc = Get-Location
|
||||||
Start-Sleep -Seconds $Delay
|
|
||||||
|
|
||||||
$Arguments = @(
|
$Arguments = @(
|
||||||
'-NoProfile',
|
'-NoProfile',
|
||||||
|
@ -23,13 +20,8 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
|
||||||
Start-Process -FilePath PowerShell.exe -Verb RunAs -ArgumentList $Arguments
|
Start-Process -FilePath PowerShell.exe -Verb RunAs -ArgumentList $Arguments
|
||||||
Break
|
Break
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Write-Host "Already elevated, exiting in $Delay seconds..."
|
|
||||||
Start-Sleep -Seconds $Delay
|
|
||||||
}
|
|
||||||
if($Loc.Length -gt 1){
|
if($Loc.Length -gt 1){
|
||||||
Set-Location $Loc.Substring(1,$Loc.Length-1)
|
Set-Location $Loc.Substring(1,$Loc.Length-2)
|
||||||
}
|
}
|
||||||
# https://github.com/lukegackle/PowerShell-Self-Elevate-Keeping-Current-Directory/blob/master/Self%20Elevate%20Keeping%20Directory.ps1
|
# https://github.com/lukegackle/PowerShell-Self-Elevate-Keeping-Current-Directory/blob/master/Self%20Elevate%20Keeping%20Directory.ps1
|
||||||
|
|
||||||
|
@ -139,4 +131,5 @@ if (!(Test-Path $ChocoInstallPath)) {
|
||||||
# TODO If offline:
|
# TODO If offline:
|
||||||
#Install-ChocolateyFromPackage 'chocolatey.0.11.2.nupkg'
|
#Install-ChocolateyFromPackage 'chocolatey.0.11.2.nupkg'
|
||||||
}
|
}
|
||||||
|
choco feature enable -n allowGlobalConfirmation
|
||||||
choco upgrade all
|
choco upgrade all
|
||||||
|
|
0
packages/chocolateygui/chocolatey
Normal file
0
packages/chocolateygui/chocolatey
Normal file
Loading…
Add table
Reference in a new issue