Files
zertifizierung/detect-system.sh
root 6fb1454310 Improve system detection robustness
- Enhanced detect-system.sh with better SSH options
- Added BatchMode and StrictHostKeyChecking=no for automation
- Increased timeout from 5 to 10 seconds
- Explicit exit codes for clarity

- Improved cert-manager.py detection function:
  - Checks if detect script exists before running
  - Validates return code
  - Checks for empty output
  - Better timeout handling (15 seconds)
  - More detailed error messages
  - Handles TimeoutExpired exception separately
2025-10-23 08:32:52 +02:00

32 lines
901 B
Bash
Executable File

#!/bin/bash
# Detect system type on remote host
# Usage: ./detect-system.sh <hostname>
TARGET_HOST="$1"
if [ -z "$TARGET_HOST" ]; then
echo "Usage: $0 <hostname>" >&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