Add support for local image files (URL or local path)

This commit is contained in:
2025-11-18 16:00:29 +07:00
parent 5690f50cfc
commit 651ca6ecd3
3 changed files with 162 additions and 7 deletions

View File

@@ -46,7 +46,7 @@ func main() {
flag.StringVar(&batchFile, "batch", "", "Batch file with multiple config paths (one per line)")
flag.BoolVar(&listStorage, "list-storage", false, "List available storage on Proxmox host")
flag.BoolVar(&listStorage, "ls", false, "List available storage on Proxmox host (shorthand)")
flag.StringVar(&config.ImageURL, "image-url", "", "Cloud image URL to download")
flag.StringVar(&config.ImageURL, "image-url", "", "Cloud image URL or local file path")
flag.StringVar(&config.VMName, "vm-name", "cloud-vm", "VM name")
flag.IntVar(&config.VMID, "vm-id", 0, "VM ID (0 = auto-find from 10000+)")
flag.StringVar(&config.Storage, "storage", "", "Proxmox storage name (auto-detect if empty)")
@@ -126,8 +126,8 @@ func run(config *Config) error {
fmt.Printf("Creating template %s (ID: %d) on Proxmox host %s\n", config.VMName, config.VMID, config.ProxmoxHost)
if err := downloadImage(config); err != nil {
return fmt.Errorf("failed to download image: %w", err)
if err := downloadOrCopyImage(config); err != nil {
return fmt.Errorf("failed to prepare image: %w", err)
}
if err := customizeImage(config); err != nil {