From d6fa8fd8ecccb8f11667d9c291c77c4609114ca2 Mon Sep 17 00:00:00 2001 From: sneak Date: Thu, 10 Jun 2021 16:33:45 -0700 Subject: [PATCH] change mirror country automatically based on ipinfo --- prov.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/prov.sh b/prov.sh index 0c95772..ccfe91a 100644 --- a/prov.sh +++ b/prov.sh @@ -4,10 +4,32 @@ export DEBIAN_FRONTEND=noninteractive function main() { RELEASE="$(lsb_release -cs)" + apt update prov-$RELEASE } +function detect-mirror-country() { + apt install -y jq curl + curl ipinfo.io | jq -r .country +} + +function set-mirror-country() { + MURM="main universe restricted multiverse" + COUNTRY="$(detect-mirror-country)" + URL="http://$COUNTRY.archive.ubuntu.com/ubuntu" +cat > /etc/apt/sources.list.new <