1
0
mirror of https://github.com/librenms/librenms-agent.git synced 2024-05-09 09:54:52 +00:00

Fix distro for FreeBSD/FreeNAS (#335)

Check if /etc/version file present for FreeBSD OS
Without fix on FreeBSD: ./distro
cat: /etc/version: No such file or directory
FreeBSD 12.1-RELEASE-p5 amd64 GENERIC
This commit is contained in:
Laurent Cheylus
2020-10-10 12:49:14 +02:00
committed by GitHub
parent 045a506d1c
commit 144dff530b

View File

@@ -139,9 +139,11 @@ elif [ "${OS}" = "Darwin" ] ; then
fi
elif [ "${OS}" = "FreeBSD" ] ; then
DIST=$(cat /etc/version | cut -d'-' -f 1)
if [ "${DIST}" = "FreeNAS" ]; then
OSSTR=`cat /etc/version | cut -d' ' -f 1`
if [ -f /etc/version ] ; then
DIST=$(cat /etc/version | cut -d'-' -f 1)
if [ "${DIST}" = "FreeNAS" ]; then
OSSTR=`cat /etc/version | cut -d' ' -f 1`
fi
else
OSSTR=`/usr/bin/uname -mior`
fi