mirror of
https://github.com/openhwgroup/cvw
synced 2025-01-23 13:04:28 +00:00
Update distro check print formatting
This commit is contained in:
parent
8e546dacf5
commit
c6bd7bbefc
@ -41,32 +41,36 @@ ENDC='\033[0m' # Reset to default color
|
||||
# Print section header
|
||||
section_header() {
|
||||
if tput cols > /dev/null 2>&1; then
|
||||
printf "${SECTION_COLOR}%$(tput cols)s" | tr ' ' '#'
|
||||
printf "%$(tput cols)s" | tr ' ' '#'
|
||||
echo -e "$1"
|
||||
printf "%$(tput cols)s" | tr ' ' '#'
|
||||
printf "%$(tput cols)s${ENDC}" | tr ' ' '#'
|
||||
printf "${SECTION_COLOR}%$(tput cols)s\n" | tr ' ' '#'
|
||||
printf "%$(tput cols)s\n" | tr ' ' '#'
|
||||
printf "%s\n" "$1"
|
||||
printf "%$(tput cols)s\n" | tr ' ' '#'
|
||||
printf "%$(tput cols)s${ENDC}\n" | tr ' ' '#'
|
||||
else
|
||||
echo -e "${SECTION_COLOR}$1${ENDC}"
|
||||
printf "${SECTION_COLOR}%s\n${ENDC}" "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
section_header "Checking System Requirements and Configuring Installation"
|
||||
|
||||
# Get distribution information
|
||||
test -e /etc/os-release && os_release="/etc/os-release" || os_release="/usr/lib/os-release"
|
||||
source "$os_release"
|
||||
if [ -f /etc/os-release ]; then
|
||||
source /etc/os-release
|
||||
else
|
||||
printf "${FAIL_COLOR}%s\n${ENDC}" "/etc/os-release file not found. Distribution unknown."
|
||||
PRETTY_NAME=UNKNOWN
|
||||
fi
|
||||
|
||||
# Check for compatible distro
|
||||
if [[ "$ID" == rhel || "$ID_LIKE" == *rhel* ]]; then
|
||||
export FAMILY=rhel
|
||||
if [ "$ID" != rhel ] && [ "$ID" != rocky ] && [ "$ID" != almalinux ]; then
|
||||
printf "${WARNING_COLOR}%s\n${ENDC}" "For Red Hat family distros, the Wally install script has only been tested on RHEL, Rocky Linux," \
|
||||
printf "${WARNING_COLOR}%s%s\n${ENDC}" "For Red Hat family distros, the Wally install script has only been tested on RHEL, Rocky Linux," \
|
||||
" and AlmaLinux. Your distro is $PRETTY_NAME. The regular Red Hat install will be attempted, but there may be issues."
|
||||
fi
|
||||
export RHEL_VERSION="${VERSION_ID:0:1}"
|
||||
if (( RHEL_VERSION < 8 )); then
|
||||
echo "${FAIL_COLOR}The Wally install script is only compatible with versions 8 and 9 of RHEL, Rocky Linux, and AlmaLinux. You have version $VERSION.${ENDC}"
|
||||
printf "${FAIL_COLOR}%s\n${ENDC}" "The Wally install script is only compatible with versions 8 and 9 of RHEL, Rocky Linux, and AlmaLinux. You have version $VERSION."
|
||||
exit 1
|
||||
fi
|
||||
elif [[ "$ID" == ubuntu || "$ID_LIKE" == *ubuntu* ]]; then
|
||||
@ -77,16 +81,16 @@ elif [[ "$ID" == ubuntu || "$ID_LIKE" == *ubuntu* ]]; then
|
||||
fi
|
||||
export UBUNTU_VERSION="${VERSION_ID:0:2}"
|
||||
if (( UBUNTU_VERSION < 20 )); then
|
||||
echo "${FAIL_COLOR}The Wally install script has only been tested with versions 20.04 LTS, 22.04 LTS, and 24.04 LTS of Ubuntu. You have version $VERSION.${ENDC}"
|
||||
printf "${FAIL_COLOR}%s\n${ENDC}" "The Wally install script has only been tested with Ubuntu versions 20.04 LTS, 22.04 LTS, and 24.04 LTS. You have version $VERSION."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
printf "${FAIL_COLOR}%s\n${ENDC}" "The Wally install script is currently only compatible with Ubuntu and Red Hat family " \
|
||||
printf "${FAIL_COLOR}%s%s%s\n${ENDC}" "The Wally install script is currently only compatible with Ubuntu and Red Hat family " \
|
||||
"(RHEL, Rocky Linux, or AlmaLinux) distros. Your detected distro is $PRETTY_NAME. You may try manually running the " \
|
||||
"commands in this script, but it is likely that some will need to be altered."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${OK_COLOR}${UNDERLINE}Detected information${ENDC}"
|
||||
printf "${OK_COLOR}${UNDERLINE}%s\n${ENDC}" "Detected information"
|
||||
echo "Distribution: $PRETTY_NAME"
|
||||
echo "Version: $VERSION"
|
||||
|
Loading…
Reference in New Issue
Block a user