Skip to content

Commit

Permalink
fix: version compatibility checker
Browse files Browse the repository at this point in the history
	modified:   erpnext_install.sh
  • Loading branch information
flexy2ky committed May 20, 2023
1 parent bff1814 commit 4492c0a
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions erpnext_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,27 @@ SUPPORTED_VERSIONS=("22.04" "20.04" "11" "10" "9" "8")
check_os() {
local os_name=$(lsb_release -is)
local os_version=$(lsb_release -rs)
for i in "${!SUPPORTED_DISTRIBUTIONS[@]}"; do
if [[ "${SUPPORTED_DISTRIBUTIONS[$i]}" = "$os_name" ]] && [[ "${SUPPORTED_VERSIONS[$i]}" = "$os_version" ]]; then
return 0
local os_supported=false
local version_supported=false

for i in "${SUPPORTED_DISTRIBUTIONS[@]}"; do
if [[ "$i" = "$os_name" ]]; then
os_supported=true
break
fi
done

for i in "${SUPPORTED_VERSIONS[@]}"; do
if [[ "$i" = "$os_version" ]]; then
version_supported=true
break
fi
done
echo -e "${RED}This script is not compatible with your operating system.${NC}"
exit 1

if [[ "$os_supported" = false ]] || [[ "$version_supported" = false ]]; then
echo -e "${RED}This script is not compatible with your operating system or its version.${NC}"
exit 1
fi
}

check_os
Expand Down Expand Up @@ -93,6 +107,7 @@ ask_twice() {
fi
done
}
echo -e "\n"
echo -e "${LIGHT_BLUE}Welcome to the ERPNext Installer...${NC}"
echo -e "\n"
sleep 3
Expand Down Expand Up @@ -133,8 +148,10 @@ py_major=$(echo "$py_version" | cut -d '.' -f 1)
py_minor=$(echo "$py_version" | cut -d '.' -f 2)

if [ -z "$py_version" ] || [ "$py_major" -lt 3 ] || [ "$py_major" -eq 3 -a "$py_minor" -lt 10 ]; then
echo -e "${LIGHT_BLUE}It appears this instance does not meet the minimum Python version required for ERPNext 14 (Python3.10)... Not to worry, we will sort it out for you${NC}"
sleep 3
echo -e "${LIGHT_BLUE}It appears this instance does not meet the minimum Python version required for ERPNext 14 (Python3.10)...${NC}"
sleep 2
echo -e "${YELLOW}Not to worry, we will sort it out for you${NC}"
sleep 4
echo -e "${YELLOW}Installing Python 3.10+...${NC}"
sleep 2

Expand Down

0 comments on commit 4492c0a

Please sign in to comment.