-
Notifications
You must be signed in to change notification settings - Fork 136
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
(GH-60) fix upgrade/installation Filestream errors on PSv2 #92
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,13 +30,14 @@ $chocTempDir = Join-Path $env:TEMP "chocolatey" | |
$tempDir = Join-Path $chocTempDir "chocInstall" | ||
if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)} | ||
$file = Join-Path $tempDir "chocolatey.zip" | ||
$chocErrorLog = Join-Path $tempDir "chocError.log" | ||
|
||
function Download-File { | ||
param ( | ||
[string]$url, | ||
[string]$file | ||
) | ||
Write-Host "Downloading $url to $file" | ||
Write-Output "Downloading $url to $file" | ||
$downloader = new-object System.Net.WebClient | ||
$downloader.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials; | ||
$downloader.DownloadFile($url, $file) | ||
|
@@ -47,13 +48,13 @@ Download-File $url $file | |
|
||
if ($unzipMethod -eq '7zip') { | ||
# download 7zip | ||
Write-Host "Download 7Zip commandline tool" | ||
Write-Output "Download 7Zip commandline tool" | ||
$7zaExe = Join-Path $tempDir '7za.exe' | ||
|
||
Download-File 'https://chocolatey.org/7za.exe' "$7zaExe" | ||
|
||
# unzip the package | ||
Write-Host "Extracting $file to $tempDir..." | ||
Write-Output "Extracting $file to $tempDir..." | ||
Start-Process "$7zaExe" -ArgumentList "x -o`"$tempDir`" -y `"$file`"" -Wait -NoNewWindow | ||
} else { | ||
$shellApplication = new-object -com shell.application | ||
|
@@ -63,13 +64,21 @@ if ($unzipMethod -eq '7zip') { | |
} | ||
|
||
# call chocolatey install | ||
Write-Host "Installing chocolatey on this machine" | ||
Write-Output "Installing chocolatey on this machine" | ||
$toolsFolder = Join-Path $tempDir "tools" | ||
$chocInstallPS1 = Join-Path $toolsFolder "chocolateyInstall.ps1" | ||
|
||
& $chocInstallPS1 | ||
if ($PSVersionTable.psversion.Major -gt 2) { | ||
& $chocInstallPS1 | ||
} | ||
else { | ||
$output = Invoke-Expression $chocInstallPS1 | ||
$output | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean we'll be waiting the entire run before are able to see output? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you will see the output, but not the error log... if you want to see the errors, like on all the silentlycontinue stuff, it is going to throw a lot of people off, on perfectly fine installs due to inconsequentialities. i tried on a dozen servers of varying configs, and think that if people have an issue with an install gone bad, they can be referred to the error log. We can add a write-output that states the error logs for PS2 version folks are found in $env:temp if they have any issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
write-output "Any errors that occured during install or upgrade are logged here: $chocoErrorLog" | ||
$error | out-file $chocErrorLog | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think this will help. its an edge case thing, and ppl who encounter a real issue, we'll see why when they post their log, instead of the filestream bs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, that would be fantastic. |
||
} | ||
|
||
Write-Host 'Ensuring chocolatey commands are on the path' | ||
Write-Output 'Ensuring chocolatey commands are on the path' | ||
$chocInstallVariableName = "ChocolateyInstall" | ||
$chocoPath = [Environment]::GetEnvironmentVariable($chocInstallVariableName, [System.EnvironmentVariableTarget]::User) | ||
if ($chocoPath -eq $null -or $chocoPath -eq '') { | ||
|
@@ -82,7 +91,7 @@ if ($($env:Path).ToLower().Contains($($chocoBinPath).ToLower()) -eq $false) { | |
$env:Path = [Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::Machine); | ||
} | ||
|
||
Write-Host 'Ensuring chocolatey.nupkg is in the lib folder' | ||
Write-Output 'Ensuring chocolatey.nupkg is in the lib folder' | ||
$chocoPkgDir = Join-Path $chocoPath 'lib\chocolatey' | ||
$nupkg = Join-Path $chocoPkgDir 'chocolatey.nupkg' | ||
if (![System.IO.Directory]::Exists($chocoPkgDir)) { [System.IO.Directory]::CreateDirectory($chocoPkgDir); } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fully on board with this idea. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've replaced the final ones of these to write-output in chocolateySetup.psm1 as well.