simple-cli/manage-vm.sh
joe d0d29139e5
Some checks failed
Build Simple CLI / build (push) Failing after 1s
Add comprehensive documentation, live-build configuration, and testing framework
- Add community release and integration documentation
- Add production deployment and testing framework guides
- Add live-build configuration with hooks and package lists
- Add VM management and testing scripts
- Update .gitignore to block build artifacts and large files
- Remove old bootc package file
- Add comprehensive project completion summary
2025-08-19 20:54:58 -07:00

70 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
VM_NAME="particle-os-test"
NETWORK_NAME="particle-os-net"
echo "🚀 === Particle-OS VM Management Script ==="
echo ""
case "${1:-status}" in
"start")
echo "Starting $VM_NAME..."
sudo virsh start $VM_NAME
;;
"stop")
echo "Stopping $VM_NAME..."
sudo virsh shutdown $VM_NAME
;;
"restart")
echo "Restarting $VM_NAME..."
sudo virsh reboot $VM_NAME
;;
"destroy")
echo "Force stopping $VM_NAME..."
sudo virsh destroy $VM_NAME
;;
"status")
echo "VM Status:"
sudo virsh list --all | grep $VM_NAME
echo ""
echo "Network Status:"
sudo virsh net-list --all | grep $NETWORK_NAME
echo ""
echo "VNC Connection:"
sudo virsh vncdisplay $VM_NAME 2>/dev/null || echo "VNC not available"
;;
"console")
echo "Opening console for $VM_NAME..."
sudo virsh console $VM_NAME
;;
"info")
echo "VM Information:"
sudo virsh dominfo $VM_NAME
echo ""
echo "Network Interfaces:"
sudo virsh domifaddr $VM_NAME
;;
"help"|"-h"|"--help")
echo "Usage: $0 [command]"
echo ""
echo "Commands:"
echo " start - Start the VM"
echo " stop - Gracefully stop the VM"
echo " restart - Restart the VM"
echo " destroy - Force stop the VM"
echo " status - Show VM and network status (default)"
echo " console - Open VM console"
echo " info - Show detailed VM information"
echo " help - Show this help message"
echo ""
echo "Examples:"
echo " $0 start # Start the VM"
echo " $0 status # Check status"
echo " $0 console # Open console"
;;
*)
echo "Unknown command: $1"
echo "Use '$0 help' for usage information"
exit 1
;;
esac