gerardog / gsudo

Sudo for Windows
https://gerardog.github.io/gsudo
MIT License
5.14k stars 138 forks source link

Feature Request: non-uac per-user installer for winget #271

Closed soredake closed 1 year ago

soredake commented 1 year ago

Description

It would be nice if there is installer that don't require UAC so i can install gsudo from winget without UAC like in scoop package.

Proposed technical details

gerardog commented 1 year ago

Do you have an app as an example that has that behaviour? Isn't every single app on winget asking for uac?

soredake commented 1 year ago

Isn't every single app on winget asking for uac?

No, UAC is needed only for privileged actions like writing to some parts of registry or program files, software is slowly switching to per-user installer when it's possible.

Do you have an app as an example that has that behaviour?

Here is my list of per-user software: https://github.com/soredake/dotfiles_windows/blob/7025ecb8259462e715ccef0b3944c8256ba453d2/setup.ps1#L2

Programs in AppData\Local\Programs: image

gerardog commented 1 year ago

If it were done, the following scenarios would need to be tested

Modifying the installer is a lot of work... Every user has a different setup and each change tends to trigger unintended consequences and requires additional support.

I currently don't have spare time, and this feature already exists, if you use scoop to install gsudo.

If anyone is interested in contributing with a pull request, I would be really grateful. But the correct changes may need to be applied to the current installer in order to not break the existing flows.

soredake commented 1 year ago
  • once installed as per-user, doing a winget upgrade gerardog.gsudo should keep it per-user
  • once installed as per-machine, doing a winget upgrade gerardog.gsudo should keep it per-machine

You can do separate per-user/global installers.

I currently don't have spare time, and this feature already exists, if you use scoop to install gsudo.

Understandable, that's what i've done for now.

gerardog commented 1 year ago
  • once installed as per-user, doing a winget upgrade gerardog.gsudo should keep it per-user
  • once installed as per-machine, doing a winget upgrade gerardog.gsudo should keep it per-machine

You can do separate per-user/global installers.

😢 So much trouble!

If this can be done without turning 3 installers (x64,x86,arm64) into 6 (x64-per-user, x64-global,...), I would consider a PR!

New users arriving here: If you want to install gsudo per-user, without uac, use scoop or install the portable version manually.

... or upvote the first comment (here)!

ALERTua commented 8 months ago

@gerardog I'll describe my automation case using gsudo and my thoughts. I want to set up a fresh machine using several of my favorite programs. Ideally, I would like to provide the administrator password only once: for gsudo cache on. But to get there, I need gsudo. If to install gsudo, the user would need to have administrator rights, it's like distributing a 7zip install in a .7zip archive :D Yes, portable gsudo exists, but then why does the installation exist in the first place? For example with Chocolatey, all I need is to winget install chocolatey, and it gets installed without an administrator password into C:\ProgramData\chocolatey, and adds itself to the current user PATH. So by default, it's a winget --scope user install (they do not have --scope machine install at the moment). But your idea is to have gsudo.exe (or its sudo alias) to be machine-wide, and I support it. User scope installation cannot do this. Maybe the winget installation compromise would be to make the default installation of user scope (like Scoop does) and provide a gsudo CLI command to make the current gsudo.exe machine-wide, like Nircmd does image C:\ProgramData\gsudo\gsudo.exe --install would create C:\Windows\System32\gsudo.exe and C:\Windows\System32\sudo.exe symlinks, or just append the current gsudo.exe path to the system PATH variable. This way one would just

winget install gsudo
(installs to C:\ProgramData\gsudo, adds itself to the current user's PATH)
(Chocolatey-like "refreshenv" is needed here, I understand this. This is a separate topic.)
gsudo cache on
gsudo winget install directx
gsudo winget install Nvidia.GeForceExperience
...

I would appreciate this simplification. Without it, I am forced to store, distribute along with the automation scripts, and update manually, a portable gsudo installation, and avoid the installation. I appreciate your work very much. Your product makes my work a lot easier. <3

soredake commented 8 months ago

Maybe the winget installation compromise would be to make the default installation of user scope (like Scoop does)

I'll try to do this as winget now supports portable programs.

soredake commented 8 months ago

https://github.com/microsoft/winget-pkgs/pull/131849

gerardog commented 6 months ago

This change broke the winget release step, and now new versions are not being published to Winget.

Logs Reference: vedantmgoyal2009/winget-releaser#289