#!/usr/bin/env bash # Lightweight banner for BadAI host system — Ubuntu with AMDGPU drivers oem_info() { local v="" m="" d lv lm for d in /sys/class/dmi/id /sys/devices/virtual/dmi/id; do [[ -r "$d/sys_vendor" ]] && v=$(<"$d/sys_vendor") [[ -r "$d/product_name" ]] && m=$(<"$d/product_name") [[ -n "$v" || -n "$m" ]] && break done # ARM/SBC fallback if [[ -z "$v" && -z "$m" && -r /proc/device-tree/model ]]; then tr -d '\0' /dev/null 2>&1; then name=$(lspci -nn 2>/dev/null | grep -Ei 'vga|display|gpu' | grep -i amd | head -n1 | cut -d: -f3-) fi name=$(printf '%s' "$name" | sed -e 's/^[[:space:]]\+//' -e 's/[[:space:]]\+$//' -e 's/[[:space:]]\{2,\}/ /g') printf '%s\n' "${name:-Unknown AMD GPU}" } ubuntu_version() { lsb_release -d 2>/dev/null | cut -f2 || uname -a } system_load() { uptime | awk -F'load average:' '{ print $2 }' | sed 's/,//g' } memory_usage() { free -h | awk 'NR==2{printf "%.0f%%", $3*100/$2 }' } updates_info() { if command -v apt >/dev/null 2>&1; then local upgradable=$(apt list --upgradable 2>/dev/null | grep -v '^Listing' | grep -c '^[^/]*$') local security=$(apt list --upgradable 2>/dev/null | grep -c 'security') printf '%d updates can be applied immediately.\n' "$upgradable" if [[ $security -gt 0 ]]; then printf '%d additional security updates can be applied.\n' "$security" fi else printf 'Updates info not available.\n' fi } MACHINE="$(oem_info)" GPU="$(gpu_name)" UBUNTU_VER="$(ubuntu_version)" LOAD="$(system_load)" MEM="$(memory_usage)" echo cat <<'ASCII' __________ .___ _____ .___ \______ \_____ __| _/ / _ \ | | | | _/\__ \ / __ | / /_\ \| | | | \ / __ \_/ /_/ | / | \ | |______ /(____ /\____ | \____|__ /___| \/ \/ \/ \/ B A D A I - H O S T ( U B U N T U , A M D G P U ) ASCII echo "--------------------------------------------------------------------------------" printf 'Machine: %s\n' "$MACHINE" printf 'GPU : %s\n' "$GPU" printf 'OS : %s\n' "$UBUNTU_VER" printf 'Load : %s\n' "$LOAD" printf 'Memory : %s\n' "$MEM" echo echo "--------------------------------------------------------------------------------" updates_info echo echo "--------------------------------------------------------------------------------" printf 'Usage:\n' printf ' - %-24s → %s\n' "podman ps" "List running containers" printf ' - %-24s → %s\n' "podman logs " "View container logs" printf ' - %-24s → %s\n' "podman exec -it bash" "Access container shell" printf ' - %-24s → %s\n' "radentop" "Monitor AMD GPU usage (if installed)" printf ' - %-24s → %s\n' "htop" "Monitor system processes and resources" printf ' - %-24s → %s\n' "badai restart" "Restart all services" printf ' - %-24s → %s\n' "badai help" "Show BadAI commands"