#!/bin/bash # Detect system type on remote host # Usage: ./detect-system.sh TARGET_HOST="$1" if [ -z "$TARGET_HOST" ]; then echo "Usage: $0 " >&2 exit 1 fi # SSH options for faster connection SSH_OPTS="-o ConnectTimeout=10 -o BatchMode=yes -o StrictHostKeyChecking=no" # Try to detect system type if ssh $SSH_OPTS root@${TARGET_HOST} "test -f /usr/bin/pvesh" 2>/dev/null; then echo "proxmox" exit 0 elif ssh $SSH_OPTS root@${TARGET_HOST} "test -f /usr/local/bin/freenas-version || test -f /usr/local/bin/truenas-version" 2>/dev/null; then echo "truenas" exit 0 elif ssh $SSH_OPTS root@${TARGET_HOST} "test -f /usr/local/sbin/pfSsh.php" 2>/dev/null; then echo "pfsense" exit 0 elif ssh $SSH_OPTS root@${TARGET_HOST} "test -f /usr/sbin/univention-config-registry" 2>/dev/null; then echo "ucs" exit 0 else echo "unknown" exit 0 fi