-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from javajosh/check-version
Factor out version check code into a separate script. Call the script…
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Function to check if running on Ubuntu 24.04 or higher | ||
check_ubuntu_version() { | ||
if [ -f /etc/os-release ]; then | ||
. /etc/os-release | ||
if [ "$ID" = "ubuntu" ]; then | ||
if awk -v ver="$VERSION_ID" 'BEGIN {exit !(ver >= 24.04)}'; then | ||
return 0 | ||
else | ||
echo "Error: Ubuntu version must be 24.04 or higher. Current version: $VERSION_ID" >&2 | ||
return 1 | ||
fi | ||
else | ||
echo "Error: This script must be run on Ubuntu. Current OS: $ID" >&2 | ||
return 1 | ||
fi | ||
else | ||
echo "Error: Unable to determine OS. /etc/os-release file not found." >&2 | ||
return 1 | ||
fi | ||
} | ||
|
||
if ! check_ubuntu_version; then | ||
echo "Script execution failed due to system requirements not being met." >&2 | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters