patriksvensson / cupboard

A framework for provisioning local environments to a desired state, using the .NET SDK.
MIT License
761 stars 19 forks source link

Running as sudo in Linux means that the home directory is going to be /root #13

Closed just1a-person closed 3 years ago

just1a-person commented 3 years ago

Running as sudo in Linux shouldn't be required.

patriksvensson commented 3 years ago

Yes, I agree. Will make this configurable for each provider and only require sudo if a used provider needs it.

patriksvensson commented 3 years ago

Should be fixed in the next preview version. Now, either a resource provider can say that it needs administrative permissions, or you can opt-in for it when declaring the resource.

context.Resource<PowerShellScript>("Install Chocolatey")
    .Script("~/install-chocolatey.ps1")
    .RequireAdministrator()
    .Unless("if (Test-Path \"$($env:ProgramData)/chocolatey/choco.exe\") { exit 1 }")
    .After<RegistryKey>("Set execution policy")
    .After<Download>("https://chocolatey.org/install.ps1");