|
1 | 1 | #!/usr/bin/env bash |
2 | 2 | # scripts/resolve-lqx-version.sh — resolve the latest Liquorix/Zen kernel version |
3 | 3 | # |
4 | | -# Queries the damentz/liquorix-package GitHub releases API and prints the |
5 | | -# most recent KERNEL_MAJOR-LQX_REL string (e.g. "6.12.1-1"). |
| 4 | +# Queries the damentz/liquorix-package GitHub tags API and prints the most |
| 5 | +# recent KERNEL_MAJOR-LQX_REL string (e.g. "6.19-6"). |
6 | 6 | # Falls back to a hardcoded value if the API is unreachable. |
7 | 7 | # |
8 | | -# Output format: KERNEL_MAJOR-LQX_REL (e.g. 6.12.1-1) |
| 8 | +# Output format: KERNEL_MAJOR-LQX_REL (e.g. 6.19-6) |
9 | 9 |
|
10 | 10 | set -euo pipefail |
11 | 11 |
|
12 | | -FALLBACK_VERSION="6.12.1-1" |
13 | | -API_URL="https://api.github.com/repos/damentz/liquorix-package/releases/latest" |
| 12 | +FALLBACK_VERSION="6.19-6" |
| 13 | +# Liquorix publishes tags only — no GitHub Releases |
| 14 | +TAGS_API="https://api.github.com/repos/damentz/liquorix-package/tags?per_page=10" |
14 | 15 |
|
15 | 16 | if ! command -v curl &>/dev/null; then |
16 | 17 | echo "${FALLBACK_VERSION}" |
17 | 18 | exit 0 |
18 | 19 | fi |
19 | 20 |
|
20 | | -response=$(curl -sf --max-time 10 "${API_URL}" 2>/dev/null) || { |
| 21 | +response=$(curl -sf --max-time 10 "${TAGS_API}" 2>/dev/null) || { |
21 | 22 | echo "${FALLBACK_VERSION}" |
22 | 23 | exit 0 |
23 | 24 | } |
24 | 25 |
|
25 | | -# Tag format is typically "MAJOR-REL" e.g. "6.12.1-1" |
| 26 | +# Tags are returned newest-first; pick the first one matching MAJOR-REL format |
26 | 27 | tag="" |
27 | 28 | if command -v jq &>/dev/null; then |
28 | | - tag=$(echo "${response}" | jq -r '.tag_name // empty' 2>/dev/null) |
| 29 | + tag=$(echo "${response}" | jq -r '.[].name' 2>/dev/null \ |
| 30 | + | grep -E '^[0-9]+\.[0-9]+-[0-9]+$' | head -1) |
29 | 31 | else |
30 | | - tag=$(echo "${response}" | grep -o '"tag_name":"[^"]*"' | cut -d'"' -f4) |
| 32 | + tag=$(echo "${response}" | grep -o '"name":"[^"]*"' | cut -d'"' -f4 \ |
| 33 | + | grep -E '^[0-9]+\.[0-9]+-[0-9]+$' | head -1) |
31 | 34 | fi |
32 | 35 |
|
33 | 36 | if [[ -n "${tag}" ]]; then |
|
0 commit comments