summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-03-01 14:05:14 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-03-01 14:05:14 +0000
commit692d59d4aa586a674940f2a96d0cd16e1f5d1287 (patch)
treef8981184a50c25683bcc80165c7850530e077a26
parenta75f4297e8a42ceecba668fb3d11d16a1bdc8a76 (diff)
downloadalpine-conf-692d59d4aa586a674940f2a96d0cd16e1f5d1287.zip
setup-apkrepos: mionor cleanup
use get_hostname_from_url function to make it more readable
-rwxr-xr-xsetup-apkrepos.in14
1 files changed, 6 insertions, 8 deletions
diff --git a/setup-apkrepos.in b/setup-apkrepos.in
index 7c7da29..3c7f6b8 100755
--- a/setup-apkrepos.in
+++ b/setup-apkrepos.in
@@ -20,6 +20,11 @@ if [ -r "$APKREPOS_PATH" ]; then
APKREPOS=`cat "$APKREPOS_PATH"`
fi
+get_hostname_from_url() {
+ local n=${1#*://}
+ echo ${n%%/*}
+}
+
prompt_setup_method() {
while true; do
echo "How would you like to set up internet apk repositories?"
@@ -50,9 +55,7 @@ get_random_mirror() {
i=`expr $i + 1`
done
- random_mirror_hostname=`echo $mirror | awk -F '://' '{print $2}' | awk -F '/' '{print $1}'`
-
- echo "using $random_mirror_hostname."
+ echo "using $(get_hostname_from_url $mirror)"
}
get_fastest_mirror() {
@@ -90,11 +93,6 @@ get_fastest_mirror() {
mirror=$mirror_lowest_rtt_mirror
}
-get_hostname_from_url() {
- local n=${1#*://}
- echo ${n%%/*}
-}
-
prompt_mirror_list() {
local i
local mirror_hostname