Skip to content

Commit

Permalink
Ugly workaround for openSUSE/MirrorCache#528 (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
dann1 authored Nov 19, 2024
1 parent 73afe53 commit 4b54c62
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ context-linux/*.rpm
context-linux/*.deb
context-linux/.vagrant*/
context-linux/*~bak
.vscode
12 changes: 11 additions & 1 deletion packer/opensuse/opensuse.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ build {
"cloud-localds ${var.input_dir}/${var.appliance_name}-cloud-init.iso ${var.input_dir}/cloud-init.yml",
]
}

# Workaround for https://github.com/openSUSE/MirrorCache/issues/528
provisioner "shell-local" {
inline = [
# Replace image name for symlinked image on checksum file
"wget -O ${var.checksum_file} ${var.checksum_url}",
"sed -i 's/${var.iso_prefix}-.*\\.qcow2/${var.iso_prefix}-Cloud.qcow2/' ${var.checksum_file}",
]
}
}

# Build VM image
Expand All @@ -18,7 +27,8 @@ source "qemu" "opensuse" {
accelerator = "kvm"

iso_url = lookup(lookup(var.opensuse, var.version, {}), "iso_url", "")
iso_checksum = lookup(lookup(var.opensuse, var.version, {}), "iso_checksum", "")
# iso_checksum = lookup(lookup(var.opensuse, var.version, {}), "iso_checksum", "")
iso_checksum = "file:${var.checksum_file}"

headless = var.headless

Expand Down
17 changes: 17 additions & 0 deletions packer/opensuse/variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,20 @@ variable "opensuse" {
}
}
}

# Workaround for https://github.com/openSUSE/MirrorCache/issues/528

variable "iso_prefix" {
type = string
default = "openSUSE-Leap-15.6-Minimal-VM.x86_64"
}

variable "checksum_file" {
type = string
default = "/tmp/checksum.sha256"
}

variable "checksum_url" {
type = string
default = "https://download.opensuse.org/distribution/leap/15.6/appliances/openSUSE-Leap-15.6-Minimal-VM.x86_64-Cloud.qcow2.sha256"
}

0 comments on commit 4b54c62

Please sign in to comment.