A script for working out what OS you are running on as some scripts need to be OS aware.
source os-detect.sh
full_os_detect
echo "OS: $OSD_OS"
echo "DISTRIBUTION: $OSD_DISTRIBUTION"
echo "NAME: $OSD_NAME"
echo "CODENAME: $OSD_CODENAME"
echo "RELEASE: $OSD_RELEASE"
echo "VERSION: $OSD_VERSION"
echo "PLATFORM_VERSION: $OSD_PLATFORM_VERSION"
echo "BASEDON: $OSD_BASEDON"
echo "KERNEL: $OSD_KERNEL"
echo "ARCH: $OSD_ARCH"
source os-detect.sh
detect_distribution
detect_version
echo "DISTRIBUTION: $OSD_DISTRIBUTION"
echo "VERSION: $OSD_VERSION"
The following functions exist:
- detect_os
- detect_kernel
- detect_architecture
- detect_distribution
- detect_name
- detect_version
- detect_platform_version
- detect_release
- detect_codename
- detect_basedon
- full_os_detect
The following environment variables are set:
- OSD_OS
- OSD_DISTRIBUTION
- OSD_NAME
- OSD_CODENAME
- OSD_RELEASE
- OSD_VERSION
- OSD_PLATFORM_VERSION
- OSD_BASEDON
- OSD_KERNEL
- OSD_ARCH
OS: Linux
DISTRIBUTION: almalinux
NAME: AlmaLinux
CODENAME: Arctic Sphynx
RELEASE: 8.5
VERSION: 8.5
PLATFORM VERSION: el-8
BASEDON: rhel centos fedora
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Linux
DISTRIBUTION: alpine
NAME: Alpine Linux
CODENAME: unknown
RELEASE: unknown
VERSION: 3.14.2
PLATFORM VERSION: unknown
BASEDON: unknown
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Linux
DISTRIBUTION: amzn
NAME: Amazon Linux
CODENAME: unknown
RELEASE: 2
VERSION: 2
PLATFORM VERSION: unknown
BASEDON: centos rhel fedora
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Linux
DISTRIBUTION: arch
NAME: Arch Linux
CODENAME: unknown
RELEASE: unknown
VERSION: unknown
PLATFORM VERSION: unknown
BASEDON: unknown
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Linux
DISTRIBUTION: centos
NAME: CentOS Linux
CODENAME: Core
RELEASE: 7.9.2009
VERSION: 7
PLATFORM VERSION: unknown
BASEDON: rhel fedora
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Linux
DISTRIBUTION: debian
NAME: Debian GNU/Linux
CODENAME: bullseye
RELEASE: 11.1
VERSION: 11
PLATFORM VERSION: unknown
BASEDON: debian
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Mac OS
DISTRIBUTION: unknown
NAME: macOS
CODENAME: unknown
RELEASE: 12.2.1
VERSION: unknown
PLATFORM VERSION: unknown
BASEDON: unknown
KERNEL: 21.3.0
ARCH: x86_64
OS: Linux
DISTRIBUTION: ol
NAME: Oracle Linux Server
CODENAME: Ootpa
RELEASE: 8.5
VERSION: 8.5
PLATFORM VERSION: el-8
BASEDON: fedora
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Linux
DISTRIBUTION: photon
NAME: VMware Photon OS
CODENAME: unknown
RELEASE: 4.0
VERSION: 4.0
PLATFORM VERSION: unknown
BASEDON: unknown
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Linux
DISTRIBUTION: rocky
NAME: Rocky Linux
CODENAME: Green Obsidian
RELEASE: 8.5
VERSION: 8.5
PLATFORM VERSION: el-8
BASEDON: rhel centos fedora
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Linux
DISTRIBUTION: scientific
NAME: Scientific Linux
CODENAME: Nitrogen
RELEASE: 7.9
VERSION: 7.9
PLATFORM VERSION: unknown
BASEDON: rhel centos fedora
KERNEL: 5.10.76-linuxkit
ARCH: x86_64
OS: Linux
DISTRIBUTION: ubuntu
NAME: Ubuntu
CODENAME: focal
RELEASE: 20.04
VERSION: 20.04
PLATFORM VERSION: unknown
BASEDON: debian
KERNEL: 5.10.76-linuxkit
ARCH: x86_64