summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/profile/proteanos.sh28
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/profile/proteanos.sh b/lib/profile/proteanos.sh
index b78c5e8..272282a 100644
--- a/lib/profile/proteanos.sh
+++ b/lib/profile/proteanos.sh
@@ -18,6 +18,7 @@
# along with the ProteanOS Development Kit. If not, see
# <http://www.gnu.org/licenses/>.
+use rand
use opkg
prof_proteanos_fstab_linux="\
@@ -81,24 +82,17 @@ prof_proteanos_default_plat()
prof_proteanos_select_mirror()
{
- local rand=
- local mirror=
-
- rand=$(date '+%S')
- rand=$(($rand % 3))
- case ${rand} in
- 0)
- mirror='http://us.mirror.gnu.dk/pub/proteanos'
- ;;
- 1)
- mirror='http://eu.mirror.gnu.dk/pub/proteanos'
- ;;
- 2)
- mirror='http://mirror.oss.maxcdn.com/proteanos'
- ;;
- esac
+ local mirrors=
+ local mirrors_count=
+ local mirror_num=
+
+ mirrors="$(wget -q -O - \
+ 'http://files.proteanos.com/pub/proteanos-mirrors-http')"
+ mirrors_count=$(printf '%s\n' "${mirrors}" | wc -l)
+ rand
+ mirror_num=$(($rand_x % $mirrors_count + 1))
- printf '%s\n' "${mirror}"
+ printf '%s\n' "${mirrors}" | sed -n "${mirror_num}p"
}
prof_proteanos_validate_archplat()