From 3df7678d120ac4e05b7a3cd357d603f644854042 Mon Sep 17 00:00:00 2001 From: Samuel Verschelde Date: Fri, 7 May 2021 14:36:07 +0200 Subject: [PATCH] Add support for FreePBX (sangoma) in xe-linux-distribution Based on https://github.com/xenserver/xe-guest-utilities/pull/57 Signed-Off-By: Samuel Verschelde --- mk/xe-linux-distribution | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/mk/xe-linux-distribution b/mk/xe-linux-distribution index 441d6ed..8ab618b 100755 --- a/mk/xe-linux-distribution +++ b/mk/xe-linux-distribution @@ -364,6 +364,35 @@ identify_asianux() write_to_output "${distro}" "${major}" "${minor}" "$(head -n 1 ${asianux_release})" } +identify_sangoma() +{ + sangoma_release="$1" + local distro + local major + local minor + + # distro + # 'Sangoma Linux (FreePBX)' + + if [ ! -f "${sangoma_release}" ] ; then + return 1 + fi + + eval $(sed -rn \ + 's/^Sangoma Linux release ([0-9]*)\.([0-9]*).*$/distro=sangoma;major=\1;minor=\2/gp;' \ + "${sangoma_release}") + + if [ -z "${major}" -o -z "${distro}" ] ; then + return 1 + fi + + if [ -z "${minor}" ] ; then + minor=0 + fi + + write_to_output "${distro}" "${major}" "${minor}" "$(head -n 1 ${sangoma_release})" +} + identify_turbo() { turbo_release="$1" @@ -520,6 +549,7 @@ if [ -z "${TEST}" ] ; then identify_redhat /etc/almalinux-release && exit 0 identify_redhat /etc/centos-release && exit 0 identify_redhat /etc/redhat-release && exit 0 + identify_sangoma /etc/centos-release && exit 0 #identify SuSE-release before, as previous version of SUSE or other distros also have os-release identify_sles /etc/SuSE-release && exit 0 identify_sles /etc/os-release && exit 0