From 41e897f4945aaf8fbcdf0b12ac2f08c5e6ae0458 Mon Sep 17 00:00:00 2001 From: doc Date: Mon, 30 Jun 2025 20:11:52 +0000 Subject: commit of legacy code --- verifypxe.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 verifypxe.sh (limited to 'verifypxe.sh') diff --git a/verifypxe.sh b/verifypxe.sh new file mode 100755 index 0000000..203292b --- /dev/null +++ b/verifypxe.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# === Genesis PXE Verifier === +# Verifies iPXE script and image accessibility over Tailscale + +TAILSCALE_IP="100.113.50.65" +VM_NAME="$1" + +if [[ -z "$VM_NAME" ]]; then + echo "Usage: $0 " + exit 1 +fi + +IPXE_URL="http://100.113.50.65:3000/ipxe/${VM_NAME}.ipxe" + + +echo "🔎 Checking iPXE script at $IPXE_URL ..." +if ! curl -fsSL "$IPXE_URL" -o /tmp/${VM_NAME}.ipxe; then + echo "❌ Failed to fetch iPXE script: $IPXE_URL" + exit 2 +fi +echo "✅ iPXE script retrieved." + +# Extract kernel and initrd lines +KERNEL_URL=$(grep '^kernel ' /tmp/${VM_NAME}.ipxe | awk '{print $2}') +INITRD_URL=$(grep '^initrd ' /tmp/${VM_NAME}.ipxe | awk '{print $2}') + +if [[ -z "$KERNEL_URL" || -z "$INITRD_URL" ]]; then + echo "❌ Could not parse kernel/initrd URLs from iPXE script." + exit 3 +fi + +echo "🔍 Kernel URL: $KERNEL_URL" +echo "🔍 Initrd URL: $INITRD_URL" + +echo "🔎 Verifying kernel URL ..." +if ! curl -fsI "$KERNEL_URL" >/dev/null; then + echo "❌ Kernel file not accessible." + exit 4 +fi +echo "✅ Kernel accessible." + +echo "🔎 Verifying initrd URL ..." +if ! curl -fsI "$INITRD_URL" >/dev/null; then + echo "❌ Initrd file not accessible." + exit 5 +fi +echo "✅ Initrd accessible." + +echo "🎉 PXE verification successful for VM: $VM_NAME" +echo "🚀 Ready to launch boot from $IPXE_URL" + +# Optional: Telegram notify (requires telegram-send config) +if command -v telegram-send &>/dev/null; then + telegram-send "✅ PXE verify passed for *${VM_NAME}*. +Netboot source: \`${IPXE_URL}\` +Kernel: \`${KERNEL_URL##*/}\` +Initrd: \`${INITRD_URL##*/}\` +Ready to launch via Proxmox." --parse-mode markdown +fi + +exit 0 -- cgit v1.2.3