Skip to content

Commit d558b13

Browse files
committed
added OS Compatible check
1 parent d3d48da commit d558b13

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

installation-scripts/FaveoInstallationScripts/basic-troubleshoot.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,75 @@ if [[ $EUID -ne 0 ]]; then
6363
exit 1
6464
fi
6565

66+
# Root check
67+
if [[ $EUID -ne 0 ]]; then
68+
echo -e "${RED}This script must be run as root${RESET}"
69+
exit 1
70+
fi
71+
72+
# OS & Version check
73+
if [[ -f /etc/os-release ]]; then
74+
. /etc/os-release
75+
else
76+
echo -e "${RED}Unable to detect OS${RESET}"
77+
exit 1
78+
fi
79+
80+
SUPPORTED=true
81+
SUGGESTION=""
82+
83+
case "$ID" in
84+
ubuntu)
85+
# Ubuntu LTS >= 20.04
86+
UB_VER=$(echo "$VERSION_ID" | cut -d. -f1)
87+
if (( UB_VER < 20 )); then
88+
SUPPORTED=false
89+
SUGGESTION="Use Ubuntu 20.04 LTS or newer"
90+
fi
91+
;;
92+
debian)
93+
# Debian LTS >= 11
94+
if (( VERSION_ID < 11 )); then
95+
SUPPORTED=false
96+
SUGGESTION="Use Debian 11 or 12 (LTS)"
97+
fi
98+
;;
99+
rhel)
100+
# RHEL LTS >= 8
101+
RHEL_VER=$(echo "$VERSION_ID" | cut -d. -f1)
102+
if (( RHEL_VER < 8 )); then
103+
SUPPORTED=false
104+
SUGGESTION="Use RHEL 8 or 9 (LTS)"
105+
fi
106+
;;
107+
rocky)
108+
ROCKY_VER=$(echo "$VERSION_ID" | cut -d. -f1)
109+
if (( ROCKY_VER < 8 )); then
110+
SUPPORTED=false
111+
SUGGESTION="Use Rocky Linux 8 or 9 (LTS)"
112+
fi
113+
;;
114+
almalinux)
115+
ALMA_VER=$(echo "$VERSION_ID" | cut -d. -f1)
116+
if (( ALMA_VER < 8 )); then
117+
SUPPORTED=false
118+
SUGGESTION="Use AlmaLinux 8 or 9 (LTS)"
119+
fi
120+
;;
121+
*)
122+
SUPPORTED=false
123+
SUGGESTION="Supported OS: Ubuntu ≥20.04 LTS, Debian 11/12, RHEL/Rocky/Alma 8 or 9"
124+
;;
125+
esac
126+
127+
if [[ "$SUPPORTED" != true ]]; then
128+
echo -e "${RED}Unsupported OS detected:${RESET} $PRETTY_NAME"
129+
echo -e "${YELLOW}Recommendation:${RESET} $SUGGESTION"
130+
exit 1
131+
fi
132+
133+
echo -e "${GREEN}OS check passed:${RESET} $PRETTY_NAME"
134+
66135
# Get script directory for log
67136
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
68137
LOG_FILE="$SCRIPT_DIR/faveo-check.log"

0 commit comments

Comments
 (0)