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

Provide clarity about how Chocolatey is used/executed when running under Boxstarter #369

Closed
fwinkelbauer opened this issue Nov 24, 2018 · 16 comments · Fixed by #479
Closed
Assignees
Labels
5 - Released The issue has been resolved, and released to the public for consumption Documentation Issues for changes that only need to change documentation
Milestone

Comments

@fwinkelbauer
Copy link

What You Are Seeing?

The documentation of Invoke-ChocolateyBoxstarter and Install-BoxstarterPackage.ps1 state that Boxstarter will install Chocolatey on the machine if it does not exist. Using any of these functions on a fresh machine (using a local copy of Boxstarter) does not install choco.exe.

What is Expected?

The above functions should either install Chocolatey, or the documentation should be updated.

How Did You Get This To Happen? (Steps to Reproduce)

I am using this repository to create a box.zip file which contains a copy of Boxstarter. Running install-mybox.ps1 (included in box.zip) will install several Chocolatey packages on the machine (C:\ProgramData\chocolatey\lib), but there seems to be no C:\ProgramData\chocolatey\bin\choco.exe.

@mwallner mwallner added the Documentation Issues for changes that only need to change documentation label Nov 24, 2018
@mwallner mwallner self-assigned this Nov 24, 2018
@mwallner
Copy link
Member

Thanks for reporting, imo this is valid behaviour, or at least that what I expected it to be.

I'll update the documentation.
CC @pauby @flcdrg - any objections?

@mwallner
Copy link
Member

I've just checked boxstarter internals,- and as far as I can see it always uses it's "own" version of Chocolatey.
Therefore it really doesn't make sense to automatically install Chocolatey when using Boxstarter, because it's not necessary.

@fwinkelbauer
Copy link
Author

fwinkelbauer commented Nov 24, 2018

Installing Chocolatey would be useful if a user wants to update his packages later on. This case could be covered by adding choco install chocolatey to a Boxstarter script though.

@fwinkelbauer
Copy link
Author

fwinkelbauer commented Dec 14, 2018

Here's one thing to keep in mind:

Some of Chocolatey's features are not available if Boxstarter does not install a local version of Chocolatey. The C:\ProgramData\Chocolatey\bin folder is not added to PATH.

You can reproduce this on a fresh Windows machine (without Chocolatey) with this Boxstarter script (and a copy of Boxstarter, as described in my initial post above):

cinst bumpy.portable
Update-SessionEnvironment
bumpy

Which results in the error "bumpy not found", even though C:\ProgramData\Chocolatey\bin\bumpy.exe is installed.

Packages such as vscode seem to add their executable to PATH on their own, which is why something like this:

cinst vscode
Update-SessionEnvironment
code --install-extension cake-build.cake-vscode

works.

Here is a working snippet:

cinst chocolatey
cinst bumpy.portable
Update-SessionEnvironment
bumpy

Edit: Should this particular problem be tracked as a new issue? I can think of two solutions to this problem:

  • Boxstarter installs Chocolatey
  • Boxstarter adds C:\ProgramData\Chocolatey\bin to the PATH variable

@pauby
Copy link
Member

pauby commented Dec 14, 2018

@fwinkelbauer This would still be resolved by installing Chocolatey manually?

@fwinkelbauer
Copy link
Author

@pauby I have just updated the above comment. Yes, installing Chocolatey resolves this problem. But this behaviour might be confusing for some users, as this snippet:

cinst bumpy.portable
Update-SessionEnvironment
bumpy

will work on a machine with Chocolatey and Boxstarter installed, but it will fail when using a standalone version of Boxstarter.

@pauby
Copy link
Member

pauby commented Dec 14, 2018

@fwinkelbauer I agree. Maybe just an update to the docs in this case as @mwallner suggested?

@fwinkelbauer
Copy link
Author

Which would be option number three, yes, that would work as well.

Another option would be that a user manually adds the Choco bin folder to $env:Path (as an alternative to choco install chocolatey) to his Boxstarter script.

@pauby
Copy link
Member

pauby commented Dec 14, 2018

Another option would be that a user manually adds the Choco bin folder to $env:Path (as an alternative to choco install chocolatey) to his Boxstarter script.

That's for the user to decide though. It's not something we'd suggest as it's a kludge.

I'm not in favour of options 1 and 2 as that changes expected behaviour. What would be an option I think we should look at is Boxstarter installing Chocolatey itself for a future version (perhaps v3). @mwallner As you've looked at this above what are your thoughts?

@mwallner
Copy link
Member

What would be an option I think we should look at is Boxstarter installing Chocolatey itself for a future version (perhaps v3).

Something we can consider yes - but we'd be dropping the possibility to install / "push install" packages without actually installing Chocolatey...

What about yet another option: just adding C:\ProgramData\Chocolatey\bin to $env:Path during Boxstarter operations?

  • I think this would fix the issues @fwinkelbauer is currently facing.

