upstream: https://github.com/avsm/osrelease
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add missing READMEs; expand short ones

New READMEs for: ocaml-auth, ocaml-cose, ocaml-http, ocaml-osv,
ocaml-rego, ocaml-scitt, ocaml-sigstore, ocaml-vec3.

Expanded: ca-certs (7→40 lines), osrelease (8→45 lines).

Each includes: synopsis, installation, usage example, API overview,
and license. Skipped ocaml-cel and ocaml-chor (no code yet).

+39 -5
+39 -5
README.md
··· 1 - ## osrelease - detect system and distro information in OCaml 1 + ## osrelease -- detect operating system, distro, and version information 2 2 3 - **Status: WIP** 3 + Detect the local system's architecture, operating system, distribution, and 4 + version from OCaml. Works by inspecting environment variables and running 5 + system commands such as `uname` and reading `/etc/os-release`. 4 6 5 - This library is used to detect local information about 6 - which operating system, architecture, distribution and 7 - version the program is running under. 7 + ## Installation 8 8 9 + ``` 10 + opam install osrelease 11 + ``` 12 + 13 + ## Usage 14 + 15 + ```ocaml 16 + let arch = Osrelease.Arch.v () in 17 + let os = Osrelease.OS.v () in 18 + Format.printf "Running on %a / %a\n" Osrelease.OS.pp os Osrelease.Arch.pp arch; 19 + match Osrelease.Distro.v () with 20 + | Ok distro -> Format.printf "Distro: %a\n" Osrelease.Distro.pp distro 21 + | Error (`Msg msg) -> Format.eprintf "Detection failed: %s\n" msg 22 + ``` 23 + 24 + ## API 25 + 26 + - `Osrelease.Arch.v ()` -- current CPU architecture (`X86_64`, `Aarch64`, `Arm32`, `Ppc64`, etc.) 27 + - `Osrelease.OS.v ()` -- operating system (`Linux`, `MacOS`, `FreeBSD`, `Win32`, etc.) 28 + - `Osrelease.Distro.v ()` -- distribution (`Ubuntu`, `Debian`, `Alpine`, `Fedora`, `Homebrew`, etc.) 29 + - `Osrelease.Distro.os_release_field key` -- read a field from `/etc/os-release` 30 + - `Osrelease.Version.v ()` -- OS version string 31 + 32 + All modules provide `to_string`, `of_string`, and `pp` functions. 33 + 34 + ## Supported Platforms 35 + 36 + Linux (Alpine, Arch, CentOS, Debian, Fedora, Gentoo, NixOS, OpenSUSE, Oracle 37 + Linux, RHEL, Ubuntu, Android), macOS (Homebrew, MacPorts), FreeBSD, OpenBSD, 38 + DragonFly, Cygwin, Win32. 39 + 40 + ## License 41 + 42 + ISC