SHTOOL-PLATFORM.TMP(1)

๐Ÿ“ฆ
version 2.0.8 ยท 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

๐Ÿ‘‘ SHTOOL-PLATFORM.TMP(1)

GNU Portable Shell Tool โ€” that's the manual name bestie, keep it in your notes ๐Ÿ’–

okay so before we even get into it: this whole page is about asking your Unix box "who are you actually" and getting a real, structured answer back. it's giving detective energy ๐Ÿ”โœจ


๐ŸŒธ NAME ๐ŸŒธ

shtool-platform โ€” GNU shtool's Unix platform identification. that's the name. short, sweet, iconic ๐Ÿ’…


๐Ÿฆ‹ 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]

ngl -n and -d are literally listed twice up there. not me editing that, that's just how the page is written ๐Ÿ™ˆ


๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

so shtool platform is a flexible Unix platform identification program. it figures out what platform you're on by looking at two things separately: your hardware architecture and your operating system. and for each of those two, there are three separate identifications: a class, a product and a technology. that's six identifications total, and every single one of them comes in a verbose, a regular and a concise flavour.

which means... math time bestie ๐Ÿงฎ โ€” that's eighteen (2x3x3) available identification strings per platform. and out of those eighteen, a given situation usually only wants about 2 of them. so how do you pick? you build the platform identification string yourself with a format string that contains one or more identification constructs, written like this:

  • "%[xx]" โ€” the verbose one
  • "%{xx}" โ€” the regular one
  • "%<xx>" โ€” the concise one

โœจ OPTIONS โœจ

here's everything you can pass it, no skips, no skimming, we're doing all of them ๐Ÿซถ

  • -F, --format format โ€” controls the output formatting of the program. it's a plain-text string stuffed with "%"xx constructs that expand into the various platform info strings. "%{xx}" gives you the canonical regular version of the info, "%[xx]" gives you the verbose version, and "%<xx>" gives you the concise version. in total, these are all the constructs you can expand:
    • %[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

and if you don't pass -F at all, the default format string is "%{sp} (%{ap})" โ€” which hands you the regular operating system product info plus the regular hardware architecture product info. cute and useful ๐Ÿ’–

  • -S, --sep string โ€” sets the word separation string used in the platform info strings. default is " " (whitespace). it's especially the thing separating the operating system name from the operating system version.
  • -C, --conc string โ€” sets the word concatenation string used in the platform info strings. default is "/". it's especially used to glue multiple parts together inside operating system name and version parts.
  • -L, --lower โ€” forces the output to be all lowercase.
  • -U, --upper โ€” forces the output to be all uppercase.
  • -v, --verbose โ€” forces verbose versions of every expansion construct in the format string you gave to -F. it's exactly the same as writing all your expansion constructs as "%[xx]".
  • -c, --concise โ€” forces concise versions of every expansion construct in the format string you gave to -F. it's exactly the same as writing all your expansion constructs as "%<xx>".
  • -n, --no-newline โ€” drops the usual trailing newline character from the output.
  • -t, --type type โ€” the meta option ๐Ÿ‘‘ it internally sets -F, -S, -C, -L, -U, -v or -c depending on TYPE, so you can just name a commonly known output and vibe. these are the TYPEs:

binary

Binary Package Id (OpenPKG RPM). equal to -F '%<ap>-%<sp>' -L -S '' -C '+', and it gives you outputs like ix86-freebsd4.9 and ix86-debian3.0.

build

Build-Time Checking (OpenPKG RPM). equal to -F '%<at>-%<st>' -L -S '' -C '+', and it gives you outputs like i686-freebsd4.9 and i586-linux2.4.

gnu

GNU config.guess Style Id. similar to build, equal to -F '%<at>-unknown-%<st>' -L -S '' -C '+', and it gives you outputs like i686-unknown-freebsd4.9 and i586-unknown-linux2.4.

web

HTTP Server Header Id. equal to -F '%<sp>-%<ac>' -S '/' -C '+', and it gives you outputs like FreeBSD/4.9-iX86 and Debian/3.0-iX86.

summary

Human Readable Verbose Summary Information. equal to -F 'Class: %[sc] (%[ac])\nProduct: %[sp] (%[ap])\nTechnology: %[st] (%[at])' -S ' ' -C '/', and it gives you outputs like:

 Class:      4.4BSD (iX86)
 Product:    FreeBSD 4.9-RC (iX86)
 Technology: FreeBSD 4.9-RC (i686)

and also like:

 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 one literally just dumps out all 2x2x3 identification strings as a table. the whole thing. every crumb ๐Ÿ“

  • -d, --debug โ€” turns on some internal debugging messages.
  • -V, --version โ€” outputs the version information of shtool platform and nothing else.
  • -h, --help โ€” outputs the usage information of shtool platform and nothing else.

๐ŸŒˆ EXAMPLE ๐ŸŒˆ

these are the real-life use cases that are known, bestie, straight from the field:

OpenPKG build-time decisions

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

OpenPKG binary RPM packages

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

README files

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

Debugging

$ platform --type=all-in-one

๐Ÿซถ SUPPORT ๐Ÿซถ

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

every other Unix platform gets recognized through generic uname(1) information, so it usually can be identified sufficiently โ€” although ngl the identification might be not as precise as possible. so like, it works, it's just not doing the detailed thing ๐Ÿ˜Œ


๐Ÿ“œ HISTORY ๐Ÿ“œ

shtool platform was implemented in September 2003 by Ralf S. Engelschall, for use in the OSSP and OpenPKG projects. it got prompted by OpenPKG needing both product identifiers (for RPM filenames) and technology identifiers (for build-time decisions) for the Unix platforms that OpenPKG packages are maintained for. and it was inspired by the GNU config.guess and the old GNU shtool guessos command. lore ๐ŸŽ€

the major difference from GNU config.guess: shtool platform does not use a vendor identification โ€” because it cannot be determined most of the time and is not used at all in all the projects the author has ever seen โ€” and it's a lot more flexible, since it combines class, product and technology identifications with verbose, regular and concise outputs. the drawback? shtool platform (still) knows fewer particular platforms. though the generic platform identification is sufficient enough most of the time, fr fr.


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

uname(3), GNU config.guess.


and that's the whole page bestie!! this version was shtool 2.0.8, dated 18-Jul-2008. go forth and identify platforms, you absolute main character ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from