Skip to content

Commit dc4253e

Browse files
adding pre-update
1 parent 3cac4e0 commit dc4253e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -xeu
4+
5+
6+
export LC_ALL=C
7+
8+
# Lower bound version
9+
min_version="24.9.19"
10+
11+
# Get the current version of pio
12+
current_version=$(sudo -u pioreactor pio version)
13+
14+
# Use sorting to determine if the current version is less than the minimum version
15+
is_valid=$(printf "%s\n%s" "$current_version" "$min_version" | sort -V | head -n1)
16+
17+
# If the smallest version isn't the minimum version, then current version is too low
18+
if [ "$is_valid" != "$min_version" ]; then
19+
sudo -u pioreactor pio log -l ERROR -m "Version error: installed version $current_version is lower than the minimum required version $min_version."
20+
exit 1
21+
fi
22+
23+
echo "Version check passed: $current_version"

0 commit comments

Comments
 (0)