whoru is a command line tool that query name/version/arch of a linux distribution. it's like whoami, which query the uid/name/group of a user.
whoru github - https://github.com/zixia/whoru
- WHORU_DIST = distribution name
- WHORU_VER = version
- WHORU_ARCH = architecture
$ eval $(curl -s https://raw.githubusercontent.com/zixia/whoru/master/whoru | bash -)
$ echo $WHORU_{DIST,VER,ARCH}
will output (in this case we ran inside ubuntu)
ubuntu 14 x86_64
Copy whoru
file to /usr/local/bin, or anywhere that PATH could find.
whoru use bats and docker to test itself.
$ bats test
will run a full test on every distributions and versions defined in the test directory.
$ bats test/
✓ CentOS 5
✓ CentOS 6
- CentOS 7 (skipped: not support yet)
- Debian 6 (skipped: not support yet)
✓ Debian 7
✓ Debian 8
✓ Fedora 20
✓ Fedora 21
✓ Fedora 22
✓ Ubuntu 12.04
✓ Ubuntu 13.04
✓ Ubuntu 14.04
✓ Ubuntu 15.04
✓ Ubuntu 15.10
14 tests, 0 failures, 2 skipped
BATS(Bash Automated Testing System) is a bash implementation of TAP(Test Anything Protol)
$ BATS_VERSION=0.4.0 \
curl -s -L "https://github.com/sstephenson/bats/archive/v${BATS_VERSION}.tar.gz"
| tar zxv
&& bats-${BATS_VERSION}/install.sh /usr/local
From now, whoru is very simple and only support very limited linux distribution, for example: redhat, fedora, centos, debian, mac os .
contribution is very welcome.
LI Zhuohuan zixia@zixia.net (https://github.com/zixia)
- Code & Documentation 2015© zixia
- Code released under the Apache 2.0 license
- Docs released under Creative Commons.