summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-11-21 15:53:12 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2022-11-21 15:53:12 +0100
commitcb99adbc4ff9446cf28013584be6a682c34baefb (patch)
treef6f37edb6d98cb6dddddbfd719c9ad9de57654d6
parent8bef48b670244def5f6df6934b5aae6889137ec7 (diff)
downloadalpine-conf-cb99adbc4ff9446cf28013584be6a682c34baefb.zip
setup-apkrepos: fix random index to be POSIX compatible
$RANDOM is not in POSIX.
-rw-r--r--setup-apkrepos.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/setup-apkrepos.in b/setup-apkrepos.in
index aecbd7f..d3270fe 100644
--- a/setup-apkrepos.in
+++ b/setup-apkrepos.in
@@ -38,7 +38,7 @@ add_random_mirror() {
echo "Warning! no mirror found" >&2
return 1
fi
- local random_mirror_index="$(( $RANDOM % $count ))"
+ local random_mirror_index="$(awk -v count=$count 'BEGIN {srand(); printf("%.0f", rand() * count)}')"
printf %s "Picking random mirror... "
for mirror in $MIRRORS; do