Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xyproto/distrodetector
:card_index: Detect which Linux distro, macOS or BSD version a system is running.
https://github.com/xyproto/distrodetector
bsd detection linux macos python-distro system
Last synced: 3 months ago
JSON representation
:card_index: Detect which Linux distro, macOS or BSD version a system is running.
- Host: GitHub
- URL: https://github.com/xyproto/distrodetector
- Owner: xyproto
- License: bsd-3-clause
- Created: 2018-11-05T13:39:35.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2023-12-04T15:41:49.000Z (about 1 year ago)
- Last Synced: 2024-10-05T15:25:02.656Z (3 months ago)
- Topics: bsd, detection, linux, macos, python-distro, system
- Language: Go
- Homepage:
- Size: 62.5 KB
- Stars: 20
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# distrodetector
[![GoDoc](https://godoc.org/github.com/xyproto/distrodetector?status.svg)](http://godoc.org/github.com/xyproto/distrodetector) [![License](http://img.shields.io/badge/license-BSD-green.svg?style=flat)](https://raw.githubusercontent.com/xyproto/distrodetector/master/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/xyproto/distrodetector)](https://goreportcard.com/report/github.com/xyproto/distrodetector)
Detects which Linux distro or BSD a system is running.
This is also a drop-in replacement for the `distro` command that comes with `python-distro`.
Aims to detect:
* The 100 most popular Linux distros and BSDs, according to distrowatch
* macOSThe `distro` utility and the `distrodetector` package has no external dependencies.
Pull requests for additional systems are welcome!
## Installation of the distro utility
Installation of the development version of the `distro` utility:
go install github.com/xyproto/distrodetector/cmd/distro@latest
Example use:
distro
## Use of the Go package
```go
package mainimport (
"fmt"
"github.com/xyproto/distrodetector"
)func main() {
distro := distrodetector.New()
fmt.Println(distro.Name())
}
```
## Example outputThe parts can be retrieved separately with `.Platform()`, `.Name()`, `.Codename()` and `.Version()`. A combined string can be returned with the `.String()` function:
Linux (Arch Linux)
Linux (Ubuntu Bionic 18.04)
macOS (High Sierra 10.13.3)
Linux (Void Linux)## Testing
* More testing is always needed when detecting Linux distros and BSDs.
* Please test the distro detection on your distro/BSD and submit an issue or pull request if it should fail.## General Info
* License: BSD-3
* Version: 1.3.1
* Author: Alexander F. Rødseth <[email protected]>