diff options
-rw-r--r-- | config/global/download.in | 17 | ||||
-rw-r--r-- | scripts/functions | 8 |
2 files changed, 21 insertions, 4 deletions
diff --git a/config/global/download.in b/config/global/download.in index 05ca59cd..370d97b8 100644 --- a/config/global/download.in +++ b/config/global/download.in @@ -55,8 +55,6 @@ config ONLY_DOWNLOAD 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 @@ config USE_MIRROR *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 @@ config MIRROR_BASE_URL The mirror is available at: http://crosstool-ng.org/mirrors/ + +endif # USE_MIRROR + +endif # ! FORBID_DOWNLOAD diff --git a/scripts/functions b/scripts/functions index 4a91f7d8..9bbc753a 100644 --- a/scripts/functions +++ b/scripts/functions @@ -555,6 +555,12 @@ CT_GetFile() { 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 @@ CT_GetFile() { URLS+=( "${CT_MIRROR_BASE_URL}" ) fi - if [ "${CT_FORBID_DOWNLOAD}" != "y" ]; then + if [ "${CT_FORCE_MIRROR}" != "y" ]; then URLS+=( "${@}" ) fi |