Skip to content

Instantly share code, notes, and snippets.

@Taurolyon
Last active February 2, 2024 01:45
Show Gist options
  • Save Taurolyon/4fe244cdef31a6310290c77feff3fbb5 to your computer and use it in GitHub Desktop.
Save Taurolyon/4fe244cdef31a6310290c77feff3fbb5 to your computer and use it in GitHub Desktop.
Proxmox OpenWRT script
#!/bin/sh
# inspired by https://computingforgeeks.com/install-and-configure-openwrt-vm-on-proxmox-ve/
VM_NAME=OpenWrt
VM_ID=$(pvesh get /cluster/nextid)
RAM=2048
CORES=1
BRIDGE=vmbr1
IMAGE=./openwrt.img
STORAGE=local
VER=$(curl --silent "https://api.github.com/repos/openwrt/openwrt/releases/latest" | grep '"tag_name"' | sed -E 's/.*"v([^"]+)".*/\1/')
wget -O openwrt.img.gz "https://downloads.openwrt.org/releases/$VER/targets/x86/64/openwrt-$VER-x86-64-generic-ext4-combined-efi.img.gz"
du -sh openwrt.img.gz
gunzip ./openwrt.img.gz
qemu-img resize -f raw ./openwrt.img 5G
qm create --name $VM_NAME $VM_ID --memory $RAM --cores $CORES --cpu cputype=kvm64 --net0 virtio,bridge=$BRIDGE --scsihw1
qm importdisk $VM_ID $IMAGE $STORAGE
qm set $VM_ID --scsihw virtio-scsi-pci --virtio0 $STORAGE:$VM_ID/vm-$VM_ID-disk-0.raw
qm set $VM_ID --serial0 socket --vga serial0
qm set $VM_ID --boot c --bootdisk virtio0
qm set $VM_ID --onboot 1
# qm start $VM_ID && qm terminal $VM_ID
@Taurolyon
Copy link
Author

This creates a BIOS VM. I want to try and modify this to create an EFI version.

@Taurolyon
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment