Skip to content

Commit 2ec4e57

Browse files
committed
added compare-apt-repo-versions script
1 parent df1c1eb commit 2ec4e57

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

hack/compare-apt-repo-versions.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
SCRIPT_NAME="${0##*/}"
5+
readonly SCRIPT_NAME
6+
7+
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
8+
readonly SCRIPT_DIR
9+
10+
usage() {
11+
echo "Script to compare the apt repo version of two Garden Linux releases."
12+
echo "Usage: $SCRIPT_NAME VERSION_A VERSION_B"
13+
echo "Example: $SCRIPT_NAME 1443.10 1587.0"
14+
exit 1
15+
}
16+
17+
main() {
18+
[[ $# -ge 2 ]] || usage
19+
[[ -n "$1" ]] || usage
20+
[[ -n "$2" ]] || usage
21+
local VERSION_A="${1}"; shift
22+
local VERSION_B="${1}"; shift
23+
24+
TEMP_DIR=$(mktemp -d)
25+
26+
trap 'rm -rf $TEMP_DIR' EXIT
27+
28+
curl -s https://packages.gardenlinux.io/gardenlinux/dists/"$VERSION_A"/main/binary-amd64/Packages.gz | gunzip > "$TEMP_DIR"/GardenLinux-"$VERSION_A"
29+
curl -s https://packages.gardenlinux.io/gardenlinux/dists/"$VERSION_B"/main/binary-amd64/Packages.gz | gunzip > "$TEMP_DIR"/GardenLinux-"$VERSION_B"
30+
31+
python3 "$SCRIPT_DIR"/parse-aptsource.py "$TEMP_DIR"/GardenLinux-"$VERSION_A" > "$TEMP_DIR"/"$VERSION_A"
32+
python3 "$SCRIPT_DIR"/parse-aptsource.py "$TEMP_DIR"/GardenLinux-"$VERSION_B" > "$TEMP_DIR"/"$VERSION_B"
33+
34+
pushd "$TEMP_DIR" > /dev/null
35+
36+
diff -U 0 --minimal "$VERSION_A" "$VERSION_B" | grep -v '^@'
37+
38+
popd > /dev/null
39+
}
40+
41+
main "${@}"
42+

0 commit comments

Comments
 (0)