Fudge
Fudge copied to clipboard
Basic linux support
Seems like there is a few problems preventing the basics from working. (Note I dont have choco installed yet, so that should be the first error I see)
$ pwsh -c ". assets/fudge/Fudge.ps1 list"
Fudge v$version$
Error checking user administrator priviledges
Windows Principal functionality is not supported on this platform.
Must be running with administrator priviledges for Fudge to fully function
Duration: 00:00:00.4940592
$ pwsh -c ". assets/fudge/Fudge.ps1 pack -fudgefile .ci/Fudgefile.appveyor"
Fudge v$version$
Error checking user administrator priviledges
Windows Principal functionality is not supported on this platform.
Must be running with administrator priviledges for Fudge to fully function
Duration: 00:00:00.2603162
Oh yeah, there will be - Admin checking is a big one, as it only works on Windows. Also that Chocolately isn't for nix as well.
This is one that will be resolved via #61 and #53 - For rewriting Fudge as a module, I'm looking at using classes - to make multiple providers easier to support.
Also that Chocolately isn't for nix as well.
I have a reasonably working choco with https://github.com/chocolatey/choco/pull/1827
I'm going to hack around the Fudge admin checking and see what else doesnt work. Im especially keen on seeing fudge/choco pack working, as that can be used to create fake empty packages that can be installed on Linux for mock/test/development purposes.
List of initial problems:
-
Test-Chocolateyinvokeschoco, but on linux it will bechoco.exewhich is not executable. I've created a shell scriptchocoto workaround this. Instead,Test-Chocolateycould fall back to looking formono, and/or invoking something likemono choco.exe. The user then needs to setMONO_PATHappropriately, but this isnt working for me yet. -
Test-AdminUserfails badly withError checking user administrator priviledges Windows Principal functionality is not supported on this platform. Must be running with administrator priviledges for Fudge to fully function
Easy workaround is for
Test-AdminUserto just return false on linux. -
choco on linux replies with
Chocolatey v0.10.14-beta-83-g501397c5 Custom unofficial builds are not allowed by default. To override this behavior, explicitly set --allow-unofficial.
Fudge needs to add that --allow-unofficial , always on Linux, or just always always assuming it doesnt break anything. How silly that it needs a flag to run. That is a solution to a non-problem if I ever saw one.
One possible workaround is for the user to add
-args '--allow-unofficial'when invoking fudge, and then adding -Arguments $Arguments everywhere, as https://github.com/Badgerati/Fudge/pull/56 only added it to most of the actions.packis one with a differentInvoke-Chocolatey, so the CLI args need to be passed through tochoco pack.choco -vdoesnt need '--allow-unofficial'; there might be a few more which dont. Other actions that useInvoke-Chocolatey(Action)and dont pass args from the CLI:Remove-Fudgefile,Restore-Fudgefile,New-Fudgefile,Invoke-FudgePrune,Invoke-FudgeClean. The alternative is forInvoke-Chocolateyto add--allow-unofficial. If it can always be added without side-effects, this is a good option. If it should only be added in some circumstances, then checking those circumstances here could be an annoying overhead. -
action
packshould not require admin privileges. Seems this is just an oversight, and needs to be added to the list$isAdminAction = @(...It seems to work ok without admin privs. -
Most of the
Write-Noticein Fudge.ps1 should beWrite-Failand should return an exit code