A rather general-purpose way to check for *nix is to cat /etc/issue.net, which 
is the login-banner for a remote shell connection.  These usually default to a 
line with the OS version and hostname, printed before the login prompt.


-----Original Message-----
From: owner-amanda-us...@amanda.org [mailto:owner-amanda-us...@amanda.org] On 
Behalf Of Greg Troxel
Sent: Monday, January 19, 2015 19:28
To: Eric Schnoebelen
Cc: Jean-Louis Martineau; amanda-users@amanda.org
Subject: Re: sw_vers not found on FreeBSD


e...@cirr.com (Eric Schnoebelen) writes:

> Jean-Louis Martineau writes:

> - selfcheck try to return the distro and version of the OS.
> - How can it get that information on freebsd? or other bsd?
> - How to get the 'FreeBSD' string and the '10.1' string?
>
>       uname -s -> 'FreeBSD'/'NetBSD'/'OpenBSD'/'DragonFlyBSD'
>       uname -r -> '10.1'/'6.1_STABLE'/...
>
> "uname -s" provides the system name, and "uname -r" provides the OS 
> revision (on every UNIX family system except Linux, where they return 
> "Linux" and the kernel revision.  A side effect of how Linux 
> distributions are created.)

Note that uname is specified by POSIX:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/uname.html

So really, uname output should be used first, and if there needs to be some 
Linux-specific extra information because of "distributions", that should be 
special-case code for Linux.

FWIW, uname -s and -r on a NetBSD box:

NetBSD
6.1_STABLE

Reply via email to