Skip to content
This repository has been archived by the owner on Feb 19, 2019. It is now read-only.

[Enhancement] Use custom \bin\ folder #217

Open
Redsandro opened this issue Dec 18, 2012 · 11 comments
Open

[Enhancement] Use custom \bin\ folder #217

Redsandro opened this issue Dec 18, 2012 · 11 comments

Comments

@Redsandro
Copy link
Contributor

( Split from #215 )

Using the Install-ChocolateyZipPackage command, all .exe files within the .zip file will be installed in it's respective package folder inside **\Chocolatey\lib**; and the executable will be linked in the form of a .bat file in the *\Chocolatey\bin* directory, unless there is an empty .exe.ignore file present to signal the installer not to do this.

I would like to use 'my' bin-folder for this. I have my own bin folder where I copy .exe's that are not provided with packages, and that I sync* to my other computers.

Is this possible? Is there a chocolatey configuration file? Is this what the chocolatey_bin_root environment var that I read about in someone's package does? Do we need to set it up manually?

*) Because of this (and other reasons), some users prefer .exe files copied to the binary folder in stead of being linked with .bat files. See Issue #216

@Redsandro
Copy link
Contributor Author

I noticed that the CreatePackages wiki* specifically mentions using the %chocolatey_bin_root% environment variable as installation path under Installation paths -> 1. %chocolatey_bin_root% environment variable, but this variable is empty.

*) https://github.com/chocolatey/chocolatey/wiki/CreatePackages

@ferventcoder
Copy link
Contributor

It also mentions where the ruby package installs if it has not been set.

@Redsandro
Copy link
Contributor Author

You are right, but what I mean is: You are advised (by the docs) to pass the variable to the (random) installer if it is supported. But the path is empty by default. Which means you will be explicitly passing an empty path to the (random) installer and who knows how it will be interpreted.

My first thought is that %chocolatey_bin_path% should be set to %ChocolateyInstall%\bin by default the when Chocolatey is installed, so it is never empty and can be edited by the user.

My second thought is that the current solution is to check if %chocolatey_bin_path% empty in the install script.

But wouldn't it be more logical to have the installer set a default value, rather than have 500+ packages perform this check?

If not, we should add a comment about checking the var in the docs so it isn't ambiguous.

@Redsandro
Copy link
Contributor Author

Added "Please note that this variable is empty by default, and needs to be explicitly set by the user. Before installing to %chocolatey_bin_root%, your installation script should check if this variable is not empty." to wiki.

@ferventcoder
Copy link
Contributor

As far as a default value, I agree - #190

@ferventcoder
Copy link
Contributor

And the addition of Install-ChocolateyTool (with some parameters) that does all of this magical work for you. :D

Just added for tracking - #221

@Redsandro
Copy link
Contributor Author

I have the feeling that people who are not working on the code but do care about packages and documentation miss out on the good stuff. :P

However, there is no such file in functions: https://github.com/chocolatey/chocolatey/tree/master/src/functions
Can you point me to the right direction?

I want to see if it will daisychain with Install-ChocolateyZipPackage (or maybe is does that automatically).

@Redsandro
Copy link
Contributor Author

Ah now I see.. the function doesn't exist yet. I'm slow. :P

@ferventcoder
Copy link
Contributor

We do try to keep the documentation updated with the things that exist or are in the code base but have not yet been released.

@Redsandro
Copy link
Contributor Author

I'd like to reference this post about env vars and finding the bin path as it is closely related to this issue:
#221 (comment)

Quote:

Is $env:ChocolateyInstall automatically set when Chocolatey is installed? Because we can use something like:

function Get-BinPath {
    # Calculate $binRoot, which imo should always be set in $env:chocolatey_bin_root as a full path (not relative)
    if($env:chocolatey_bin_root -eq $null) {
        $binRoot = "$env:ChocolateyInstall\bin"
    }
    # My chocolatey_bin_root is C:\Common\bin, but looking at other packages, not everyone assumes chocolatey_bin_root is prepended with a drive letter.
    elseIf (-not($env:chocolatey_bin_root -imatch "^\w:")) {
        # Add drive letter
        $binRoot = join-path $env:systemdrive $env:chocolatey_bin_root
    }
    else {
        $binRoot = $env:chocolatey_bin_root
    }
    return $binRoot
}

@Redsandro
Copy link
Contributor Author

If the Chocolatey installer would set $env:chocolatey_bin_root = "$env:ChocolateyInstall\bin" the effect would be the same, but more straight-forward for the user to change the bin location because the default is set rather than made up by the package if it does not exist.

These are just thoughts based on things I found confusing as a new user.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants