1 |
On 04/30/2012 02:45 PM, James wrote: |
2 |
> Michael Orlitzky <michael <at> orlitzky.com> writes: |
3 |
> |
4 |
> |
5 |
>> You'll have to script something. |
6 |
> |
7 |
|
8 |
I gave this a serious shot, but it's not easy. |
9 |
|
10 |
First, you can override the ebuild environment: |
11 |
|
12 |
$ cat /etc/portage/bashrc |
13 |
if [ "${EBUILD_PHASE}" == "clean" ] && [ "${PN}" == "sun-jdk" ]; then |
14 |
... |
15 |
|
16 |
You can parse out the important stuff from the ebuild. This sets JDK_URI |
17 |
to the value contained in the ebuild: |
18 |
|
19 |
eval `"${GREP}" JDK_URI= "${EBUILD}"` |
20 |
|
21 |
And you can even parse the URL out of the HTML file pretty easily with a |
22 |
regular expression. But, unfortunately, they're checking for cookies: |
23 |
|
24 |
$ wget http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk- |
25 |
6u31-linux-x64.bin |
26 |
... |
27 |
HTTP request sent, awaiting response... 302 Moved Temporarily |
28 |
Location: http://download.oracle.com/errors/download-fail-1505220.html |
29 |
|
30 |
And, the cookies don't get set in a normal HTTP request. So you can't |
31 |
just `curl $JDK_URI` and save the cookies. |
32 |
|
33 |
It looks like the URL that sets the cookies is created by that |
34 |
javascript lightbox code, so you need to be able to evaluate JS, get |
35 |
that URL, hit the page, and save its cookies before you're allowed to |
36 |
download the file. |
37 |
|
38 |
Finally, the cookies are dynamic, and not something like let_me_in=True. |
39 |
So maybe it's still possible, but scp is looking a lot better right now. |