[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: use LB_APT_HTTP_PROXY in debootstrap and for udebs



On Thu, May 31, 2012 at 8:54 AM, Daniel Baumann
<daniel.baumann@progress-technologies.net> wrote:
> On 05/30/2012 09:44 PM, Rui Miguel P. Bernardo wrote:
>> I've installed squid proxy here and tested the latest lb_config changes again.
>> Indeed, it works out-of-the-box with squid, IIF you have http_proxy set
>> in the environment. If you don't have http_proxy in your environment,
>> squid is not used for debootstrap nor debian-installer, only in chroot.
>
> 'lb config --apt-http-proxy http://$whatever' sets http_proxy in
> config/common, which is part of the environment when
> lb_bootstrap_debootstrap is calling debootstrap.

Yes it is. but because squid users have it in their environment. having
things like they are now will only work out-of-the-box with squid users.
apt-cacher users don't have http_proxy in their environment and it
doesnt work for them. Try the following:

As root, in an empty directory, with squid, unset the http_proxy var
and make the following build:

        # unset http_proxy
        # lb config -d squeeze -a i386 --linux-flavours 486 \
                --archive-areas "main contrib non-free" \
                --debian-installer live \
                --apt-http-proxy http://proxy:port
        # grep -i proxy config/*
        ...
        config/common:http_proxy="http://proxy:port";


Thats ok. If I add something like

        echo "########## http_proxy value is ${http_proxy}"

to lb_bootstrap_debootstrap and to lb_binary_debian-installer, later
lb_build will show:

        ########## http_proxy value is http://proxy:port

But the debootstrap debian-installer downloads will not be done through
the proxy. Only the chroot will use the proxy that is set in config/common.

Now set http_proxy variable again

        export http_proxy="http://proxy:port";

and repeat the process in a new directory (lb config and lb build). The
downloads will be made from the squid proxy. The fact that http_proxy
is set in the environment makes it work out-of-the-box. If you don't have
http_proxy set in the environment, http://proxy:port will be correctly
present in the debug lines but debootstrap will not use it. Neither
will the wget
executions in lb_binary_debian-installer.

But if I add the following code in lb_bootstrap_debootstrap and
lb_binary_debian-installer:

if [ -n "${http_proxy}" ]
then
       export http_proxy
fi

Repeat the process in another clean directory with unset http_proxy and also
explicitly adding the LB_APT_HTTP_PROXY to lb_config options like previously:

        # unset http_proxy
        # lb config -d squeeze -a i386 --linux-flavours 486 \
                --archive-areas "main contrib non-free" \
                --debian-installer live \
                --apt-http-proxy http://proxy:port
        # lb build

Everything works as expected, out-of-the-box for squid and apt-cacher
users, i.e. either you have http_proxy set in the environment or not.
debootstrap and debian-installer downloads will be done from the proxy.

I had to explicitly export http_proxy variable in the script to make
debootstrap and wget use the http_proxy variable set in config/common by
lb_config but that was not present in the environment when lb build is executed.

An alternative to changing the code may be a reference in live-manual or
lb_config man page about the fact that http_proxy must be set and exported
in the environment to fully save downloads and time in all stages, including
in debootstrap and debian-installer. I would not recommend myself for the
wording because of this strange english I write. Suggestions?


Reply to: