diff --git a/lib/os.lib.sh b/lib/os.lib.sh index 3972114..48ea6a5 100644 --- a/lib/os.lib.sh +++ b/lib/os.lib.sh @@ -19,23 +19,23 @@ zaf_configure_os_freebsd() { zaf_detect_system() { if which dpkg >/dev/null; then ZAF_PKG=dpkg - ZAF_OS=$(lsb_release -is|tr '[:upper:]' '[:lower:]') - ZAF_OS_CODENAME=$(lsb_release -cs|tr '[:upper:]' '[:lower:]') + ZAF_OS=$(lsb_release -is|zaf_tolower) + ZAF_OS_CODENAME=$(lsb_release -cs|zaf_tolower) ZAF_CURL_INSECURE=0 ZAF_AGENT_PKG="zabbix-agent" return else if which rpm >/dev/null; then ZAF_PKG="rpm" - ZAF_OS=$(lsb_release -is|tr '[:upper:]' '[:lower:]') - ZAF_OS_CODENAME=$(lsb_release -cs|tr '[:upper:]' '[:lower:]') + ZAF_OS=$(lsb_release -is|zaf_tolower) + ZAF_OS_CODENAME=$(lsb_release -cs|zaf_tolower) ZAF_CURL_INSECURE=0 ZAF_AGENT_PKG="zabbix-agent" return else if which opkg >/dev/null; then ZAF_PKG="opkg" . /etc/openwrt_release - ZAF_OS="$(echo $DISTRIB_ID|tr '[:upper:]' '[:lower:]')" - ZAF_OS_CODENAME="$(echo $DISTRIB_CODENAME|tr '[:upper:]' '[:lower:]')" + ZAF_OS="$(echo $DISTRIB_ID|zaf_tolower)" + ZAF_OS_CODENAME="$(echo $DISTRIB_CODENAME|zaf_tolower)" return else if which pkg >/dev/null; then ZAF_PKG="pkg" diff --git a/lib/zaf.lib.sh b/lib/zaf.lib.sh index b0c90f3..00d74f7 100644 --- a/lib/zaf.lib.sh +++ b/lib/zaf.lib.sh @@ -340,4 +340,11 @@ zaf_remove_plugin() { rm -f ${ZAF_AGENT_CONFIGD}/zaf_${plugin}.conf } +zaf_tolower() { + tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' +} + +zaf_toupper() { + tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +}