 |
 |
 |
 |
| Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that. |

9th March 2008, 05:46 PM
|
 |
Registered User
|
|
Join Date: Jul 2006
Location: Sao Paulo, SP - Brazil
Age: 33
Posts: 698

|
|
Quote:
|
Originally Posted by bmvbab
Hi Sorry for the delay, http_proxy is the env variable to look for. If some one is using proxy then they should have exported http_proxy with something like http://www.proxy.com:8080
So for rpms u should be using --httphost=www.proxy.com --httpport=8080
If http_proxy is not set then we cannot do anything....
|
Hum, ok, and what about wget? Does it use that variable also?
Thanks
duli
|

10th March 2008, 06:43 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Location: India
Age: 32
Posts: 376

|
|
|
wget makes use of http_proxy. If that value is exported it is utilized and if not it assumes its a direct connection, wget also has an option --no-proxy which makes it not use proxy even if http_proxy is exported.
|

10th March 2008, 07:20 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
|
Me thinks the subshell may be dropping the variable.
|

10th March 2008, 08:08 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Location: India
Age: 32
Posts: 376

|
|
Quote:
|
Originally Posted by leadgolem
Me thinks the subshell may be dropping the variable.
|
Any pointers on how to get the values across to the new shell from the env variables?
|

10th March 2008, 08:45 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
Something like this in the initial script might do it.
Code:
export http_proxy="$http_proxy"
Though I find it odd this variable is in lowercase letters...
EDIT: This also assumes that the "http_proxy" variable is accessible in the initial script. If it is not, then you would want to use something more like this.
Code:
export http_proxy="http://www.proxy.com:8080"
Though that won't help anyone else using a proxy server.
Last edited by leadgolem; 10th March 2008 at 08:56 AM.
|

10th March 2008, 09:07 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Location: India
Age: 32
Posts: 376

|
|
Quote:
|
Originally Posted by leadgolem
Something like this in the initial script might do it.
Code:
export http_proxy="$http_proxy"
Though I find it odd this variable is in lowercase letters...
EDIT: This also assumes that the "http_proxy" variable is accessible in the initial script. If it is not, then you would want to use something more like this.
Code:
export http_proxy="http://www.proxy.com:8080"
Though that won't help anyone else using a proxy server.
|
Exactly, so lets see what Duli comes out with so that its usable by all...
|

10th March 2008, 09:07 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
|
I just had a better idea, write a short if/then to see if the variable exists. If it does run the rpm command with the appropriate options. You should be able to use the variable it's self to configure the rpm command. That is, if the variable is showing up in the subshell at all.
|

10th March 2008, 09:10 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Location: India
Age: 32
Posts: 376

|
|
Quote:
|
Originally Posted by leadgolem
I just had a better idea, write a short if/then to see if the variable exists. If it does run the rpm command with the appropriate options. You should be able to use the variable it's self to configure the rpm command. That is, if the variable is showing up in the subshell at all.
|
The problem is with the env variable not showing up at all in the new shell.
It does show up when I start a new bash session from inside another by running bash at the CLI. But why does the same not happen in this script?
A friend mentioned that if we use #!/bin/bash it would drop env variables in the new shell. Does that ring any bells? Looks like we would need a wrapper or some config file...I would not like to have one more config file
|

10th March 2008, 09:16 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
|
could be, #!/bin/sh does behave slightly differently from #!/bin/bash. Let me do a bit of testing...
|

10th March 2008, 09:43 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
|
Nope, the behavior doesn't seem to be any different in regards to subshell/session variables...
Last edited by leadgolem; 10th March 2008 at 09:53 AM.
|

10th March 2008, 10:10 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Littleton, CO
Age: 28
Posts: 2,855

|
|
|
I think I have it. I think this script is being run in a normal shell instead of a login shell. That means that it is not loading .bashrc or .bash_profile files from either your user, or root. Hence, as far as it is concerned no http_proxy variable was ever defined for use at all. At the moment, I'm not sure what to do about this though.
That would also explain why running it manually from a terminal works, but running the rpm version doesn't. I think consolehelper is what is giving you a normal shell instead of a login shell. When you run the scripts from a login shell your .bashrc and .bash_profile files are loaded, so the http_proxy variable is defined.
EDIT: Yep, just confirmed that consolehelper does precisely this.
Last edited by leadgolem; 10th March 2008 at 10:17 AM.
|

10th March 2008, 01:14 PM
|
 |
Registered User
|
|
Join Date: Jul 2006
Location: Sao Paulo, SP - Brazil
Age: 33
Posts: 698

|
|
|
bmvbab and leadgolem: Ok, so I think you guys just narrowed the issue. I´ll do some tests with all the provided information and certainly come out with a solution.
|

16th March 2008, 09:42 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Posts: 722

|
|
|
EasyLife gets my stamp of approval: (^_^)
__________________
But of course, take the above with a grain of salt...
|

20th March 2008, 01:58 PM
|
 |
Registered User
|
|
Join Date: Jul 2007
Location: Kernel
Age: 27
Posts: 108

|
|
wow, very good project!
My website helps fedora users in installing this extras... but your solution is VERY good... so I wanna do an Italian translation...
can you give me the necessary language files?
|

20th March 2008, 11:56 PM
|
 |
Registered User
|
|
Join Date: Jul 2006
Location: Sao Paulo, SP - Brazil
Age: 33
Posts: 698

|
|
Quote:
|
Originally Posted by karlpiuemeno
wow, very good project!
My website helps fedora users in installing this extras... but your solution is VERY good... so I wanna do an Italian translation...
can you give me the necessary language files?
|
Sure, here is the link to the english file.
Hey, thanks a lot for your efforts!
Duli
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 02:17 (Sunday, 19-05-2013)
|
|
 |
 |
 |
 |
|
|