# HG changeset patch # User Austin Morton # Date 1344771942 14400 # Node ID 2858a24a584642e263a920b4214c815c172ed547 # Parent 6d88d6558b7a60fc58d7e36ef1b982c1bf9e7f1c scripts: add option to only use the mirror Currently, if downloads are forbidden, the mirror is still tried for. Change this way: - if downlaods forbidden, do not try neither upstream locations nor mirror - add option to only use the mirror, and avoid upstream locations Signed-off-by: Austin Morton [yann.morin.1998@free.fr: broaden the if USE_MIRRORto enclode mirror location] Signed-off-by: "Yann E. MORIN" diff -r 6d88d6558b7a -r 2858a24a5846 config/global/download.in --- a/config/global/download.in Sun Sep 16 14:12:22 2012 -0400 +++ b/config/global/download.in Sun Aug 12 07:45:42 2012 -0400 @@ -55,8 +55,6 @@ Useful to pre-retrieve the tarballs before going off-line. -endif # ! FORBID_DOWNLOAD - config USE_MIRROR bool prompt "Use a mirror" @@ -69,10 +67,19 @@ *not* on your LAN, for example on another subnet of your company's network, or a mirror on the Internet. +if USE_MIRROR + +config FORCE_MIRROR + bool + prompt "Only use mirror" + help + Only allow downloading from the mirror specified, other download locations + will NOT be used, and the package will fail to be located if not present + on the mirror provided + config MIRROR_BASE_URL string prompt "Base URL" - depends on USE_MIRROR default "http://crosstool-ng.org/mirrors/" help This is the base URL searched in for tarballs. @@ -90,3 +97,7 @@ The mirror is available at: http://crosstool-ng.org/mirrors/ + +endif # USE_MIRROR + +endif # ! FORBID_DOWNLOAD diff -r 6d88d6558b7a -r 2858a24a5846 scripts/functions --- a/scripts/functions Sun Sep 16 14:12:22 2012 -0400 +++ b/scripts/functions Sun Aug 12 07:45:42 2012 -0400 @@ -555,6 +555,12 @@ fi # No, it does not... + # If not allowed to download from the Internet, don't + if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then + CT_DoLog DEBUG "Not allowed to download from the Internet, aborting ${file} download" + return 1 + fi + # Try to retrieve the file CT_DoLog EXTRA "Retrieving '${file}'" @@ -565,7 +571,7 @@ URLS+=( "${CT_MIRROR_BASE_URL}" ) fi - if [ "${CT_FORBID_DOWNLOAD}" != "y" ]; then + if [ "${CT_FORCE_MIRROR}" != "y" ]; then URLS+=( "${@}" ) fi