Commit cb07fb94 authored by Natanael Copa's avatar Natanael Copa

setup-apkrepos: add option to add first mirror on the list

first in the list is normally a cdn
parent b421b066
...@@ -153,16 +153,21 @@ usage() { ...@@ -153,16 +153,21 @@ usage() {
-f Detect and add fastest mirror -f Detect and add fastest mirror
-h Show this help -h Show this help
-r Add a random mirror and do not prompt -r Add a random mirror and do not prompt
-1 Add first mirror on the list (normally a CDN)
__EOF__ __EOF__
exit 1 exit 1
} }
while getopts "fhr" opt; do add_fastest=false
add_first=false
add_random=false
while getopts "1fhr" opt; do
case $opt in case $opt in
f) JUSTADDFASTEST=1;; f) add_fastest=true;;
1) add_first=true;;
h) usage;; h) usage;;
r) JUSTADDRANDOM=1;; r) add_random=true;;
esac esac
done done
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))
...@@ -193,17 +198,21 @@ if [ $# -gt 0 ]; then ...@@ -193,17 +198,21 @@ if [ $# -gt 0 ]; then
# replace the apk repos with the specified ones # replace the apk repos with the specified ones
rm -f "$APKREPOS_PATH" rm -f "$APKREPOS_PATH"
for i; do for i; do
echo "$i" >> "$APKREPOS_PATH" echo "$i" >> "$APKREPOS_PATH" && changed=true
done done
changed=true
fi fi
if [ -n "$JUSTADDRANDOM" ]; then if $add_first; then
set -- $MIRRORS
add_mirror "$1" && changed=true
fi
if $add_random; then
show_mirror_list > /dev/null show_mirror_list > /dev/null
add_random_mirror && changed=true add_random_mirror && changed=true
fi fi
if [ -n "$JUSTADDFASTEST" ]; then if $add_fastest; then
show_mirror_list > /dev/null show_mirror_list > /dev/null
add_fastest_mirror && changed=true add_fastest_mirror && changed=true
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment