Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gsudo: Add to PATH instead of shim #980

Merged
merged 4 commits into from
Apr 27, 2020
Merged

gsudo: Add to PATH instead of shim #980

merged 4 commits into from
Apr 27, 2020

Conversation

gerardog
Copy link
Contributor

@gerardog gerardog commented Apr 5, 2020

Per ScoopInstaller/Scoop#1896 and gerardog/gsudo#9, gsudo works better without a shim wrapper.

@gerardog
Copy link
Contributor Author

This is how I tested it:

:: Installing previous version 
❯ scoop install .\gsudo.json
Installing 'gsudo' (0.6.0) [64bit]
Loading gsudo.v0.6.0.zip from cache
Checking hash of gsudo.v0.6.0.zip ... ok.
Extracting gsudo.v0.6.0.zip ... done.
Linking ~\scoop\apps\gsudo\current => ~\scoop\apps\gsudo\0.6.0
Creating shim for 'gsudo'.
Creating shim for 'sudo'.
'gsudo' (0.6.0) was installed successfully!

:: Verify how previous version was installed (using shim)
❯ (Get-Command gsudo).Path
C:\Users\ggrignoli\scoop\shims\gsudo.ps1

❯ gsudo -v
gsudo v0.6
Copyright(c) 2019 Gerardo Grignoli

:: (Updated json with new version)
:: Trigger update

❯ scoop update gsudo
gsudo: 0.6.0 -> 0.7
Updating one outdated app:
Updating 'gsudo' (0.6.0 -> 0.7)
Downloading new version
Loading gsudo.v0.7.zip from cache
Checking hash of gsudo.v0.7.zip ... ok.
Uninstalling 'gsudo' (0.6.0)
Removing shim for 'gsudo'.
Removing shim for 'sudo'.
Unlinking ~\scoop\apps\gsudo\current
Installing 'gsudo' (0.7) [64bit]
Loading gsudo.v0.7.zip from cache
Extracting gsudo.v0.7.zip ... done.
Linking ~\scoop\apps\gsudo\current => ~\scoop\apps\gsudo\0.7
'gsudo' (0.7) was installed successfully!

:: New path not using shims.

❯ (Get-Command gsudo).Path
C:\Users\ggrignoli\scoop\apps\gsudo\current\gsudo.exe

:: New version succesfully deployed
❯ gsudo -v
gsudo v0.7
Copyright(c) 2019-2020 Gerardo Grignoli and GitHub contributors

rasa
rasa previously approved these changes Apr 16, 2020
@gerardog
Copy link
Contributor Author

Hi @rasa, turns out some people expect the sudo alias to continue working after updating, and this PR was breaking that... I could have created a symlink sudo->gsudo.exe but that would require elevation on creation (for most people) then making the installation interactive (UAC), which I believe is (rightfully) forbidden on scoop.
So, without a perfect solution, what was left was to let sudo be a shim alias, and gsudo.exe in the path (no shum).
That way at least I get gsudo working full without any shim issues, and a limited sudo alias.
Thanks

@niheaven niheaven merged commit 69a0ab1 into ScoopInstaller:master Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants