Skip to content

Commit

Permalink
add --country option for Ubuntu mirrors
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudenum authored and sebthom committed Jul 6, 2024
1 parent 25cec20 commit 948aeb8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fast-apt-mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 948aeb8

Please sign in to comment.