#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '== system inventory =='
printf 'host: '; hostname
printf 'kernel: '; uname -sr
printf 'uptime: '; uptime
if command -v sw_vers >/dev/null 2>&1; then
  sw_vers | sed 's/^/macOS: /'
elif [ -r /etc/os-release ]; then
  . /etc/os-release
  printf 'os: %s %s\n' "${NAME:-Linux}" "${VERSION_ID:-}"
fi
printf '\n== storage ==\n'
df -h .
printf '\n== memory ==\n'
if command -v vm_stat >/dev/null 2>&1; then vm_stat | head -n 8; elif command -v free >/dev/null 2>&1; then free -h; else printf '%s\n' 'memory details unavailable on this host'; fi
