chore: bootstrap lean sysadmin-chronicles repo
Import the runnable game code, content, docs, scripts, and repo guidance while leaving local agent state, dependency installs, build output, and backup copies out of the published tree.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# detect-viewer-backends.sh — Detect which VM viewer backends are available.
|
||||
#
|
||||
# Outputs a line for each detected backend: "vnc" or "spice"
|
||||
# Used by DisplayAdapter.detect() to choose the right viewer at runtime.
|
||||
#
|
||||
# Exit code 0 always (even if nothing is found — caller handles empty output).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# VNC viewers
|
||||
if command -v virt-viewer &>/dev/null; then
|
||||
echo "spice"
|
||||
echo "vnc"
|
||||
elif command -v remote-viewer &>/dev/null; then
|
||||
echo "spice"
|
||||
echo "vnc"
|
||||
elif command -v xvncviewer &>/dev/null || command -v xtightvncviewer &>/dev/null || \
|
||||
command -v vinagre &>/dev/null || command -v vncviewer &>/dev/null; then
|
||||
echo "vnc"
|
||||
fi
|
||||
|
||||
# SPICE standalone
|
||||
if command -v spicy &>/dev/null; then
|
||||
echo "spice"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# launch-spice-viewer.sh — Launch a SPICE viewer for a libvirt domain.
|
||||
#
|
||||
# Usage: bash launch-spice-viewer.sh <domain> [vnc_display_fallback]
|
||||
|
||||
DOMAIN="${1:-}"
|
||||
LIBVIRT_URI="${LIBVIRT_DEFAULT_URI:-qemu:///system}"
|
||||
|
||||
if command -v virt-viewer &>/dev/null; then
|
||||
exec virt-viewer --connect "$LIBVIRT_URI" "$DOMAIN"
|
||||
elif command -v remote-viewer &>/dev/null; then
|
||||
# Get SPICE port from virsh
|
||||
SPICE_URI=$(virsh --connect "$LIBVIRT_URI" domdisplay "$DOMAIN" 2>/dev/null | grep spice | head -1)
|
||||
if [ -n "$SPICE_URI" ]; then
|
||||
exec remote-viewer "$SPICE_URI"
|
||||
else
|
||||
echo "ERROR: No SPICE display found for $DOMAIN" >&2
|
||||
exit 1
|
||||
fi
|
||||
elif command -v spicy &>/dev/null; then
|
||||
SPICE_PORT=$(virsh --connect "$LIBVIRT_URI" domdisplay "$DOMAIN" 2>/dev/null | grep -oP '(?<=:)\d+' | head -1)
|
||||
exec spicy -h 127.0.0.1 -p "${SPICE_PORT:-5900}"
|
||||
else
|
||||
echo "ERROR: No SPICE viewer found. Install virt-viewer." >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# launch-vnc-viewer.sh — Launch a VNC viewer for a libvirt domain.
|
||||
#
|
||||
# Usage: bash launch-vnc-viewer.sh <domain> <vnc_display>
|
||||
# Example: bash launch-vnc-viewer.sh sc-web-server :0
|
||||
#
|
||||
# Tries: virt-viewer → vncviewer → xtightvncviewer → vinagre (in order)
|
||||
# Exits 1 if none found.
|
||||
|
||||
DOMAIN="${1:-}"
|
||||
VNC_DISPLAY="${2:-:0}"
|
||||
|
||||
# Convert :N display to port 5900+N
|
||||
PORT=$((5900 + ${VNC_DISPLAY#:}))
|
||||
HOST="127.0.0.1"
|
||||
|
||||
if command -v virt-viewer &>/dev/null; then
|
||||
exec virt-viewer --connect qemu:///session "$DOMAIN"
|
||||
elif command -v vncviewer &>/dev/null; then
|
||||
exec vncviewer "${HOST}:${PORT}"
|
||||
elif command -v xtightvncviewer &>/dev/null; then
|
||||
exec xtightvncviewer "${HOST}:${PORT}"
|
||||
elif command -v vinagre &>/dev/null; then
|
||||
exec vinagre "vnc://${HOST}:${PORT}"
|
||||
else
|
||||
echo "ERROR: No VNC viewer found. Install virt-viewer or vncviewer." >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user