Closed drewburlingame closed 4 years ago
if you find another solution but....
its's not easy to download the java/jdk file from web in an automatic way. you have to go to the site, accept the terms, wait a time and them download the file.
my solution is: use the wget utility and pass a cookie value as parameter . This ways works!
function download-from-oracle($url, $output_filename, $part) { if (-not (has_file($output_fileName))) { $cookies="oraclelicense$part-oth-JPR=accept-securebackup-cookie;gpw_e24= http://edelivery.oracle.com" $cmd = "wget --no-check-certificate --header=""Cookie: $cookies"" -x -c ""$url"" -O ""$output_filename""" # -nc w_cmd $cmd } }
the wget utility is in the Gow Package. i could install wget only, but i think install wget and others, more practical(for me)
I tried to use the "Install-ChocolateyPackage" function but there's no a way to pass others parameters like a cookie.
i'll think in another way to download the java.jdk thanks for posting.
2012/12/19 Drew Burlingame notifications@github.com
I started the install for Java.JDK and was surprised to see gow installing. I already have the linux tools I need with an msysgit install, and gow will just muddy my path. Any chance you can remove the dependency from the package?
Thanks, Drew
— Reply to this email directly or view it on GitHubhttps://github.com/adorepump/chocolatey-packages/issues/10.
Abraços Elliando Dias;
I've tested the script below, and it works for downloading the file. Any chance I could convince you to use this instead of the wget so that I won't have to create a new file?
Thanks, Drew
function Get-WebFileSimple {
param(
$url = '', #(Read-Host "The URL to download"),
$fileName = $null,
$cookies = '',
[switch]$ignoreInvalidCert
)
Write-Debug "Running 'Get-WebFileSimple' for $fileName with
url:'$url
', cookies: '$cookies
'";
if($ignoreInvalidCert -eq $true)
{
$origCertCheck = [System.Net.ServicePointManager]::
ServerCertificateValidationCallback
[System.Net.ServicePointManager]::ServerCertificateValidationCallback ={
$true}
}
$webclient = new-object System.Net.WebClient
$webclient.Headers.Add("Cookie",$cookies);
$webclient.DownloadFile($url, $fileName);
if($ignoreInvalidCert -eq $true)
{
[System.Net.ServicePointManager]::ServerCertificateValidationCallback =
$origCertCheck
}
}
On Thu, Dec 20, 2012 at 5:39 AM, Elliando Dias notifications@github.comwrote:
if you find another solution but....
its's not easy to download the java/jdk file from web in an automatic way. you have to go to the site, accept the terms, wait a time and them download the file.
my solution is: use the wget utility and pass a cookie value as parameter . This ways works!
function download-from-oracle($url, $output_filename, $part) { if (-not (has_file($output_fileName))) { $cookies="oraclelicense$part-oth-JPR=accept-securebackup-cookie;gpw_e24= http://edelivery.oracle.com" $cmd = "wget --no-check-certificate --header=""Cookie: $cookies"" -x -c ""$url"" -O ""$output_filename""" # -nc w_cmd $cmd } }
the wget utility is in the Gow Package. i could install wget only, but i think install wget and others, more practical(for me)
I tried to use the "Install-ChocolateyPackage" function but there's no a way to pass others parameters like a cookie.
i'll think in another way to download the java.jdk thanks for posting.
2012/12/19 Drew Burlingame notifications@github.com
I started the install for Java.JDK and was surprised to see gow installing. I already have the linux tools I need with an msysgit install, and gow will just muddy my path. Any chance you can remove the dependency from the package?
Thanks, Drew
— Reply to this email directly or view it on GitHub< https://github.com/adorepump/chocolatey-packages/issues/10>.
Abraços Elliando Dias;
— Reply to this email directly or view it on GitHubhttps://github.com/adorepump/chocolatey-packages/issues/10#issuecomment-11573618.
I updated the function slightly. It's at https://github.com/drewburlingame/chocolatey/blob/master/src/helpers/functions/Get-WebFileSimple.ps1. I also submitted a pull request in hopes of reusing the method for other packages.
Thanks for putting the jdk package together.
On Fri, Dec 21, 2012 at 12:46 AM, Drew Burlingame drewburlingame@gmail.comwrote:
I've tested the script below, and it works for downloading the file. Any chance I could convince you to use this instead of the wget so that I won't have to create a new file?
Thanks, Drew
function Get-WebFileSimple {
param(
$url = '', #(Read-Host "The URL to download"),
$fileName = $null,
$cookies = '',
[switch]$ignoreInvalidCert
)
Write-Debug "Running 'Get-WebFileSimple' for $fileName with url:
'$url
', cookies:'$cookies
'";if($ignoreInvalidCert -eq $true)
{
$origCertCheck = [System.Net.ServicePointManager]::
ServerCertificateValidationCallback
[System.Net.ServicePointManager]::ServerCertificateValidationCallback
= {$true}
}
$webclient = new-object System.Net.WebClient
$webclient.Headers.Add("Cookie",$cookies);
$webclient.DownloadFile($url, $fileName);
if($ignoreInvalidCert -eq $true)
{
[System.Net.ServicePointManager]::ServerCertificateValidationCallback
= $origCertCheck
}
}
On Thu, Dec 20, 2012 at 5:39 AM, Elliando Dias notifications@github.comwrote:
if you find another solution but....
its's not easy to download the java/jdk file from web in an automatic way. you have to go to the site, accept the terms, wait a time and them download the file.
my solution is: use the wget utility and pass a cookie value as parameter . This ways works!
function download-from-oracle($url, $output_filename, $part) { if (-not (has_file($output_fileName))) { $cookies="oraclelicense$part-oth-JPR=accept-securebackup-cookie;gpw_e24= http://edelivery.oracle.com" $cmd = "wget --no-check-certificate --header=""Cookie: $cookies"" -x -c ""$url"" -O ""$output_filename""" # -nc w_cmd $cmd } }
the wget utility is in the Gow Package. i could install wget only, but i think install wget and others, more practical(for me)
I tried to use the "Install-ChocolateyPackage" function but there's no a way to pass others parameters like a cookie.
i'll think in another way to download the java.jdk thanks for posting.
2012/12/19 Drew Burlingame notifications@github.com
I started the install for Java.JDK and was surprised to see gow installing. I already have the linux tools I need with an msysgit install, and gow will just muddy my path. Any chance you can remove the dependency from the package?
Thanks, Drew
— Reply to this email directly or view it on GitHub< https://github.com/adorepump/chocolatey-packages/issues/10>.
Abraços Elliando Dias;
— Reply to this email directly or view it on GitHubhttps://github.com/adorepump/chocolatey-packages/issues/10#issuecomment-11573618.
ok, i will test and give a feedback
2012/12/21 Drew Burlingame notifications@github.com
I updated the function slightly. It's at
https://github.com/drewburlingame/chocolatey/blob/master/src/helpers/functions/Get-WebFileSimple.ps1.
I also submitted a pull request in hopes of reusing the method for other packages.
Thanks for putting the jdk package together.
On Fri, Dec 21, 2012 at 12:46 AM, Drew Burlingame drewburlingame@gmail.comwrote:
I've tested the script below, and it works for downloading the file. Any chance I could convince you to use this instead of the wget so that I won't have to create a new file?
Thanks, Drew
function Get-WebFileSimple {
param(
$url = '', #(Read-Host "The URL to download"),
$fileName = $null,
$cookies = '',
[switch]$ignoreInvalidCert
)
Write-Debug "Running 'Get-WebFileSimple' for $fileName with url:
'$url
', cookies:'$cookies
'";if($ignoreInvalidCert -eq $true)
{
$origCertCheck = System.Net.ServicePointManager:: ServerCertificateValidationCallback
= {$true}
}
$webclient = new-object System.Net.WebClient
$webclient.Headers.Add("Cookie",$cookies);
$webclient.DownloadFile($url, $fileName);
if($ignoreInvalidCert -eq $true)
{
= $origCertCheck
}
}
On Thu, Dec 20, 2012 at 5:39 AM, Elliando Dias notifications@github.comwrote:
if you find another solution but....
its's not easy to download the java/jdk file from web in an automatic way. you have to go to the site, accept the terms, wait a time and them download the file.
my solution is: use the wget utility and pass a cookie value as parameter . This ways works!
function download-from-oracle($url, $output_filename, $part) { if (-not (has_file($output_fileName))) {
$cookies="oraclelicense$part-oth-JPR=accept-securebackup-cookie;gpw_e24= http://edelivery.oracle.com" $cmd = "wget --no-check-certificate --header=""Cookie: $cookies"" -x -c ""$url"" -O ""$output_filename""" # -nc w_cmd $cmd } }
the wget utility is in the Gow Package. i could install wget only, but i think install wget and others, more practical(for me)
I tried to use the "Install-ChocolateyPackage" function but there's no a way to pass others parameters like a cookie.
i'll think in another way to download the java.jdk thanks for posting.
2012/12/19 Drew Burlingame notifications@github.com
I started the install for Java.JDK and was surprised to see gow installing. I already have the linux tools I need with an msysgit install, and gow will just muddy my path. Any chance you can remove the dependency from the package?
Thanks, Drew
— Reply to this email directly or view it on GitHub< https://github.com/adorepump/chocolatey-packages/issues/10>.
Abraços Elliando Dias;
— Reply to this email directly or view it on GitHub< https://github.com/adorepump/chocolatey-packages/issues/10#issuecomment-11573618>.
— Reply to this email directly or view it on GitHubhttps://github.com/adorepump/chocolatey-packages/issues/10#issuecomment-11606695.
Abraços Elliando Dias;
I started the install for Java.JDK and was surprised to see gow installing. I already have the linux tools I need with an msysgit install, and gow will just muddy my path. Any chance you can remove the dependency from the package?
Thanks, Drew