Skip to content

Commit d0e85f7

Browse files
antonymclaude
andcommitted
Track newest official release instead of hardcoded 8
distrib/8 no longer exists on the mirror. The old pipeline also masked the curl failure, since a pipeline exits with awk's status, so an empty version string was published. Walk the release dirs newest first, take the first Official one, and fail loudly if none parse. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 981ead5 commit d0e85f7

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

version.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
#!/bin/bash
22
set -e
3-
VERSION=$(curl -sfL http://mirrors.kernel.org/mageia/distrib/8/x86_64/VERSION | awk '{print $2}')
4-
# make sure the return has a sane version
5-
echo $VERSION
6-
exit 0
3+
4+
MIRROR=http://mirrors.kernel.org/mageia/distrib
5+
6+
# Walk release directories newest first and take the first official one.
7+
# cauldron is skipped since it is always the devel tree.
8+
for RELEASE in $(curl -sfL ${MIRROR}/ | grep -oE 'href="[0-9]+/"' | grep -oE '[0-9]+' | sort -rn); do
9+
VERSION=$(curl -sfL ${MIRROR}/${RELEASE}/x86_64/VERSION | grep Official | awk '{print $2}')
10+
# make sure the return has a sane version
11+
if [[ "${VERSION}" =~ ^[0-9]+$ ]]; then
12+
echo "${VERSION}"
13+
exit 0
14+
fi
15+
done
16+
exit 1

0 commit comments

Comments
 (0)