diff --git a/fast-apt-mirror.sh b/fast-apt-mirror.sh index 634954b..e2544ef 100644 --- a/fast-apt-mirror.sh +++ b/fast-apt-mirror.sh @@ -208,6 +208,7 @@ function find_fast_mirror() { --speedtests) assert_option_is_int "$1" "$2"; shift; local max_speedtests=$1 ;; --sample-size) assert_option_is_int "$1" "$2"; shift; local sample_size_kb=$1 ;; --sample-time) assert_option_is_int "$1" "$2"; shift; local sample_time_secs=$1 ;; + --country) shift; local country=${1^^} ;; --apply) local apply=true ;; --exclude-current) local exclude_current=true ;; --ignore-sync-state) local ignore_sync_state=true ;; @@ -220,6 +221,7 @@ function find_fast_mirror() { echo echo "Options:" echo " --apply - Replaces the currently configured APT mirror in /etc/apt/(sources.list|sources.list.d/system.sources) with a fast mirror and runs 'sudo apt-get update'" + echo " --country CODE - The country code to use for selecting mirrors. NOTE: Only applies to Ubuntu based distros. Defaults to http://mirrors.ubuntu.com/mirrors.txt" echo " --exclude-current - If specified, don't include the currently configured APT mirror in the speed tests." echo " --healthchecks N - Number of mirrors from the mirrors list to check for availability and up-to-dateness - default is 20" echo " --ignore-sync-state - Don't check up-to-dateness of mirrors as part of healthchecks" @@ -277,7 +279,7 @@ function find_fast_mirror() { ;; ubuntu|pop) local reference_mirror=http://archive.ubuntu.com/ubuntu/ - local mirrors=$(curl --max-time 5 -sSfL http://mirrors.ubuntu.com/mirrors.txt) + local mirrors=$(curl --max-time 5 -sSfL "http://mirrors.ubuntu.com/${country:-mirrors}.txt") local last_modified_path="/dists/${dist_version_name}-security/Contents-${dist_arch}.gz" ;; esac