feat: PXE debug boot mode for rescue/diagnostics #4

Merged
michal merged 16 commits from wip/ks-debugging into main 2026-03-30 02:59:35 +00:00
2 changed files with 84 additions and 1 deletions
Showing only changes of commit 5b04d3162b - Show all commits

View File

@@ -121,7 +121,8 @@ ${userDirective}
bootloader --append="console=tty0 console=ttyS0,115200n8" bootloader --append="console=tty0 console=ttyS0,115200n8"
logging --host=${serverIp} --port=${syslogPort} # logging --host=${serverIp} --port=${syslogPort}
# Disabled: syslog UDP port needs to be exposed in k3s service/hostPort first
url --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch url --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch

View File

@@ -0,0 +1,82 @@
#!/bin/bash
# JetKVM helper — authenticate and interact with JetKVM device.
# Usage:
# jetkvm.sh status — check device status
# jetkvm.sh reboot — reboot the target machine via ATX
# jetkvm.sh poweron — power on via ATX short press
# jetkvm.sh poweroff — power off via ATX long press
#
# Environment:
# JETKVM_HOST — JetKVM IP (default: 192.168.3.10)
# JETKVM_PASS — device password
set -euo pipefail
HOST="${JETKVM_HOST:-192.168.3.10}"
PASS="${JETKVM_PASS:-}"
if [ -z "$PASS" ]; then
echo "ERROR: JETKVM_PASS not set" >&2
exit 1
fi
BASE="http://$HOST"
# Authenticate and get token
login() {
local resp
resp=$(curl -s -X POST "$BASE/auth/login-local" \
-H "Content-Type: application/json" \
-d "{\"password\":\"$PASS\"}" 2>&1)
local token
token=$(echo "$resp" | grep -oP '"token"\s*:\s*"[^"]*"' | head -1 | grep -oP '"[^"]*"$' | tr -d '"')
if [ -z "$token" ]; then
echo "ERROR: Login failed: $resp" >&2
exit 1
fi
echo "$token"
}
# Make authenticated request
api() {
local method="$1" path="$2" body="${3:-}"
local token
token=$(login)
if [ -n "$body" ]; then
curl -s -X "$method" "$BASE$path" \
-H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-d "$body"
else
curl -s -X "$method" "$BASE$path" \
-H "Authorization: Bearer $token"
fi
}
case "${1:-status}" in
status)
curl -s "$BASE/device/status" 2>&1
;;
device)
api GET /device
;;
reboot)
echo "Sending ATX reset..."
api POST /device/atx/reset
;;
poweron)
echo "Sending ATX short power press..."
api POST /device/atx/power-short
;;
poweroff)
echo "Sending ATX long power press..."
api POST /device/atx/power-long
;;
*)
echo "Usage: $0 {status|device|reboot|poweron|poweroff}"
exit 1
;;
esac