osid
Package: WA2L/edrc 1.5.57
Section: Library Commands (3)
Updated: 10 May 2011
Index
Return to Main Contents
NAME
osid - evaluate the system's operating system id
SYNOPSIS
edrc/lib/osid
[
-h
|
-p
|
-s
|
-e
]
AVAILABILITY
WA2L/edrc
DESCRIPTION
osid
generates an unique identifier for each combination of OS release (
uname -r
) and OS
version (
uname -s
). This identifier is used, particularly by
sysconfig,
to identify the appropriate files for system configuration. Furthermore many
scripts use
osid
to make it compatible to multiple operating systems.
This tool is necessary because the OS alone is not sufficient to uniquely identify
the proper configuration files for an OS. For example, both Solaris 1.x and 2.x call
themselves "SunOS". But because Solaris 1.x is a BSD release and Solaris 2.x is a
System V release, they require completely different configuration files.
To minimize the risk of damaging a future, incompatible release of an existing
operating system, osid will only return a value different from
unknown
if the entry in
osid.dat
exactly matches the values returned by
uname -rs.
If two releases of an Operating System are sufficiently similar (for instance HP-UX
v9.01 and v9.03), they may of course be mapped to the same OSID in
osid.dat.
If the file
/etc/sfi/OSID
exists, the value from this file is returned by
osid.
If this file does not exist, the current OSID is resolved from the
edrc/etc/osid.dat
file.
OPTIONS
- -h
-
print
osid
usage.
- -p
-
print the OSID definitions as an unordered list identical to the sequence
in the
osid.dat
file. This output can also be used to debug the definitions in an
osid.dat
file due to the fact that OSID of the first matching entry will be returned
as the resolved OSID.
- -s
-
print the OSID definitions as an ordered list.
- -e
-
print a line in the
osid.dat
format based on the current operating system. This option helps to
quickly add a line to the related
osid.dat
file. The fields
unknown
and
<Comment>
have to be replaced by the correct values.
EXIT STATUS
- 0
-
the operating system id could be resolved.
- 1
-
the operating system id could not be resolved. In this case
osid
returns
unknown
as OS-id. If you receive this return value you should check
the configuration file
edrc/etc/osid.dat
if the entry for the current operating system is missing. If
two releases on an operating system are sufficient similar, they should
be mapped to the same OS-id.
- 2
-
the option
-p
or
-s
has been invoked.
- 4
-
usage listed.
- 5
-
the option
-e
has been invoked.
EXAMPLES
- 1) HOWTO use osid to write a multiple os compatible script
-
:
:
case "`osid`" in
Solaris)
DF="df -k"
AWK=nawk
ECHO=echo
;;
HP-10|HP-11)
DF="bdf"
AWK=awk
ECHO=echo
;;
Linux)
DF="df -k"
AWK=awk
ECHO="echo -e"
;;
unknown)
echo "example-FATAL: OS not defined"
exit 2
;;
*)
echo "example-FATAL: OS not supported"
exit 2
;;
esac
:
:
cd /
$DF | $AWK '{ printf("%10d | %10d | %s\n", $3, $4, $6)}'
:
:
SEE ALSO
edrcintro(1),
mandir(4),
osid.cfg(4),
osid.dat(4),
osid.probe(3),
rosid(3),
sysconfig(1)
FILES
- /etc/sfi/OSID
-
operating system id on a system configured by
rmtconfig
of the
SFI-Director.
- edrc/etc/osid.cfg
-
optional configuration file for
osid.
See
osid.cfg(4)
for more information.
- edrc/etc/osid.dat
-
mapfile of
uname -rs
or
uname -rsm
to OS-id. See
osid.dat(4)
for more information.
- edrc/lib/OSID/osid.probe
-
the
osid.probe
command is a C-program that is compiled for each OSID. It is used
to probe if the binary related to the resolved OSID is able to run
on the system. If the
osid.probe
binary can't be executed it is assumed that also the other binaries
related to the OSID aren't compatible to the system architecture and
unknown
is returned by the
osid
command
If the
osid.probe
command does not exist the binary compatibility is not checked.
NOTES
Parts of this manpage were extracted from the documentation of
the
SFI-Director
and modified to fit to the
WA2L/edrc
package. See
http://sfidirector.sourceforge.net
for more information about the
SFI-Director.
Due to the fact that certain operating system vendors started to
distribute identical operating system releases (
uname -r
) on different platforms, the need came up to even distinguish
within identical operating system releases between the platforms.
Therefore the machine (hardware) type (
uname -m
) can be considered too. This lead into an extended format
of the
osid.dat
file, that usage can be configured in the
osid.cfg
configuration file, if needed.
BUGS
-
AUTHOR
osid was initially developed by Peter Stevens. The version included in
WA2L/edrc
has been rewritten by Christian Walther. Send suggestions
and bug reports to wa2l@users.sourceforge.net .
COPYRIGHT
Copyright © 2011
Christian Walther
This is free software; see
edrc/doc/COPYING
for copying conditions. There is ABSOLUTELY NO WARRANTY; not
even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This document was created by man2html
using the manual pages.
Time: 00:14:15 GMT, March 08, 2025