From 432c8bc9d1f3048cb81335189eb20c7f3eeedc3c Mon Sep 17 00:00:00 2001 From: Ilia Rostovtsev Date: Sat, 23 Oct 2021 00:03:42 +0300 Subject: [PATCH] Add Oracle Linux detection --- slib.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/slib.sh b/slib.sh index 3731aa5..6991b3c 100644 --- a/slib.sh +++ b/slib.sh @@ -430,7 +430,7 @@ setconfig () { # Detect the primary IP address # works across most Linux and FreeBSD (maybe) detect_ip () { - defaultdev=$(ip ro ls|grep default|awk '{print $5}') + defaultdev=$(ip ro ls|grep default|head -1|awk '{print $5}') primaryaddr=$(ip -f inet addr show dev "$defaultdev" | grep 'inet ' | awk '{print $2}' | cut -d"/" -f1 | cut -f1) if [ "$primaryaddr" ]; then log_debug "Primary address detected as $primaryaddr" @@ -518,7 +518,14 @@ get_distro () { os=$(uname -o) # Make sure we're Linux if echo "$os" | grep -iq linux; then - if [ -f /etc/redhat-release ]; then # RHEL/CentOS + if [ -f /etc/oracle-release ]; then # Oracle + local os_string + os_string=$(cat /etc/oracle-release) + os_real='Oracle Linux' + os_type='ol' + os_version=$(echo "$os_string" | grep -o '[0-9\.]*') + os_major_version=$(echo "$os_version" | cut -d '.' -f1) + elif [ -f /etc/redhat-release ]; then # RHEL/CentOS/Alma/Rocky local os_string os_string=$(cat /etc/redhat-release) isrhel=$(echo "$os_string" | grep 'Red Hat')