I kind of don't want to drop the ability to remote-push Chocolatey packages via Boxstarter without forcing the remote computer to install Chocolatey itself.

CC @ferventcoder - if you've got a preference here, please let us know ;-)

@fwinkelbauer
Copy link
Author

What about yet another option: just adding C:\ProgramData\Chocolatey\bin to $env:Path during Boxstarter operations?

* I think this would fix the issues @fwinkelbauer is currently facing.

That's pretty much what I was trying to say in my above comment. Adding the bin folder to $env:Path would "fix" every shim that Boxstarter would create via a Chocolatey installation.

@pauby
Copy link
Member

pauby commented Dec 17, 2018

@mwallner @fwinkelbauer

What about yet another option: just adding C:\ProgramData\Chocolatey\bin to $env:Path during Boxstarter operations?

Do we know why that's not being done? I'd rather understand that before we just go ahead and fix it.

@fwinkelbauer
Copy link
Author

My understanding is that this is not happening because Chocolatey is not installed when using the standalone version of Boxstarter.

Installing Boxstarter using any other method includes an installation of Chocolatey:

1. Using Chocolatey

choco install boxstarter. This should be obvious, Chocolatey is already installed.

2. Using the ZIP Archive provided on GitHub

This approach uses the Boxstarter bootstrapper, see below.

3. Using the Boxstarter Bootstrapper

The Boxstarter bootstrapper ensures that Chocolatey is installed.

4. ClickOnce

The ClickOnce launcher seems to utilize the Boxstarter.bat file, which should be the same method used in 2. (ZIP Archive).

@fwinkelbauer
Copy link
Author

I'll try to summarize what we already know, maybe this will help to clear things up.

Any method described here which installs Boxstarter, installs Chocolatey as part of the "bootstrapping" (see my post above).

The Powershell doc for Invoke-ChocolateyBoxstarter and Install-BoxstarterPackage claim that they will ensure Chocolatey is installed - which is currently not true. These installation checks are only done when using the bootstrapper.

The section "Running an Install from a network share or external media" here describes a method to install packages on a Computer without bootstrapping Boxstarter or Chocolatey. This is the only way (that I am aware of) in which Chocolatey is not installed on a computer. Boxstarter uses its own copy of Chocolatey to install packages. This approach works fine for package installation, but creates problems later on because any shim that Chocolatey creates is not available on $env:Path (because no one added C:\ProgramData\Chocolatey\bin to $env:Path).

In short:

  • The documentation for Invoke-ChocolateyBoxstarter and Install-BoxstarterPackage is outdated
  • Using a copy of Boxstarter without any bootstrapping mechanism does not install Chocolatey on a machine. As a result C:\ProgramData\Chocolatey\bin is not added to $env:Path.

@mwallner mwallner added this to the v2.13.0 milestone Mar 18, 2019
@pauby
Copy link
Member

pauby commented Mar 19, 2019

My thoughts on this are to update the documentation to make it clear that Chocolatey is NOT installed by Invoke-ChocolateyBoxstarter or Install-BoxstarterPackage. And to make it clear to the user that if they want the additional functionality offered by Chocolatey that they specifically install it.

I'm assuming that c:\programdata\chocolatey\bin doesn't exist as Chocolatey has not been installed so adding it to the path requires it to be created. I will need to check if it's actually there!

/cc @mwallner @flcdrg

@pauby pauby added the 0 - Backlog Issue is accepted, but is not ready to be worked on or not in current sprint label Mar 19, 2019
@pauby pauby modified the milestones: v2.13.0, 2.14.0 Feb 26, 2020
@pauby pauby modified the milestones: 2.14.0, 3.0.0 Oct 25, 2021
@gep13 gep13 removed Discussion 0 - Backlog Issue is accepted, but is not ready to be worked on or not in current sprint labels Apr 25, 2022
@gep13 gep13 added 3 - Review Code has been added, and is available for review as a pull request 4 - Done Code has been added to the repository, and has been reviewed by a team member and removed 3 - Review Code has been added, and is available for review as a pull request labels Apr 25, 2022
@gep13 gep13 changed the title No Chocolatey installation Provide clarity about how Chocolatey is used/executed when running under Boxstarter Apr 27, 2022
@gep13 gep13 modified the milestones: 3.0.0-beta-20220426-14, 3.0.0 Jul 14, 2022
@gep13 gep13 added 5 - Released The issue has been resolved, and released to the public for consumption and removed 4 - Done Code has been added to the repository, and has been reviewed by a team member labels Jul 14, 2022
@choco-bot
Copy link

🎉 This issue has been resolved in version 3.0.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Released The issue has been resolved, and released to the public for consumption Documentation Issues for changes that only need to change documentation
Projects
None yet
5 participants