Skip to content

Commit

Permalink
Merge pull request #199 from javajosh/check-version
Browse files Browse the repository at this point in the history
Factor out version check code into a separate script. Call the script…
  • Loading branch information
dhh authored Jul 13, 2024
2 parents f288b63 + a43dfdf commit be7635f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions check-version.sh
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

3 changes: 3 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set -e
# Desktop software and tweaks will only be installed if we're running Gnome
RUNNING_GNOME=$([[ "$XDG_CURRENT_DESKTOP" == *"GNOME"* ]] && echo true || echo false)

# Check the distribution name and version and abort if incompatible
source ~/.local/share/omakub/check-version.sh

if $RUNNING_GNOME; then
# Ensure computer doesn't go to sleep or lock while installing
gsettings set org.gnome.desktop.screensaver lock-enabled false
Expand Down

0 comments on commit be7635f

Please sign in to comment.