SYNOPSIS

shtool platform [-F|--format format] [-S|--sep string] [-C|--conc string] [-L|--lower] [-U|--upper] [-v|--verbose] [-c|--concise] [-n|--newline] [-d|--debug] [-t|--type type] [-n|--newline] [-d|--debug]

DESCRIPTION

shtool platform is a flexible Unix platform identification program. It distinguishes a platform according to its hardware architecture and operating system. For both there is a class, product and technology identification. For each of those six identifications, there is a verbose, regular and concise version.

This leads to eighteen (2x3x3) available identification strings for each platform, from which usually 2 are chosen in a particular situation. This is done by assembling the platform identification string using a format string containing one or more identification constructs of the forms "\*(C`%[xx]\*(C'\*(L" (verbose), \*(R"\*(C`%{xx}\*(C'\*(L" (regular) and \*(R"\*(C`%<xx>\*(C'" (concise).

OPTIONS

The following command line options are available.

-F, --format format

This option controls the output formatting of this program. It is a plain-text string with the "\*(C`%\*(C'xx\*(L" constructs which expand to the various platform information strings. \*(R"\*(C`%{\*(C'xx\*(C`}\*(C'\*(L" is the canonical regular version of the information. \*(R"\*(C`%[\*(C'xx\*(C`]\*(C'\*(L" is the verbose version of the information. \*(R"\*(C`%<\*(C'xx\*(C`>\*(C'" is the concise version of the information. In total, the following constructs are available for expansion:

 %[ac]    verbose hardware architecture class
 %{ac}    regular hardware architecture class
 %<ac>    concise hardware architecture class

 %[ap]    verbose hardware architecture product
 %{ap}    regular hardware architecture product
 %<ap>    concise hardware architecture product

 %[at]    verbose hardware architecture technology
 %{at}    regular hardware architecture technology
 %<at>    concise hardware architecture technology

 %[sc]    verbose operating system class
 %{sc}    regular operating system class
 %<sc>    concise operating system class

 %[sp]    verbose operating system product
 %{sp}    regular operating system product
 %<sp>    concise operating system product

 %[st]    verbose operating system technology
 %{st}    regular operating system technology
 %<st>    concise operating system technology

The default format string is "\*(C`%{sp} (%{ap})\*(C'", providing the regular operating system and hardware architecture product information.

-S, --sep string

This option sets the word separation string for the platform information strings. By default it is "\*(C` \*(C'" (whitespace). It is especially used for separating the operating system name and the operating system version.

-C, --conc string

This option sets the word concatenation string for the platform information strings. By default it is "\*(C`/\*(C'". It is especially used to concatenate multiple parts in operating system name and version parts.

-L, --lower

This options enforces conversion of the output to all lower case.

-U, --upper

This options enforces conversion of the output to all upper case.

-v, --verbose

This option enforces verbose versions of all expansion constructs in format string of option -F. It is equal to specifying all expansion constructs as "\*(C`%[\*(C'xx\*(C`]\*(C'".

-c, --concise

This option enforces concise versions of all expansion constructs in format string of option -F. It is equal to specifying all expansion constructs as "\*(C`%<\*(C'xx\*(C`>\*(C'".

-n, --no-newline

This option omits the usual trailing newline character in the output.

-t, --type type

This option is a meta option which internally sets options -F, -S, -C, -L, -U, -v or -c according to \s-1TYPE\s0. It can be used to easily specify various commonly known outputs. The following \s-1TYPE\s0s are available:

binary

Binary Package Id (OpenPKG \s-1RPM\s0). This is equal to "\*(C`-F '%<ap\*(C'-%<sp>' -L -S '' -C '+'>\*(L" and results in outputs like \*(R"\*(C`ix86-freebsd4.9\*(C'\*(L" and \*(R"\*(C`ix86-debian3.0\*(C'".

build

Build-Time Checking (OpenPKG \s-1RPM\s0). This is equal to "\*(C`-F '%<at\*(C'-%<st>' -L -S '' -C '+'>\*(L" and results in outputs like \*(R"\*(C`i686-freebsd4.9\*(C'\*(L" and \*(R"\*(C`i586-linux2.4\*(C'".

gnu

\s-1GNU\s0 config.guess Style Id. This is similar to build and is equal to "\*(C`-F '"%<at\*(C'-unknown-%<st>' -L -S '' -C '+'>\*(L" and results in outputs like \*(R"\*(C`i686-unknown-freebsd4.9\*(C'\*(L" and \*(R"\*(C`i586-unknown-linux2.4\*(C'".

web

\s-1HTTP\s0 Server Header Id. This is equal to "\*(C`-F '"%<sp\*(C'-%<ac>' -S '/' -C '+'>\*(L" and results in outputs like \*(R"\*(C`FreeBSD/4.9-iX86\*(C'\*(L" and \*(R"\*(C`Debian/3.0-iX86\*(C'".

summary

Human Readable Verbose Summary Information. This is equal to "\*(C`-F 'Class: %[sc] (%[ac])\nProduct: %[sp] (%[ap])\nTechnology: %[st] (%[at])' -S ' ' -C '/'\*(C'" and results in outputs like: Class: 4.4BSD (iX86) Product: FreeBSD 4.9-RC (iX86) Technology: FreeBSD 4.9-RC (i686) and Class: LSB (iX86) Product: Debian GNU/Linux 3.0 (iX86) Technology: GNU/Linux 2.2/2.4 (i686)

all-in-one

All-In-One Full-Table Information. This just outputs really all 2x2x3 identification strings as a table.

-d, --debug

This option enables some internal debugging messages.

-V, --version

This option outputs the version information of shtool platform only.

-h, --help

This option outputs the usage information of shtool platform only.

EXAMPLE

The following real-life use cases are known:

OpenPKG build-time decisions

$ platform -c -L -S "" -C "+" -F "%at-%st" $ platform -c -L -S "" -C "+" -F "%ac-%sc"

OpenPKG binary \s-1RPM\s0 packages

$ platform -c -L -S "" -C "+" -F "%ap-%sp"

\s-1README\s0 files

$ platform -v -F "%sp (%ap)" $ platform -v -F "%sc (%ac)"

Debugging

$ platform --type=all-in-one

SUPPORT

shtool platform currently knows the following particular Unix platforms in detail: FreeBSD, NetBSD, OpenBSD, Linux, Sun Solaris, \s-1SCO\s0 UnixWare, \s-1QNX\s0 Neutrino, \s-1SGI\s0 \s-1IRIX\s0, \s-1HP\s0 HP-UX, \s-1HP\s0 Tru64, \s-1IBM\s0 \s-1AIX\s0 and Apple Mac \s-1OS\s0 X Darwin.

All other Unix platforms are recognized through generic uname\|(1) information and so usually can be identified sufficiently, although the identification might be not as precise as possible.

HISTORY

shtool platform was implemented in September 2003 by Ralf S. Engelschall for use in the \s-1OSSP\s0 and OpenPKG projects. It was prompted by the need in OpenPKG to have both product (for \s-1RPM\s0 filenames) and technology (for build-time decisions) identifiers for the Unix platforms, OpenPKG packages are maintained for. It was inspired by the \s-1GNU\s0 config.guess and the old \s-1GNU\s0 shtool guessos command.

The major difference to \s-1GNU\s0 config.guess is that shtool platform does not use a vendor identification (cannot be determined most of the time and is not used at all in all projects I've ever seen) and is a lot more flexible (class, product and technology identifications combined with verbose, regular and concise outputs). The drawback of shtool platform is that it (still) knows less particular platforms, although the generic platform identification is sufficient enough most of the time.

RELATED TO shtool-platform…

uname\|(3), \s-1GNU\s0 config.guess.