-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathostree_remotes
executable file
·83 lines (75 loc) · 2.14 KB
/
ostree_remotes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
set -euo pipefail
# set -x
main() {
versions=(
"40"
"40-testing"
"41"
"41-testing"
"Rawhide"
)
variants=(
"Silverblue"
"Kinoite"
"Sericea"
"Onyx"
)
arches=(
"x86_64"
"aarch64"
)
local date=""
if [[ ${DATE+x} == "x" ]]; then
date="${DATE}"
else
date="$(date "+%Y%m%d")"
fi
local -r summary="$(ostree remote summary fedora)"
local -r red="\e[31m"
local -r blue="\e[34m"
local -r end="\e[0m"
for variant in "${variants[@]}"; do
(
printf "%-10s" "${variant}"
for r in "${versions[@]}"; do
echo -n "|$r"
done
echo ""
for arch in "${arches[@]}"; do
if [[ "${variant}" == "Sericea" && "${arch}" == "ppc64le" ]]; then
continue
fi
if [[ "${variant}" == "Onyx" && "${arch}" != "x86_64" ]]; then
continue
fi
buf=""
for rel in "${versions[@]}"; do
release=${rel%%-*}
branch=${rel##*-}
if [[ -n "${branch}" ]] && [[ "${branch}" != "${release}" ]]; then
branch="/${branch}"
else
branch=""
fi
version="$(echo "${summary}" \
| grep -E "${release,,}/${arch}${branch}/${variant,,}$" -A3 --no-group-separator \
| grep "Version" \
| awk 'NF>1{print $NF}')" \
|| version=""
mainver="${version%.*}"
if [[ "${mainver}" != "${release}.${date}" ]] && [[ "${mainver}" != "${release}.${date}.n" ]]; then
buf+="$(printf "|${red}%-15s${end}" "${version}")"
else
buf+="$(printf "|${blue}%-15s${end}" "${version}")"
fi
done
if [[ "$(echo "${buf}" | tr -d ' ')" != "||||" ]]; then
echo "${arch}${buf}"
fi
done
) | column -t -s "|"
echo ""
done
}
main "${@}"