Skip to content
This repository has been archived by the owner. It is now read-only.

[Enhancement] Don't assume that $env:USERPROFILE and $env:TEMP are predefined #647

Closed
lonniev opened this Issue Dec 21, 2014 · 8 comments

Comments

Projects
None yet
2 participants
@lonniev
Copy link

lonniev commented Dec 21, 2014

The install.ps1 at chocolatey.org assumes that it can safely create a temporary temp folder using Join-Path and $env:TEMP. However, that environment variable may be unset and the directory may not exist until the current user has logged into the system. (Packer uses a VM with a bash shell and the current working user when chocolatey install.ps1 is executed has yet to perform a Windows login.)

Better: either test for the existence of any chosen base directory (e.g. C:\Windows\temp) or simply create one at the root of the filesystem and delete it when finished.

@ferventcoder

This comment has been minimized.

Copy link
Contributor

ferventcoder commented Dec 27, 2014

Thanks for creating this separately.

@ferventcoder

This comment has been minimized.

Copy link
Contributor

ferventcoder commented Jan 2, 2015

This may be a duplicate of #554

@ferventcoder

This comment has been minimized.

Copy link
Contributor

ferventcoder commented Jan 2, 2015

Actually #307.

@ferventcoder

This comment has been minimized.

Copy link
Contributor

ferventcoder commented Jan 2, 2015

Closing this and updating #307

@ferventcoder

This comment has been minimized.

Copy link
Contributor

ferventcoder commented Jan 2, 2015

Okay, this is partially resolved with #307 - adds a cacheLocation to the config file.

@ferventcoder

This comment has been minimized.

Copy link
Contributor

ferventcoder commented Jan 2, 2015

Some of this may need to carry over to chocolatey.org where the download and part of the initial install script are located.

@ferventcoder ferventcoder changed the title chocolatey install.ps1 assumes that %USERPROFILE% and $env:TEMP are predefined chocolatey install.ps1 assumes that $env:USERPROFILE and $env:TEMP are predefined Jan 2, 2015

ferventcoder added a commit that referenced this issue Jan 2, 2015

(GH-307) Add cacheLocation
This allows you to override the default cacheLocation in $env:Temp\chocolatey.

This also resolves part of (GH-647) that mentions not assuming that $env:Temp is set.

ferventcoder added a commit that referenced this issue Jan 2, 2015

(GH-647) Don't assume $env:USERPROFILE is set
In cases where it is not set write a warning and return.

ferventcoder added a commit that referenced this issue Jan 2, 2015

(GH-647) Don't assume $env:TEMP is predefined
In the installer, override $env:TEMP if is null with the default cacheLocation.

ferventcoder added a commit that referenced this issue Jan 2, 2015

Merge branch 'stable'
* stable:
  0.9.8.29-beta1
  (doc) update changelog/nuspec
  (GH-647) Don't assume $env:TEMP is predefined
  (GH-647) Don't assume $env:USERPROFILE is set
  (GH-307) Add cacheLocation

@ferventcoder ferventcoder changed the title chocolatey install.ps1 assumes that $env:USERPROFILE and $env:TEMP are predefined [Enhancement] Don't assume that $env:USERPROFILE and $env:TEMP are predefined Jan 2, 2015

@ferventcoder ferventcoder added 3 - Done and removed 2 - Working labels Jan 2, 2015

@ferventcoder ferventcoder reopened this Jan 2, 2015

@ferventcoder

This comment has been minimized.

Copy link
Contributor

ferventcoder commented Jan 2, 2015

The rest of this will be over at chocolatey/chocolatey.org#139

@ferventcoder

This comment has been minimized.

Copy link
Contributor

ferventcoder commented Jan 2, 2015

Once 0.9.8.29 is out, you should be completely good to go.

@ferventcoder ferventcoder self-assigned this Jan 2, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.