summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-04-07 07:04:20 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-04-07 07:04:20 +0000
commitc113ed8e15966559b98e1027b41bf065375abe99 (patch)
treecddb277613122b785a971c67c2adbf88d1e43fd1
parentb0b109a06f1f890b8833c6afa38c357a084c65bc (diff)
downloadalpine-conf-c113ed8e15966559b98e1027b41bf065375abe99.zip
setup-apkrepos: add -f for just-add-fastest mirror
fixes #4017
-rw-r--r--setup-apkrepos.in11
1 files changed, 9 insertions, 2 deletions
diff --git a/setup-apkrepos.in b/setup-apkrepos.in
index e29572e..8bbb811 100644
--- a/setup-apkrepos.in
+++ b/setup-apkrepos.in
@@ -137,11 +137,12 @@ edit_repositories() {
usage() {
cat <<__EOF__
-usage: setup-apkrepos [-hr] [REPO...]
+usage: setup-apkrepos [-fhr] [REPO...]
Setup apk repositories
options:
+ -f Detect and add fastest mirror
-h Show this help
-r Add a random mirror and do not prompt
__EOF__
@@ -149,8 +150,9 @@ __EOF__
}
-while getopts "hr" opt; do
+while getopts "fhr" opt; do
case $opt in
+ f) JUSTADDFASTEST=1;;
h) usage;;
r) JUSTADDRANDOM=1;;
esac
@@ -193,6 +195,11 @@ if [ -n "$JUSTADDRANDOM" ]; then
add_random_mirror && changed=true
fi
+if [ -n "$JUSTADDFASTEST" ]; then
+ show_mirror_list > /dev/null
+ add_fastest_mirror && changed=true
+fi
+
while ! $changed; do
show_mirror_list
prompt_setup_method $default_answer