mirror of https://github.com/prometheus/prometheus
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
516 B
25 lines
516 B
3 months ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
# if no version string is passed as an argument, read VERSION file
|
||
|
if [ $# -eq 0 ]; then
|
||
|
VERSION="$(< VERSION)"
|
||
|
else
|
||
|
VERSION=$1
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Remove leading 'v' if present
|
||
|
VERSION="${VERSION#v}"
|
||
|
|
||
|
# Extract MAJOR, MINOR, and REST
|
||
|
MAJOR="${VERSION%%.*}"
|
||
|
MINOR="${VERSION#*.}"; MINOR="${MINOR%%.*}"
|
||
|
REST="${VERSION#*.*.}"
|
||
|
|
||
|
# Format and output based on MAJOR version
|
||
|
if [[ "$MAJOR" == "2" ]]; then
|
||
|
echo "0.$MINOR.$REST"
|
||
|
elif [[ "$MAJOR" == "3" ]]; then
|
||
|
printf "0.3%02d.$REST\n" "$MINOR"
|
||
|
fi
|