RPi-Distro / pi-gen

Tool used to create the official Raspberry Pi OS images
BSD 3-Clause "New" or "Revised" License
2.62k stars 1.64k forks source link

Apt proxy fallback #602

Closed umutediz closed 2 months ago

umutediz commented 2 years ago

Apt proxy fallback option added as a config file parameter. If configured to use direct connection as a fallback, the script will test connectivity with the proxy server each time before using it via a bash function for debootstrap and via apt.conf.d/52fallback file on chroot.

If fallback is configured, the old 51cache file will not be installed.

export-image stage removes all installed files related to this functionality.

Testing this script on Debian buster with the following config file in 4 different scenarios worked fine for me. I tried it while the proxy is down all the time, up all the time, changed state from up to down and down to up during build. Script used proxy whenever it is available in all of these scenarios.

IMG_NAME='ProxyTest' APT_PROXY=http://10.0.2.3:3142/ APT_PROXY_FALLBACK=1

XECDesign commented 2 years ago

At a glance, looks good. Might be a while before I can go over it fully, test and merge.