From f529a258bb3ed86ef35f3b5b2450d47256798009 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Thu, 22 Feb 2024 18:25:49 -0600 Subject: [PATCH 01/19] updates --- README.md | 10 ++- ...albox-ovf.sh => amazon_linux_2023_build.sh | 0 amazon_linux_2_hyperv_build.sh | 67 +++++++++++++++++++ amazon_linux_2_parallels_build.sh | 67 +++++++++++++++++++ amazon_linux_2_virtualbox_build.sh | 67 +++++++++++++++++++ amazon_linux_2_vmware_build.sh | 67 +++++++++++++++++++ lib/bento/version.rb | 2 +- .../amazonlinux-2-aarch64-qemu.pkrvars.hcl | 12 ++++ ...azonlinux-2-x86_64-virtualbox.pkrvars.hcl} | 0 .../amazonlinux-2023-aarch64-qemu.pkrvars.hcl | 17 +++++ ...nlinux-2023-x86_64-virtualbox.pkrvars.hcl} | 0 .../ubuntu/ubuntu-22.04-aarch64.pkrvars.hcl | 2 +- .../ubuntu/ubuntu-22.04-x86_64.pkrvars.hcl | 2 +- packer_templates/pkr-sources.pkr.hcl | 17 +++-- packer_templates/pkr-variables.pkr.hcl | 30 +++++++++ 15 files changed, 351 insertions(+), 9 deletions(-) rename AMZ_build_virtualbox-ovf.sh => amazon_linux_2023_build.sh (100%) create mode 100755 amazon_linux_2_hyperv_build.sh create mode 100755 amazon_linux_2_parallels_build.sh create mode 100755 amazon_linux_2_virtualbox_build.sh create mode 100755 amazon_linux_2_vmware_build.sh create mode 100644 os_pkrvars/amazonlinux/amazonlinux-2-aarch64-qemu.pkrvars.hcl rename os_pkrvars/amazonlinux/{amazonlinux-2-x86_64.pkrvars.hcl => amazonlinux-2-x86_64-virtualbox.pkrvars.hcl} (100%) create mode 100644 os_pkrvars/amazonlinux/amazonlinux-2023-aarch64-qemu.pkrvars.hcl rename os_pkrvars/amazonlinux/{amazonlinux-2023-x86_64.pkrvars.hcl => amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl} (100%) diff --git a/README.md b/README.md index 5a9038a61..9f8b266c7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Bento is a project that encapsulates [Packer](https://www.packer.io/) templates ***NOTE:** -- Vagrant 2.4.0+ is required for new cpu archetecture support +- Vagrant 2.4.0+ is required for new cpu architecture support - Virutalbox 6.x requires disabling nat config that allows vbox 7.x guests to connect to the host. To use comment out lines #161 and #162 in bento/packer_templates/pkr-variables.pkr.hcl or add variable `vboxmanage = []` to os_pkrvars files. - When running packer build command the output directory is relative to the working directory the command is currently running in. Suggest running packer build commands from bento root directory for build working files to be placed in bento/builds/(build_name) directory by default. If the output_directory variable isn't overwritten a directory called builds/(build_name) will be created in the current working directory that you are running the command from @@ -24,6 +24,14 @@ Vagrant.configure("2") do |config| end ``` +### Installing Bento + +1. install ruby environment +2. clone repo +3. cd /bento +4. gem build bento.gemspec +5. gem install bento-*.gem + ### Building Boxes #### Requirements diff --git a/AMZ_build_virtualbox-ovf.sh b/amazon_linux_2023_build.sh similarity index 100% rename from AMZ_build_virtualbox-ovf.sh rename to amazon_linux_2023_build.sh diff --git a/amazon_linux_2_hyperv_build.sh b/amazon_linux_2_hyperv_build.sh new file mode 100755 index 000000000..e5cff7428 --- /dev/null +++ b/amazon_linux_2_hyperv_build.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Getting script directory location +SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") +cd "$SCRIPT_RELATIVE_DIR" || exit + +# set tmp dir for files +AMZDIR="$(pwd)/packer_templates/amz_working_files" + +# Get virtualbox vdi file name with latest version number +IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" + +# Download vbox vdi +echo "Downloading Vbox VDI $IMG" +wget -q -O "$AMZDIR"/amazon2.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" + +if [ ! -f "$AMZDIR"/amazon2.vdi ]; then + echo There must be a file named amazon2.vdi in "$AMZDIR"! + echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ + exit 1 +fi + +echo "Cleaning up old files" +rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk + +echo "Creating ISO" +hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso + +VM="AmazonLinuxBento" +echo Powering off and deleting any existing VMs named $VM +VBoxManage controlvm $VM poweroff --type headless 2> /dev/null +VBoxManage unregistervm $VM --delete 2> /dev/null +sleep 5 + +echo "Creating the VM" +# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html +VBoxManage createvm --name $VM --ostype "RedHat_64" --register +VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon.vdi +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage modifyvm $VM --memory 2048 +VBoxManage modifyvm $VM --cpus 2 +VBoxManage modifyvm $VM --audio-driver none +VBoxManage modifyvm $VM --ioapic on +sleep 5 + +echo Sleeping for 120 seconds to let the system boot and cloud-init to run +VBoxManage startvm $VM --type headless +sleep 120 +VBoxManage controlvm $VM poweroff --type headless +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none +sleep 5 + +echo Exporting the VM to an OVF file +vboxmanage export $VM -o "$AMZDIR"/amazon2.ovf +sleep 5 + +echo Deleting the VM +vboxmanage unregistervm $VM --delete + +echo starting packer build of amazonlinux +if packer build -timestamp-ui -only=virtualbox-ovf.amazonlinux -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then + echo "Cleaning up files" + rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso +else + exit 1 +fi diff --git a/amazon_linux_2_parallels_build.sh b/amazon_linux_2_parallels_build.sh new file mode 100755 index 000000000..e5cff7428 --- /dev/null +++ b/amazon_linux_2_parallels_build.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Getting script directory location +SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") +cd "$SCRIPT_RELATIVE_DIR" || exit + +# set tmp dir for files +AMZDIR="$(pwd)/packer_templates/amz_working_files" + +# Get virtualbox vdi file name with latest version number +IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" + +# Download vbox vdi +echo "Downloading Vbox VDI $IMG" +wget -q -O "$AMZDIR"/amazon2.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" + +if [ ! -f "$AMZDIR"/amazon2.vdi ]; then + echo There must be a file named amazon2.vdi in "$AMZDIR"! + echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ + exit 1 +fi + +echo "Cleaning up old files" +rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk + +echo "Creating ISO" +hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso + +VM="AmazonLinuxBento" +echo Powering off and deleting any existing VMs named $VM +VBoxManage controlvm $VM poweroff --type headless 2> /dev/null +VBoxManage unregistervm $VM --delete 2> /dev/null +sleep 5 + +echo "Creating the VM" +# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html +VBoxManage createvm --name $VM --ostype "RedHat_64" --register +VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon.vdi +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage modifyvm $VM --memory 2048 +VBoxManage modifyvm $VM --cpus 2 +VBoxManage modifyvm $VM --audio-driver none +VBoxManage modifyvm $VM --ioapic on +sleep 5 + +echo Sleeping for 120 seconds to let the system boot and cloud-init to run +VBoxManage startvm $VM --type headless +sleep 120 +VBoxManage controlvm $VM poweroff --type headless +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none +sleep 5 + +echo Exporting the VM to an OVF file +vboxmanage export $VM -o "$AMZDIR"/amazon2.ovf +sleep 5 + +echo Deleting the VM +vboxmanage unregistervm $VM --delete + +echo starting packer build of amazonlinux +if packer build -timestamp-ui -only=virtualbox-ovf.amazonlinux -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then + echo "Cleaning up files" + rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso +else + exit 1 +fi diff --git a/amazon_linux_2_virtualbox_build.sh b/amazon_linux_2_virtualbox_build.sh new file mode 100755 index 000000000..e5cff7428 --- /dev/null +++ b/amazon_linux_2_virtualbox_build.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Getting script directory location +SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") +cd "$SCRIPT_RELATIVE_DIR" || exit + +# set tmp dir for files +AMZDIR="$(pwd)/packer_templates/amz_working_files" + +# Get virtualbox vdi file name with latest version number +IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" + +# Download vbox vdi +echo "Downloading Vbox VDI $IMG" +wget -q -O "$AMZDIR"/amazon2.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" + +if [ ! -f "$AMZDIR"/amazon2.vdi ]; then + echo There must be a file named amazon2.vdi in "$AMZDIR"! + echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ + exit 1 +fi + +echo "Cleaning up old files" +rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk + +echo "Creating ISO" +hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso + +VM="AmazonLinuxBento" +echo Powering off and deleting any existing VMs named $VM +VBoxManage controlvm $VM poweroff --type headless 2> /dev/null +VBoxManage unregistervm $VM --delete 2> /dev/null +sleep 5 + +echo "Creating the VM" +# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html +VBoxManage createvm --name $VM --ostype "RedHat_64" --register +VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon.vdi +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage modifyvm $VM --memory 2048 +VBoxManage modifyvm $VM --cpus 2 +VBoxManage modifyvm $VM --audio-driver none +VBoxManage modifyvm $VM --ioapic on +sleep 5 + +echo Sleeping for 120 seconds to let the system boot and cloud-init to run +VBoxManage startvm $VM --type headless +sleep 120 +VBoxManage controlvm $VM poweroff --type headless +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none +sleep 5 + +echo Exporting the VM to an OVF file +vboxmanage export $VM -o "$AMZDIR"/amazon2.ovf +sleep 5 + +echo Deleting the VM +vboxmanage unregistervm $VM --delete + +echo starting packer build of amazonlinux +if packer build -timestamp-ui -only=virtualbox-ovf.amazonlinux -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then + echo "Cleaning up files" + rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso +else + exit 1 +fi diff --git a/amazon_linux_2_vmware_build.sh b/amazon_linux_2_vmware_build.sh new file mode 100755 index 000000000..e5cff7428 --- /dev/null +++ b/amazon_linux_2_vmware_build.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Getting script directory location +SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") +cd "$SCRIPT_RELATIVE_DIR" || exit + +# set tmp dir for files +AMZDIR="$(pwd)/packer_templates/amz_working_files" + +# Get virtualbox vdi file name with latest version number +IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" + +# Download vbox vdi +echo "Downloading Vbox VDI $IMG" +wget -q -O "$AMZDIR"/amazon2.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" + +if [ ! -f "$AMZDIR"/amazon2.vdi ]; then + echo There must be a file named amazon2.vdi in "$AMZDIR"! + echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ + exit 1 +fi + +echo "Cleaning up old files" +rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk + +echo "Creating ISO" +hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso + +VM="AmazonLinuxBento" +echo Powering off and deleting any existing VMs named $VM +VBoxManage controlvm $VM poweroff --type headless 2> /dev/null +VBoxManage unregistervm $VM --delete 2> /dev/null +sleep 5 + +echo "Creating the VM" +# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html +VBoxManage createvm --name $VM --ostype "RedHat_64" --register +VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon.vdi +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage modifyvm $VM --memory 2048 +VBoxManage modifyvm $VM --cpus 2 +VBoxManage modifyvm $VM --audio-driver none +VBoxManage modifyvm $VM --ioapic on +sleep 5 + +echo Sleeping for 120 seconds to let the system boot and cloud-init to run +VBoxManage startvm $VM --type headless +sleep 120 +VBoxManage controlvm $VM poweroff --type headless +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none +sleep 5 + +echo Exporting the VM to an OVF file +vboxmanage export $VM -o "$AMZDIR"/amazon2.ovf +sleep 5 + +echo Deleting the VM +vboxmanage unregistervm $VM --delete + +echo starting packer build of amazonlinux +if packer build -timestamp-ui -only=virtualbox-ovf.amazonlinux -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then + echo "Cleaning up files" + rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso +else + exit 1 +fi diff --git a/lib/bento/version.rb b/lib/bento/version.rb index afc40757d..7c0652e72 100644 --- a/lib/bento/version.rb +++ b/lib/bento/version.rb @@ -1,3 +1,3 @@ module Bento - VERSION = '4.0.0'.freeze + VERSION = '4.0.1'.freeze end diff --git a/os_pkrvars/amazonlinux/amazonlinux-2-aarch64-qemu.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2-aarch64-qemu.pkrvars.hcl new file mode 100644 index 000000000..813c91c21 --- /dev/null +++ b/os_pkrvars/amazonlinux/amazonlinux-2-aarch64-qemu.pkrvars.hcl @@ -0,0 +1,12 @@ +os_name = "amazonlinux" +os_version = "2" +os_arch = "aarch64" +iso_url = "https://cdn.amazonlinux.com/os-images/2.0.20240131.0/kvm-arm64/amzn2-kvm-2.0.20240131.0-arm64.xfs.gpt.qcow2" +iso_checksum = "file:https://cdn.amazonlinux.com/os-images/2.0.20240131.0/kvm-arm64/SHA256SUMS" +qemu_disk_image = true +sources_enabled = [ + "source.qemu.vm" +] +parallels_guest_os_type = "centos" +vbox_guest_os_type = "RedHat_64" +vmware_guest_os_type = "arm-rhel9-64" diff --git a/os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl similarity index 100% rename from os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl rename to os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64-qemu.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64-qemu.pkrvars.hcl new file mode 100644 index 000000000..dc37387fb --- /dev/null +++ b/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64-qemu.pkrvars.hcl @@ -0,0 +1,17 @@ +os_name = "amazonlinux" +os_version = "2023" +os_arch = "aarch64" +iso_url = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240131.0/kvm-arm64/al2023-kvm-2023.3.20240131.0-kernel-6.1-arm64.xfs.gpt.qcow2" +iso_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240131.0/kvm-arm64/SHA256SUMS" +qemu_disk_image = true +cd_files = ["/Users/corey.hemminger/Documents/github/personal/chef/cookbooks/testing/bento/packer_templates/amz_seed_iso/*"] +qemu_efi_boot = true +qemu_efi_firmware_code = "/opt/homebrew/Cellar/qemu/8.2.1/share/qemu/edk2-arm-code.fd" +qemu_efi_firmware_vars = "/opt/homebrew/Cellar/qemu/8.2.1/share/qemu/edk2-arm-vars.fd" +qemu_efi_drop_efivars = null +sources_enabled = [ + "source.qemu.vm" +] +parallels_guest_os_type = "centos" +vbox_guest_os_type = "RedHat_64" +vmware_guest_os_type = "arm-rhel9-64" diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl similarity index 100% rename from os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl rename to os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl diff --git a/os_pkrvars/ubuntu/ubuntu-22.04-aarch64.pkrvars.hcl b/os_pkrvars/ubuntu/ubuntu-22.04-aarch64.pkrvars.hcl index 35e379886..e49428e2b 100644 --- a/os_pkrvars/ubuntu/ubuntu-22.04-aarch64.pkrvars.hcl +++ b/os_pkrvars/ubuntu/ubuntu-22.04-aarch64.pkrvars.hcl @@ -1,7 +1,7 @@ os_name = "ubuntu" os_version = "22.04" os_arch = "aarch64" -iso_url = "https://cdimage.ubuntu.com/releases/jammy/release/ubuntu-22.04.3-live-server-arm64.iso" +iso_url = "https://cdimage.ubuntu.com/releases/jammy/release/ubuntu-22.04.4-live-server-arm64.iso" iso_checksum = "file:https://cdimage.ubuntu.com/releases/jammy/release/SHA256SUMS" parallels_guest_os_type = "ubuntu" vbox_guest_os_type = "Ubuntu_64" diff --git a/os_pkrvars/ubuntu/ubuntu-22.04-x86_64.pkrvars.hcl b/os_pkrvars/ubuntu/ubuntu-22.04-x86_64.pkrvars.hcl index 7475a60a4..c4f1bb6fe 100644 --- a/os_pkrvars/ubuntu/ubuntu-22.04-x86_64.pkrvars.hcl +++ b/os_pkrvars/ubuntu/ubuntu-22.04-x86_64.pkrvars.hcl @@ -1,7 +1,7 @@ os_name = "ubuntu" os_version = "22.04" os_arch = "x86_64" -iso_url = "https://releases.ubuntu.com/jammy/ubuntu-22.04.3-live-server-amd64.iso" +iso_url = "https://releases.ubuntu.com/jammy/ubuntu-22.04.4-live-server-amd64.iso" iso_checksum = "file:https://releases.ubuntu.com/jammy/SHA256SUMS" parallels_guest_os_type = "ubuntu" vbox_guest_os_type = "Ubuntu_64" diff --git a/packer_templates/pkr-sources.pkr.hcl b/packer_templates/pkr-sources.pkr.hcl index 25f92d8ee..fb910f407 100644 --- a/packer_templates/pkr-sources.pkr.hcl +++ b/packer_templates/pkr-sources.pkr.hcl @@ -174,11 +174,18 @@ source "parallels-iso" "vm" { } source "qemu" "vm" { # QEMU specific options - accelerator = var.qemu_accelerator - display = var.headless ? "none" : var.qemu_display - machine_type = local.qemu_machine_type - qemu_binary = local.qemu_binary - qemuargs = local.qemuargs + accelerator = var.qemu_accelerator + display = var.headless ? "none" : var.qemu_display + disk_image = var.qemu_disk_image + efi_boot = var.qemu_efi_boot + efi_firmware_code = var.qemu_efi_firmware_code + efi_firmware_vars = var.qemu_efi_firmware_vars + efi_drop_efivars = var.qemu_efi_drop_efivars + format = var.qemu_format + machine_type = local.qemu_machine_type + qemu_binary = local.qemu_binary + qemuargs = local.qemuargs + skip_resize_disk = true # Source block common options boot_command = var.boot_command boot_wait = var.qemu_boot_wait == null ? local.default_boot_wait : var.qemu_boot_wait diff --git a/packer_templates/pkr-variables.pkr.hcl b/packer_templates/pkr-variables.pkr.hcl index 049ca0d6d..0f3c5de39 100644 --- a/packer_templates/pkr-variables.pkr.hcl +++ b/packer_templates/pkr-variables.pkr.hcl @@ -119,6 +119,36 @@ variable "qemu_display" { type = string default = "none" } +variable "qemu_disk_image" { + type = bool + default = null + description = "Whether iso_url is a bootable qcow2 disk image" +} +variable "qemu_efi_boot" { + type = bool + default = false + description = "Enable EFI boot" +} +variable "qemu_efi_firmware_code" { + type = string + default = null + description = "EFI firmware code path" +} +variable "qemu_efi_firmware_vars" { + type = string + default = null + description = "EFI firmware vars file path" +} +variable "qemu_efi_drop_efivars" { + type = bool + default = false + description = "Drop EFI vars" +} +variable "qemu_format" { + type = string + default = "qcow2" + description = "Disk format, takes qcow2 or raw" +} variable "qemu_machine_type" { type = string default = null From 547aaf4770143959cf3e6a801e38d4aad6ad869b Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Thu, 22 Feb 2024 18:33:54 -0600 Subject: [PATCH 02/19] updates --- README.md | 8 ++++---- packer_templates/pkr-sources.pkr.hcl | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9f8b266c7..5b074914c 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,10 @@ end ### Installing Bento 1. install ruby environment -2. clone repo -3. cd /bento -4. gem build bento.gemspec -5. gem install bento-*.gem +1. clone repo +1. cd /bento +1. gem build bento.gemspec +1. gem install bento-*.gem ### Building Boxes diff --git a/packer_templates/pkr-sources.pkr.hcl b/packer_templates/pkr-sources.pkr.hcl index fb910f407..711f53744 100644 --- a/packer_templates/pkr-sources.pkr.hcl +++ b/packer_templates/pkr-sources.pkr.hcl @@ -185,7 +185,6 @@ source "qemu" "vm" { machine_type = local.qemu_machine_type qemu_binary = local.qemu_binary qemuargs = local.qemuargs - skip_resize_disk = true # Source block common options boot_command = var.boot_command boot_wait = var.qemu_boot_wait == null ? local.default_boot_wait : var.qemu_boot_wait From 64bd70f46643dad381126606395b075c5db46358 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 15:37:07 -0500 Subject: [PATCH 03/19] testing --- CHANGELOG.md | 8 ++++- lib/bento/test.rb | 26 +++++++++++--- lib/bento/test_templates/kitchen.yml.erb | 3 +- lib/bento/upload.rb | 4 +-- lib/bento/version.rb | 2 +- ...onlinux-2023-x86_64-virtualbox.pkrvars.hcl | 35 +++++++++++-------- .../centos/centos-7-aarch64.pkrvars.hcl | 2 +- .../centos-stream-8-aarch64.pkrvars.hcl | 2 +- .../centos-stream-9-aarch64.pkrvars.hcl | 2 +- .../debian/debian-11-aarch64.pkrvars.hcl | 2 +- .../debian/debian-12-aarch64.pkrvars.hcl | 2 +- .../freebsd/freebsd-13-aarch64.pkrvars.hcl | 2 +- .../freebsd/freebsd-14-aarch64.pkrvars.hcl | 2 +- .../opensuse-leap-15-aarch64.pkrvars.hcl | 2 +- .../oracle/oracle-7-aarch64.pkrvars.hcl | 2 +- .../oracle/oracle-8-aarch64.pkrvars.hcl | 2 +- .../oracle/oracle-9-aarch64.pkrvars.hcl | 2 +- os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl | 2 +- os_pkrvars/rhel/rhel-8-aarch64.pkrvars.hcl | 2 +- os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl | 2 +- .../rockylinux-8-aarch64.pkrvars.hcl | 2 +- .../scripts/_common/vmware_rhel.sh | 24 +++++++------ packer_templates/scripts/rhel/cleanup_dnf.sh | 4 +-- 23 files changed, 84 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6abc2b66..1fe147770 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,7 +54,13 @@ Markdown table generated at - Create CD pipeline to build and upload new versions of vagrant boxes once every 3 months with the latest patches - Added ability to configure bento upload of private or public boxes in builds.yml, defaults to private -## [unreleased] (2024-02-16) +## [unreleased] (2024-02-28) + +## [v4.0.2] (2024-02-28) + +- Update upload message to show architecture +- fix open-vm-tools install for vmware builds +- ## [v4.0.1] (2024-02-16) diff --git a/lib/bento/test.rb b/lib/bento/test.rb index b4a572f56..21c2b684d 100644 --- a/lib/bento/test.rb +++ b/lib/bento/test.rb @@ -5,12 +5,13 @@ class TestRunner include Common - attr_reader :shared_folder, :boxname, :provider, :box_url, :no_shared, :provisioner + attr_reader :shared_folder, :boxname, :provider, :box_url, :no_shared, :provisioner, :errors def initialize(opts) @debug = opts.debug @no_shared = opts.no_shared @provisioner = opts.provisioner.nil? ? 'shell' : opts.provisioner + @errors = [] end def start @@ -23,6 +24,9 @@ def start end end banner("Testing finished in #{duration(time.real)}.") + unless errors.empty? + raise("Failed Tests:\n #{errors.join("\n")}\n exited #{$CHILD_STATUS}") + end end private @@ -45,8 +49,17 @@ def test_box(md_json) temp_dir = "#{bento_dir}/builds/test-kitchen" Dir.mkdir(temp_dir) unless Dir.exist?(temp_dir) md = box_metadata(md_json) + arch = case md['arch'] + when 'x86_64', 'amd64' + 'amd64' + when 'aarch64', 'arm64' + 'arm64' + else + raise "Unknown arch #{md_data.inspect}" + end @boxname = md['name'] @providers = md['providers'] + @arch = arch @share_disabled = no_shared || /(bsd|opensuse)/.match(boxname) ? true : false dir = "#{File.expand_path('../../', File.dirname(__FILE__))}/lib/bento/test_templates" @@ -58,9 +71,14 @@ def test_box(md_json) Dir.chdir(temp_dir) banner("Test kitchen file located in #{temp_dir}") - test = Mixlib::ShellOut.new('kitchen test', timeout: 900, live_stream: STDOUT) - test.run_command - test.error! + @providers.each do |k, _v| + test = Mixlib::ShellOut.new("kitchen test #{@boxname}-#{@arch}-#{k.tr('_', '-')}", timeout: 900, live_stream: STDOUT) + test.run_command + if test.error? + test.stderr + errors << "#{@boxname}-#{@arch}-#{k}" + end + end Dir.chdir(bento_dir) FileUtils.rm_rf(temp_dir) end diff --git a/lib/bento/test_templates/kitchen.yml.erb b/lib/bento/test_templates/kitchen.yml.erb index f676bab8f..56836444e 100644 --- a/lib/bento/test_templates/kitchen.yml.erb +++ b/lib/bento/test_templates/kitchen.yml.erb @@ -4,13 +4,14 @@ provisioner: platforms: <% @providers.each do |k,v| -%> -- name: <%= @boxname + '-' + k %> +- name: <%= "#{@boxname}-#{@arch}-#{k}" %> driver: name: vagrant provider: <%= k %> vm_hostname: bento-test box: bento-<%= @boxname %> box_url: file://<%= Dir.pwd %>/builds/<%= v['file'] %> + box_arch: <%= @arch %> synced_folders: <% if k =~ /hyperv/ -%> - [".", "/vagrant", "disabled: true"] diff --git a/lib/bento/upload.rb b/lib/bento/upload.rb index d9c5699ca..582cc9d70 100644 --- a/lib/bento/upload.rb +++ b/lib/bento/upload.rb @@ -45,14 +45,14 @@ def upload_box(md_file) md_data['providers'].each_pair do |prov, prov_data| if File.exist?(File.join('builds', prov_data['file'])) puts '' - banner("Uploading #{builds_yml['vagrant_cloud_account']}/#{md_data['box_basename']} version:#{md_data['version']} provider:#{prov}...") + banner("Uploading #{builds_yml['vagrant_cloud_account']}/#{md_data['box_basename']} version:#{md_data['version']} provider:#{prov} arch:#{arch}...") upload_cmd = "vagrant cloud publish --architecture #{arch} #{default_arch(arch)} --no-direct-upload #{builds_yml['vagrant_cloud_account']}/#{md_data['box_basename']} #{md_data['version']} #{prov} builds/#{prov_data['file']} --description '#{box_desc(md_data['box_basename'])}' --short-description '#{box_desc(md_data['box_basename'])}' --version-description '#{ver_desc(md_data)}' --force --release #{public_private_box(md_data['box_basename'])}" shellout(upload_cmd) slug_name = lookup_slug(md_data['name']) if slug_name puts '' - banner("Uploading slug #{builds_yml['vagrant_cloud_account']}/#{slug_name} from #{md_data['box_basename']} version:#{md_data['version']} provider:#{prov}...") + banner("Uploading slug #{builds_yml['vagrant_cloud_account']}/#{slug_name} from #{md_data['box_basename']} version:#{md_data['version']} provider:#{prov} arch:#{arch}...") upload_cmd = "vagrant cloud publish --architecture #{arch} --no-direct-upload #{builds_yml['vagrant_cloud_account']}/#{slug_name} #{md_data['version']} #{prov} builds/#{prov_data['file']} --description '#{slug_desc(slug_name)}' --short-description '#{slug_desc(slug_name)}' --version-description '#{ver_desc(md_data)}' --force --release #{public_private_box(md_data['box_basename'])}" shellout(upload_cmd) end diff --git a/lib/bento/version.rb b/lib/bento/version.rb index 7c0652e72..9cba61623 100644 --- a/lib/bento/version.rb +++ b/lib/bento/version.rb @@ -1,3 +1,3 @@ module Bento - VERSION = '4.0.1'.freeze + VERSION = '4.0.2'.freeze end diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl index 421326585..149c0912f 100644 --- a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl +++ b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl @@ -1,21 +1,26 @@ os_name = "amazonlinux" os_version = "2023" os_arch = "x86_64" -vbox_guest_os_type = "RedHat_64" +parallels_guest_os_type = "fedora-core" +vbox_guest_os_type = "Fedora_64" +vmware_guest_os_type = "fedora-64" sources_enabled = [ "source.virtualbox-ovf.amazonlinux" ] -vboxmanage = [ - [ - "modifyvm", - "{{ .Name }}", - "--memory", - "2048", - "--cpus", - "2", - "--audio", - "none", - "--nat-localhostreachable1", - "on", - ] -] +#vboxmanage = [ +# [ +# "modifyvm", +# "{{ .Name }}", +# "--memory", +# "2048", +# "--cpus", +# "2", +# "--audio", +# "none", +# "--nat-localhostreachable1", +# "on", +# ] +#] +iso_url = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240219.0/vmware/al2023-vmware_esx-2023.3.20240219.0-kernel-6.1-x86_64.xfs.gpt.ova" +iso_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240219.0/vmware/SHA256SUMS" +#boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg"] diff --git a/os_pkrvars/centos/centos-7-aarch64.pkrvars.hcl b/os_pkrvars/centos/centos-7-aarch64.pkrvars.hcl index c9cb1a8bc..1d5b199f2 100644 --- a/os_pkrvars/centos/centos-7-aarch64.pkrvars.hcl +++ b/os_pkrvars/centos/centos-7-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://quantum-mirror.hu/mirrors/pub/centos-altarch/ iso_checksum = "file:https://quantum-mirror.hu/mirrors/pub/centos-altarch/7.9.2009/isos/aarch64/sha256sum.txt" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-other-64" boot_command = ["e text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg x"] diff --git a/os_pkrvars/centos/centos-stream-8-aarch64.pkrvars.hcl b/os_pkrvars/centos/centos-stream-8-aarch64.pkrvars.hcl index 20fb10372..08d946e6b 100644 --- a/os_pkrvars/centos/centos-stream-8-aarch64.pkrvars.hcl +++ b/os_pkrvars/centos/centos-stream-8-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://mirrors.edge.kernel.org/centos/8-stream/isos/ iso_checksum = "file:https://mirrors.edge.kernel.org/centos/8-stream/isos/aarch64/CHECKSUM" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-other-64" boot_command = ["e inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/8ks.cfg x"] diff --git a/os_pkrvars/centos/centos-stream-9-aarch64.pkrvars.hcl b/os_pkrvars/centos/centos-stream-9-aarch64.pkrvars.hcl index 9acbd0cf6..635e561ba 100644 --- a/os_pkrvars/centos/centos-stream-9-aarch64.pkrvars.hcl +++ b/os_pkrvars/centos/centos-stream-9-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://mirror.stream.centos.org/9-stream/BaseOS/aarc iso_checksum = "file:https://mirror.stream.centos.org/9-stream/BaseOS/aarch64/iso/CentOS-Stream-9-latest-aarch64-dvd1.iso.SHA256SUM" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-rhel9-64" boot_command = ["e inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/9ks.cfg x"] diff --git a/os_pkrvars/debian/debian-11-aarch64.pkrvars.hcl b/os_pkrvars/debian/debian-11-aarch64.pkrvars.hcl index 88909284d..e06e354f1 100644 --- a/os_pkrvars/debian/debian-11-aarch64.pkrvars.hcl +++ b/os_pkrvars/debian/debian-11-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://cdimage.debian.org/cdimage/archive/latest-old iso_checksum = "file:https://cdimage.debian.org/cdimage/archive/latest-oldstable/arm64/iso-dvd/SHA256SUMS" parallels_guest_os_type = "debian" vbox_guest_os_type = "Debian_64" -vmware_guest_os_type = "arm-debian-64" +vmware_guest_os_type = "arm-debian11-64" boot_command = ["einstall preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/debian/preseed.cfg debian-installer=en_US.UTF-8 auto locale=en_US.UTF-8 kbd-chooser/method=us keyboard-configuration/xkb-keymap=us netcfg/get_hostname={{ .Name }} netcfg/get_domain=vagrantup.com fb=false debconf/frontend=noninteractive console-setup/ask_detect=false console-keymaps-at/keymap=us grub-installer/bootdev=/dev/sda "] diff --git a/os_pkrvars/debian/debian-12-aarch64.pkrvars.hcl b/os_pkrvars/debian/debian-12-aarch64.pkrvars.hcl index 1fcfb21ac..a1f98a930 100644 --- a/os_pkrvars/debian/debian-12-aarch64.pkrvars.hcl +++ b/os_pkrvars/debian/debian-12-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://cdimage.debian.org/cdimage/release/12.5.0/arm iso_checksum = "file:https://cdimage.debian.org/cdimage/release/12.5.0/arm64/iso-dvd/SHA256SUMS" parallels_guest_os_type = "debian" vbox_guest_os_type = "Debian_64" -vmware_guest_os_type = "arm-debian-64" +vmware_guest_os_type = "arm-debian12-64" boot_command = ["einstall preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/debian/preseed.cfg debian-installer=en_US.UTF-8 auto locale=en_US.UTF-8 kbd-chooser/method=us keyboard-configuration/xkb-keymap=us netcfg/get_hostname={{ .Name }} netcfg/get_domain=vagrantup.com fb=false debconf/frontend=noninteractive console-setup/ask_detect=false console-keymaps-at/keymap=us grub-installer/bootdev=/dev/sda "] diff --git a/os_pkrvars/freebsd/freebsd-13-aarch64.pkrvars.hcl b/os_pkrvars/freebsd/freebsd-13-aarch64.pkrvars.hcl index b467c948e..19f7fffd3 100644 --- a/os_pkrvars/freebsd/freebsd-13-aarch64.pkrvars.hcl +++ b/os_pkrvars/freebsd/freebsd-13-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://download.freebsd.org/releases/arm64/aarch64/I iso_checksum = "file:https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/13.2/CHECKSUM.SHA256-FreeBSD-13.2-RELEASE-arm64-aarch64" parallels_guest_os_type = "freebsd" vbox_guest_os_type = "FreeBSD_64" -vmware_guest_os_type = "arm-freebsd-64" +vmware_guest_os_type = "arm-freebsd13-64" boot_command = ["boot -s/bin/shmdmfs -s 100m md1 /tmpmdmfs -s 100m md2 /mntdhclient -p /tmp/dhclient.em0.pid -l /tmp/dhclient.lease.em0 em0fetch -o /tmp/installerconfig http://{{ .HTTPIP }}:{{ .HTTPPort }}/freebsd/installerconfig && bsdinstall script /tmp/installerconfig"] diff --git a/os_pkrvars/freebsd/freebsd-14-aarch64.pkrvars.hcl b/os_pkrvars/freebsd/freebsd-14-aarch64.pkrvars.hcl index 69344d36c..f2dfcfdb6 100644 --- a/os_pkrvars/freebsd/freebsd-14-aarch64.pkrvars.hcl +++ b/os_pkrvars/freebsd/freebsd-14-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://download.freebsd.org/releases/arm64/aarch64/I iso_checksum = "file:https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/14.0/CHECKSUM.SHA256-FreeBSD-14.0-RELEASE-arm64-aarch64" parallels_guest_os_type = "freebsd" vbox_guest_os_type = "FreeBSD_64" -vmware_guest_os_type = "arm-freebsd-64" +vmware_guest_os_type = "arm-freebsd14-64" boot_command = ["boot -s/bin/shmdmfs -s 100m md1 /tmpmdmfs -s 100m md2 /mntdhclient -p /tmp/dhclient.em0.pid -l /tmp/dhclient.lease.em0 em0fetch -o /tmp/installerconfig http://{{ .HTTPIP }}:{{ .HTTPPort }}/freebsd/installerconfig && bsdinstall script /tmp/installerconfig"] diff --git a/os_pkrvars/opensuse/opensuse-leap-15-aarch64.pkrvars.hcl b/os_pkrvars/opensuse/opensuse-leap-15-aarch64.pkrvars.hcl index ae1d00738..29b434d07 100644 --- a/os_pkrvars/opensuse/opensuse-leap-15-aarch64.pkrvars.hcl +++ b/os_pkrvars/opensuse/opensuse-leap-15-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "http://provo-mirror.opensuse.org/distribution/leap/15 iso_checksum = "file:https://provo-mirror.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-DVD-aarch64-Media.iso.sha256" parallels_guest_os_type = "opensuse" vbox_guest_os_type = "OpenSUSE_64" -vmware_guest_os_type = "arm-opensuse-64" +vmware_guest_os_type = "arm-other-64" boot_command = ["e biosdevname=0 net.ifnames=0 netdevice=eth0 netsetup=dhcp lang=en_US textmode=1 modprobe.blacklist=vmwgfx autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/opensuse/autoinst-uefi.xml"] diff --git a/os_pkrvars/oracle/oracle-7-aarch64.pkrvars.hcl b/os_pkrvars/oracle/oracle-7-aarch64.pkrvars.hcl index ec6471c14..67873935e 100644 --- a/os_pkrvars/oracle/oracle-7-aarch64.pkrvars.hcl +++ b/os_pkrvars/oracle/oracle-7-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL7/u9/aarch6 iso_checksum = "fd2c1b1e26858576534f6e6c4cf000a15cd81bec010dad5e827b204a14a1750e" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-other-64" boot_command = ["e text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg x"] diff --git a/os_pkrvars/oracle/oracle-8-aarch64.pkrvars.hcl b/os_pkrvars/oracle/oracle-8-aarch64.pkrvars.hcl index dd1c6561d..8656e267d 100644 --- a/os_pkrvars/oracle/oracle-8-aarch64.pkrvars.hcl +++ b/os_pkrvars/oracle/oracle-8-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL8/u9/aarch6 iso_checksum = "c732ec9bb4a85349c0f1ca82020a8514341247506d114b8b79ec32bf99d59ea0" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-other-64" boot_command = ["e inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/8ks.cfg x"] diff --git a/os_pkrvars/oracle/oracle-9-aarch64.pkrvars.hcl b/os_pkrvars/oracle/oracle-9-aarch64.pkrvars.hcl index f5384427d..2357d748e 100644 --- a/os_pkrvars/oracle/oracle-9-aarch64.pkrvars.hcl +++ b/os_pkrvars/oracle/oracle-9-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL9/u3/aarch6 iso_checksum = "7cc50a48f361cb1100a28621ba455edaac3a38182f6dd3fe67588b3eeaf18dc3" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-rhel9-64" boot_command = ["e inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/9ks.cfg x"] diff --git a/os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl b/os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl index a6c26ef33..940473f9a 100644 --- a/os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl +++ b/os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://www.redhat.com/en/technologies/linux-platform iso_checksum = "1b8004961150b60f6c5ec3f25139d3217eee55707cf9fa19e826919fc58e328b" parallels_guest_os_type = "rhel" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-other-64" boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg"] diff --git a/os_pkrvars/rhel/rhel-8-aarch64.pkrvars.hcl b/os_pkrvars/rhel/rhel-8-aarch64.pkrvars.hcl index 0785f59d0..e5950dceb 100644 --- a/os_pkrvars/rhel/rhel-8-aarch64.pkrvars.hcl +++ b/os_pkrvars/rhel/rhel-8-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://www.redhat.com/en/technologies/linux-platform iso_checksum = "none" parallels_guest_os_type = "rhel" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-other-64" boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/8ks.cfg"] diff --git a/os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl b/os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl index 345324625..42d86f15d 100644 --- a/os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl +++ b/os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://www.redhat.com/en/technologies/linux-platform iso_checksum = "none" parallels_guest_os_type = "rhel" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-rhel9-64" boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/9ks.cfg"] diff --git a/os_pkrvars/rockylinux/rockylinux-8-aarch64.pkrvars.hcl b/os_pkrvars/rockylinux/rockylinux-8-aarch64.pkrvars.hcl index 9a542230e..8f769dde5 100644 --- a/os_pkrvars/rockylinux/rockylinux-8-aarch64.pkrvars.hcl +++ b/os_pkrvars/rockylinux/rockylinux-8-aarch64.pkrvars.hcl @@ -5,5 +5,5 @@ iso_url = "https://download.rockylinux.org/pub/rocky/8/isos/aarc iso_checksum = "file:https://download.rockylinux.org/pub/rocky/8/isos/aarch64/CHECKSUM" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-centos-64" +vmware_guest_os_type = "arm-other-64" boot_command = ["e inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/8ks.cfg x"] diff --git a/packer_templates/scripts/_common/vmware_rhel.sh b/packer_templates/scripts/_common/vmware_rhel.sh index 835230df6..d8f8e7399 100644 --- a/packer_templates/scripts/_common/vmware_rhel.sh +++ b/packer_templates/scripts/_common/vmware_rhel.sh @@ -1,18 +1,20 @@ -#!/bin/sh -eux +#!/bin/bash -eux # set a default HOME_DIR environment variable if not set -HOME_DIR="${HOME_DIR:-/home/vagrant}"; +HOME_DIR="${HOME_DIR:-/home/vagrant}" case "$PACKER_BUILDER_TYPE" in vmware-iso|vmware-vmx) - # determine the major EL version we're runninng - major_version="$(sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release | awk -F. '{print $1}')"; + # determine the major EL version we're runninng + major_version="$(sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release | awk -F. '{print $1}')" - # make sure we use dnf on EL 8+ - if [ "$major_version" -ge 8 ]; then - dnf -y install open-vm-tools - else - yum -y install open-vm-tools - fi - ;; + # make sure we use dnf on EL 8+ + if [ "$major_version" -ge 8 ]; then + dnf install -y open-vm-tools + else + yum install -y open-vm-tools + fi + + systemctl enable vmtoolsd + systemctl start vmtoolsd esac diff --git a/packer_templates/scripts/rhel/cleanup_dnf.sh b/packer_templates/scripts/rhel/cleanup_dnf.sh index 7f8ddd206..2018ca3c4 100644 --- a/packer_templates/scripts/rhel/cleanup_dnf.sh +++ b/packer_templates/scripts/rhel/cleanup_dnf.sh @@ -26,9 +26,9 @@ echo "clean all package cache information" dnf -y clean all --enablerepo=\* # Clean up network interface persistence -rm -f /etc/udev/rules.d/70-persistent-net.rules; +rm -rf /etc/udev/rules.d/70-persistent-net.rules; mkdir -p /etc/udev/rules.d/70-persistent-net.rules; -rm -f /lib/udev/rules.d/75-persistent-net-generator.rules; +rm -rf /lib/udev/rules.d/75-persistent-net-generator.rules; rm -rf /dev/.udev/; if test -f /etc/sysconfig/network-scripts/ifcfg-*; then From 5473647386a5730270c0e33aa0e23f1ec9299a89 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 15:56:46 -0500 Subject: [PATCH 04/19] testing --- lib/bento/runner.rb | 2 +- ...onlinux-2023-x86_64-virtualbox.pkrvars.hcl | 27 +++++-------------- packer_templates/pkr-sources.pkr.hcl | 10 +++---- packer_templates/pkr-variables.pkr.hcl | 12 ++++++--- 4 files changed, 19 insertions(+), 32 deletions(-) diff --git a/lib/bento/runner.rb b/lib/bento/runner.rb index 9c3331622..fdeda596f 100644 --- a/lib/bento/runner.rb +++ b/lib/bento/runner.rb @@ -17,7 +17,7 @@ def initialize(opts) @dry_run = opts.dry_run @metadata_only = opts.metadata_only @debug = opts.debug - @only = opts.only ||= 'parallels-iso.vm,virtualbox-iso.vm,vmware-iso.vm,qemu.vm' + @only = opts.only @except = opts.except @mirror = opts.mirror @headed = opts.headed ||= false diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl index 149c0912f..00a75e77d 100644 --- a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl +++ b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl @@ -1,26 +1,11 @@ -os_name = "amazonlinux" -os_version = "2023" -os_arch = "x86_64" +os_name = "amazonlinux" +os_version = "2023" +os_arch = "x86_64" parallels_guest_os_type = "fedora-core" vbox_guest_os_type = "Fedora_64" vmware_guest_os_type = "fedora-64" sources_enabled = [ - "source.virtualbox-ovf.amazonlinux" + "source.virtualbox-ovf.vm" ] -#vboxmanage = [ -# [ -# "modifyvm", -# "{{ .Name }}", -# "--memory", -# "2048", -# "--cpus", -# "2", -# "--audio", -# "none", -# "--nat-localhostreachable1", -# "on", -# ] -#] -iso_url = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240219.0/vmware/al2023-vmware_esx-2023.3.20240219.0-kernel-6.1-x86_64.xfs.gpt.ova" -iso_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240219.0/vmware/SHA256SUMS" -#boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg"] +vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240219.0/vmware/al2023-vmware_esx-2023.3.20240219.0-kernel-6.1-x86_64.xfs.gpt.ova" +vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240219.0/vmware/SHA256SUMS" diff --git a/packer_templates/pkr-sources.pkr.hcl b/packer_templates/pkr-sources.pkr.hcl index 711f53744..db0b9ab12 100644 --- a/packer_templates/pkr-sources.pkr.hcl +++ b/packer_templates/pkr-sources.pkr.hcl @@ -54,11 +54,6 @@ locals { var.is_windows ? "attach" : "upload" ) : var.vbox_guest_additions_mode - # virtualbox-ovf - vbox_source = var.vbox_source == null ? ( - var.os_name == "amazonlinux" ? "${path.root}/amz_working_files/amazon2.ovf" : null - ) : var.vbox_source - # vmware-iso vmware_tools_upload_flavor = var.vmware_tools_upload_flavor == null ? ( var.is_windows ? "windows" : "linux" @@ -247,10 +242,11 @@ source "virtualbox-iso" "vm" { winrm_username = var.winrm_username vm_name = local.vm_name } -source "virtualbox-ovf" "amazonlinux" { +source "virtualbox-ovf" "vm" { # Virtualbox specific options guest_additions_path = var.vbox_guest_additions_path - source_path = local.vbox_source + source_path = local.vbox_source_path + checksum = var.vbox_checksum vboxmanage = var.vboxmanage virtualbox_version_file = var.virtualbox_version_file # Source block common options diff --git a/packer_templates/pkr-variables.pkr.hcl b/packer_templates/pkr-variables.pkr.hcl index 0f3c5de39..855eeb994 100644 --- a/packer_templates/pkr-variables.pkr.hcl +++ b/packer_templates/pkr-variables.pkr.hcl @@ -215,9 +215,15 @@ variable "virtualbox_version_file" { } # virtualbox-ovf -variable "vbox_source" { - type = string - default = null +variable "vbox_source_path" { + type = string + default = null + description = "Path to the OVA/OVF file" +} +variable "vbox_checksum" { + type = string + default = null + description = "Checksum of the OVA/OVF file" } # vmware-iso From 65ab76eda667ecb82ce7f733efe98a0d28122b89 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 16:02:34 -0500 Subject: [PATCH 05/19] testing --- lib/bento/runner.rb | 4 ++-- packer_templates/pkr-variables.pkr.hcl | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/bento/runner.rb b/lib/bento/runner.rb index fdeda596f..b59554dcc 100644 --- a/lib/bento/runner.rb +++ b/lib/bento/runner.rb @@ -17,7 +17,7 @@ def initialize(opts) @dry_run = opts.dry_run @metadata_only = opts.metadata_only @debug = opts.debug - @only = opts.only + @only = opts.only ||= nil @except = opts.except @mirror = opts.mirror @headed = opts.headed ||= false @@ -87,7 +87,7 @@ def packer_build_cmd(template, _var_file) var_files.each do |var_file| cmd.insert(5, "-var-file=#{var_file}") if File.exist?(var_file) end if var_files - cmd.insert(4, "-only=#{only}") + cmd.insert(4, "-only=#{only}") if only cmd.insert(4, "-except=#{except}") if except # Build the command line in the correct order and without spaces as future input for the splat operator. cmd.insert(4, "-var cpus=#{cpus}") if cpus diff --git a/packer_templates/pkr-variables.pkr.hcl b/packer_templates/pkr-variables.pkr.hcl index 855eeb994..ccde6ce5b 100644 --- a/packer_templates/pkr-variables.pkr.hcl +++ b/packer_templates/pkr-variables.pkr.hcl @@ -38,7 +38,6 @@ variable "no_proxy" { variable "sources_enabled" { type = list(string) default = [ - "source.hyperv-iso.vm", "source.parallels-iso.vm", "source.qemu.vm", "source.virtualbox-iso.vm", From 7dfe43de9e75bcdd33a1b6ab41adaf7dfd93c9a1 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 16:04:05 -0500 Subject: [PATCH 06/19] testing --- packer_templates/pkr-sources.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packer_templates/pkr-sources.pkr.hcl b/packer_templates/pkr-sources.pkr.hcl index db0b9ab12..2fe6dbb03 100644 --- a/packer_templates/pkr-sources.pkr.hcl +++ b/packer_templates/pkr-sources.pkr.hcl @@ -245,7 +245,7 @@ source "virtualbox-iso" "vm" { source "virtualbox-ovf" "vm" { # Virtualbox specific options guest_additions_path = var.vbox_guest_additions_path - source_path = local.vbox_source_path + source_path = var.vbox_source_path checksum = var.vbox_checksum vboxmanage = var.vboxmanage virtualbox_version_file = var.virtualbox_version_file From 4d33f1ebb1718d5d2fe7f534ce1bcf69f3204262 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 17:44:49 -0500 Subject: [PATCH 07/19] testing --- .../amazonlinux-2-x86_64-virtualbox.pkrvars.hcl | 16 ++-------------- ...mazonlinux-2023-x86_64-virtualbox.pkrvars.hcl | 5 +++-- packer_templates/pkr-variables.pkr.hcl | 2 +- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl index 4707acc7d..871c99600 100644 --- a/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl +++ b/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl @@ -1,21 +1,9 @@ os_name = "amazonlinux" os_version = "2" os_arch = "x86_64" +vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/al2023-vmware_esx-2023.3.20240312.0-kernel-6.1-x86_64.xfs.gpt.ova" +vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/SHA256SUMS" vbox_guest_os_type = "RedHat_64" sources_enabled = [ "source.virtualbox-ovf.amazonlinux" ] -vboxmanage = [ - [ - "modifyvm", - "{{ .Name }}", - "--memory", - "2048", - "--cpus", - "2", - "--audio", - "none", - "--nat-localhostreachable1", - "on", - ] -] diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl index 00a75e77d..23f61e4e2 100644 --- a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl +++ b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl @@ -1,11 +1,12 @@ os_name = "amazonlinux" os_version = "2023" os_arch = "x86_64" +vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/al2023-vmware_esx-2023.3.20240312.0-kernel-6.1-x86_64.xfs.gpt.ova" +vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/SHA256SUMS" parallels_guest_os_type = "fedora-core" vbox_guest_os_type = "Fedora_64" vmware_guest_os_type = "fedora-64" sources_enabled = [ "source.virtualbox-ovf.vm" ] -vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240219.0/vmware/al2023-vmware_esx-2023.3.20240219.0-kernel-6.1-x86_64.xfs.gpt.ova" -vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240219.0/vmware/SHA256SUMS" + diff --git a/packer_templates/pkr-variables.pkr.hcl b/packer_templates/pkr-variables.pkr.hcl index ccde6ce5b..a09aca878 100644 --- a/packer_templates/pkr-variables.pkr.hcl +++ b/packer_templates/pkr-variables.pkr.hcl @@ -255,7 +255,7 @@ variable "vmware_tools_upload_path" { } variable "vmware_version" { type = number - default = 20 + default = 21 } variable "vmware_vmx_data" { type = map(string) From 1784ecd51552985789340db22f74ea20e0421123 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 18:14:31 -0500 Subject: [PATCH 08/19] testing --- .gitignore | 1 + amazon_linux_2_virtualbox_build.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 175b1f75c..14efcc395 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.ovf *.vmdk *.vdi +*.qcow2 *.log virtualfloppy.vfd packer_cache/ diff --git a/amazon_linux_2_virtualbox_build.sh b/amazon_linux_2_virtualbox_build.sh index e5cff7428..a57c99ffd 100755 --- a/amazon_linux_2_virtualbox_build.sh +++ b/amazon_linux_2_virtualbox_build.sh @@ -36,7 +36,7 @@ echo "Creating the VM" # from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html VBoxManage createvm --name $VM --ostype "RedHat_64" --register VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon.vdi +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2.vdi VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso VBoxManage modifyvm $VM --memory 2048 VBoxManage modifyvm $VM --cpus 2 @@ -59,7 +59,7 @@ echo Deleting the VM vboxmanage unregistervm $VM --delete echo starting packer build of amazonlinux -if packer build -timestamp-ui -only=virtualbox-ovf.amazonlinux -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then +if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2.vdi" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl "$AMZDIR"/../../packer_templates; then echo "Cleaning up files" rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso else From c8354ea965de06ae0edc7e2bad321f6df73db79d Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 18:20:30 -0500 Subject: [PATCH 09/19] testing --- amazon_linux_2_virtualbox_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amazon_linux_2_virtualbox_build.sh b/amazon_linux_2_virtualbox_build.sh index a57c99ffd..c1684f1f0 100755 --- a/amazon_linux_2_virtualbox_build.sh +++ b/amazon_linux_2_virtualbox_build.sh @@ -59,7 +59,7 @@ echo Deleting the VM vboxmanage unregistervm $VM --delete echo starting packer build of amazonlinux -if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2.vdi" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl "$AMZDIR"/../../packer_templates; then +if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl "$AMZDIR"/../../packer_templates; then echo "Cleaning up files" rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso else From 08f6cf2302759af42bff903bc9994476f71406b4 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 18:27:15 -0500 Subject: [PATCH 10/19] testing --- .../amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl index 871c99600..e734c0874 100644 --- a/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl +++ b/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl @@ -5,5 +5,5 @@ vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.202403 vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/SHA256SUMS" vbox_guest_os_type = "RedHat_64" sources_enabled = [ - "source.virtualbox-ovf.amazonlinux" + "source.virtualbox-ovf.vm" ] From 92b05f98a1f13127b65e735657df4ea5e7235c02 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 19:15:23 -0500 Subject: [PATCH 11/19] testing --- amazon_linux_2023_build.sh | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/amazon_linux_2023_build.sh b/amazon_linux_2023_build.sh index d935dc3c9..83b442c09 100755 --- a/amazon_linux_2023_build.sh +++ b/amazon_linux_2023_build.sh @@ -8,15 +8,18 @@ cd "$SCRIPT_RELATIVE_DIR" || exit AMZDIR="$(pwd)/packer_templates/amz_working_files" # Get virtualbox vdi file name with latest version number -IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" +IMG="$(wget -q https://cdn.amazonlinux.com/al2023/os-images/latest/kvm/ -O - | grep ".qcow2" | cut -d "\"" -f 2)" -# Download vbox vdi -echo "Downloading Vbox VDI $IMG" -wget -q -O "$AMZDIR"/amazon.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" +# Download image +echo "Downloading $IMG" +wget -q -O "$AMZDIR"/amazon22023.qcow2 -c https://cdn.amazonlinux.com/al2023/os-images/latest/kvm/"$IMG" -if [ ! -f "$AMZDIR"/amazon.vdi ]; then - echo There must be a file named amazon.vdi in "$AMZDIR"! - echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ +echo "Convert qcow2 to vdi" +qemu-img convert -f qcow2 "$AMZDIR"/amazon22023.qcow2 -O vdi "$AMZDIR"/amazon22023.vdi + +if [ ! -f "$AMZDIR"/amazon22023.vdi ]; then + echo There must be a file named amazon22023.vdi in "$AMZDIR"! + echo You can download the files at https://cdn.amazonlinux.com/al2023/os-images/latest/ exit 1 fi @@ -34,9 +37,9 @@ sleep 5 echo "Creating the VM" # from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html -VBoxManage createvm --name $VM --ostype "RedHat_64" --register +VBoxManage createvm --name $VM --ostype "Fedora_64" --register VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon.vdi +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon22023.vdi VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso VBoxManage modifyvm $VM --memory 2048 VBoxManage modifyvm $VM --cpus 2 @@ -44,24 +47,24 @@ VBoxManage modifyvm $VM --audio-driver none VBoxManage modifyvm $VM --ioapic on sleep 5 -echo Sleeping for 120 seconds to let the system boot and cloud-init to run +echo "Sleeping for 120 seconds to let the system boot and cloud-init to run" VBoxManage startvm $VM --type headless sleep 120 VBoxManage controlvm $VM poweroff --type headless VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none sleep 5 -echo Exporting the VM to an OVF file -vboxmanage export $VM -o "$AMZDIR"/amazon2.ovf +echo "Exporting the VM to an OVF file"" +vboxmanage export $VM -o "$AMZDIR"/amazon22023.ovf sleep 5 -echo Deleting the VM +echo "Deleting the VM"" vboxmanage unregistervm $VM --delete -echo starting packer build of amazonlinux -if packer build -timestamp-ui -only=virtualbox-ovf.amazonlinux -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then +echo "starting packer build of amazonlinux" +if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon22023.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl "$AMZDIR"/../../packer_templates; then echo "Cleaning up files" - rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso + rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso "$AMZDIR"/*.vdi "$AMZDIR"/*.qcow2 else exit 1 fi From e68ea3b39d5f9850889707bb582fd78cc3599ab3 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 19:24:14 -0500 Subject: [PATCH 12/19] testing --- amazon_linux_2023_build.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/amazon_linux_2023_build.sh b/amazon_linux_2023_build.sh index 83b442c09..f6b9f6fc0 100755 --- a/amazon_linux_2023_build.sh +++ b/amazon_linux_2023_build.sh @@ -12,13 +12,13 @@ IMG="$(wget -q https://cdn.amazonlinux.com/al2023/os-images/latest/kvm/ -O - | g # Download image echo "Downloading $IMG" -wget -q -O "$AMZDIR"/amazon22023.qcow2 -c https://cdn.amazonlinux.com/al2023/os-images/latest/kvm/"$IMG" +wget -q -O "$AMZDIR"/amazon2023.qcow2 -c https://cdn.amazonlinux.com/al2023/os-images/latest/kvm/"$IMG" echo "Convert qcow2 to vdi" -qemu-img convert -f qcow2 "$AMZDIR"/amazon22023.qcow2 -O vdi "$AMZDIR"/amazon22023.vdi +qemu-img convert -f qcow2 "$AMZDIR"/amazon2023.qcow2 -O vdi "$AMZDIR"/amazon2023.vdi -if [ ! -f "$AMZDIR"/amazon22023.vdi ]; then - echo There must be a file named amazon22023.vdi in "$AMZDIR"! +if [ ! -f "$AMZDIR"/amazon2023.vdi ]; then + echo There must be a file named amazon2023.vdi in "$AMZDIR"! echo You can download the files at https://cdn.amazonlinux.com/al2023/os-images/latest/ exit 1 fi @@ -39,8 +39,9 @@ echo "Creating the VM" # from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html VBoxManage createvm --name $VM --ostype "Fedora_64" --register VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon22023.vdi -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage storagectl $VM --name "SATA CDROM" --add sata --controller IntelAHCI +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2023.vdi +VBoxManage storageattach $VM --storagectl "SATA CDROM" --port 0 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso VBoxManage modifyvm $VM --memory 2048 VBoxManage modifyvm $VM --cpus 2 VBoxManage modifyvm $VM --audio-driver none @@ -51,18 +52,18 @@ echo "Sleeping for 120 seconds to let the system boot and cloud-init to run" VBoxManage startvm $VM --type headless sleep 120 VBoxManage controlvm $VM poweroff --type headless -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none +VBoxManage storageattach $VM --storagectl "SATA CDROM" --port 0 --device 0 --type dvddrive --medium none sleep 5 -echo "Exporting the VM to an OVF file"" -vboxmanage export $VM -o "$AMZDIR"/amazon22023.ovf +echo "Exporting the VM to an OVF file" +vboxmanage export $VM -o "$AMZDIR"/amazon2023.ovf sleep 5 -echo "Deleting the VM"" +echo "Deleting the VM" vboxmanage unregistervm $VM --delete echo "starting packer build of amazonlinux" -if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon22023.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl "$AMZDIR"/../../packer_templates; then +if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2023.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl "$AMZDIR"/../../packer_templates; then echo "Cleaning up files" rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso "$AMZDIR"/*.vdi "$AMZDIR"/*.qcow2 else From 9e6c308eec7ba4529240c807abbe94cc0f35f42c Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 19:39:21 -0500 Subject: [PATCH 13/19] testing --- amazon_linux_2_hyperv_build.sh | 67 ------------------------- amazon_linux_2_parallels_build.sh | 67 ------------------------- amazon_linux_2_vmware_build.sh | 67 ------------------------- packer_templates/amz_seed_iso/user-data | 6 ++- 4 files changed, 4 insertions(+), 203 deletions(-) delete mode 100755 amazon_linux_2_hyperv_build.sh delete mode 100755 amazon_linux_2_parallels_build.sh delete mode 100755 amazon_linux_2_vmware_build.sh diff --git a/amazon_linux_2_hyperv_build.sh b/amazon_linux_2_hyperv_build.sh deleted file mode 100755 index e5cff7428..000000000 --- a/amazon_linux_2_hyperv_build.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -# Getting script directory location -SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") -cd "$SCRIPT_RELATIVE_DIR" || exit - -# set tmp dir for files -AMZDIR="$(pwd)/packer_templates/amz_working_files" - -# Get virtualbox vdi file name with latest version number -IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" - -# Download vbox vdi -echo "Downloading Vbox VDI $IMG" -wget -q -O "$AMZDIR"/amazon2.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" - -if [ ! -f "$AMZDIR"/amazon2.vdi ]; then - echo There must be a file named amazon2.vdi in "$AMZDIR"! - echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ - exit 1 -fi - -echo "Cleaning up old files" -rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk - -echo "Creating ISO" -hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso - -VM="AmazonLinuxBento" -echo Powering off and deleting any existing VMs named $VM -VBoxManage controlvm $VM poweroff --type headless 2> /dev/null -VBoxManage unregistervm $VM --delete 2> /dev/null -sleep 5 - -echo "Creating the VM" -# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html -VBoxManage createvm --name $VM --ostype "RedHat_64" --register -VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon.vdi -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso -VBoxManage modifyvm $VM --memory 2048 -VBoxManage modifyvm $VM --cpus 2 -VBoxManage modifyvm $VM --audio-driver none -VBoxManage modifyvm $VM --ioapic on -sleep 5 - -echo Sleeping for 120 seconds to let the system boot and cloud-init to run -VBoxManage startvm $VM --type headless -sleep 120 -VBoxManage controlvm $VM poweroff --type headless -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none -sleep 5 - -echo Exporting the VM to an OVF file -vboxmanage export $VM -o "$AMZDIR"/amazon2.ovf -sleep 5 - -echo Deleting the VM -vboxmanage unregistervm $VM --delete - -echo starting packer build of amazonlinux -if packer build -timestamp-ui -only=virtualbox-ovf.amazonlinux -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then - echo "Cleaning up files" - rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso -else - exit 1 -fi diff --git a/amazon_linux_2_parallels_build.sh b/amazon_linux_2_parallels_build.sh deleted file mode 100755 index e5cff7428..000000000 --- a/amazon_linux_2_parallels_build.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -# Getting script directory location -SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") -cd "$SCRIPT_RELATIVE_DIR" || exit - -# set tmp dir for files -AMZDIR="$(pwd)/packer_templates/amz_working_files" - -# Get virtualbox vdi file name with latest version number -IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" - -# Download vbox vdi -echo "Downloading Vbox VDI $IMG" -wget -q -O "$AMZDIR"/amazon2.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" - -if [ ! -f "$AMZDIR"/amazon2.vdi ]; then - echo There must be a file named amazon2.vdi in "$AMZDIR"! - echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ - exit 1 -fi - -echo "Cleaning up old files" -rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk - -echo "Creating ISO" -hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso - -VM="AmazonLinuxBento" -echo Powering off and deleting any existing VMs named $VM -VBoxManage controlvm $VM poweroff --type headless 2> /dev/null -VBoxManage unregistervm $VM --delete 2> /dev/null -sleep 5 - -echo "Creating the VM" -# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html -VBoxManage createvm --name $VM --ostype "RedHat_64" --register -VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon.vdi -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso -VBoxManage modifyvm $VM --memory 2048 -VBoxManage modifyvm $VM --cpus 2 -VBoxManage modifyvm $VM --audio-driver none -VBoxManage modifyvm $VM --ioapic on -sleep 5 - -echo Sleeping for 120 seconds to let the system boot and cloud-init to run -VBoxManage startvm $VM --type headless -sleep 120 -VBoxManage controlvm $VM poweroff --type headless -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none -sleep 5 - -echo Exporting the VM to an OVF file -vboxmanage export $VM -o "$AMZDIR"/amazon2.ovf -sleep 5 - -echo Deleting the VM -vboxmanage unregistervm $VM --delete - -echo starting packer build of amazonlinux -if packer build -timestamp-ui -only=virtualbox-ovf.amazonlinux -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then - echo "Cleaning up files" - rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso -else - exit 1 -fi diff --git a/amazon_linux_2_vmware_build.sh b/amazon_linux_2_vmware_build.sh deleted file mode 100755 index e5cff7428..000000000 --- a/amazon_linux_2_vmware_build.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -# Getting script directory location -SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") -cd "$SCRIPT_RELATIVE_DIR" || exit - -# set tmp dir for files -AMZDIR="$(pwd)/packer_templates/amz_working_files" - -# Get virtualbox vdi file name with latest version number -IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" - -# Download vbox vdi -echo "Downloading Vbox VDI $IMG" -wget -q -O "$AMZDIR"/amazon2.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" - -if [ ! -f "$AMZDIR"/amazon2.vdi ]; then - echo There must be a file named amazon2.vdi in "$AMZDIR"! - echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ - exit 1 -fi - -echo "Cleaning up old files" -rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk - -echo "Creating ISO" -hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso - -VM="AmazonLinuxBento" -echo Powering off and deleting any existing VMs named $VM -VBoxManage controlvm $VM poweroff --type headless 2> /dev/null -VBoxManage unregistervm $VM --delete 2> /dev/null -sleep 5 - -echo "Creating the VM" -# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html -VBoxManage createvm --name $VM --ostype "RedHat_64" --register -VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon.vdi -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso -VBoxManage modifyvm $VM --memory 2048 -VBoxManage modifyvm $VM --cpus 2 -VBoxManage modifyvm $VM --audio-driver none -VBoxManage modifyvm $VM --ioapic on -sleep 5 - -echo Sleeping for 120 seconds to let the system boot and cloud-init to run -VBoxManage startvm $VM --type headless -sleep 120 -VBoxManage controlvm $VM poweroff --type headless -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none -sleep 5 - -echo Exporting the VM to an OVF file -vboxmanage export $VM -o "$AMZDIR"/amazon2.ovf -sleep 5 - -echo Deleting the VM -vboxmanage unregistervm $VM --delete - -echo starting packer build of amazonlinux -if packer build -timestamp-ui -only=virtualbox-ovf.amazonlinux -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then - echo "Cleaning up files" - rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso -else - exit 1 -fi diff --git a/packer_templates/amz_seed_iso/user-data b/packer_templates/amz_seed_iso/user-data index 222eb4e59..b56afad0d 100644 --- a/packer_templates/amz_seed_iso/user-data +++ b/packer_templates/amz_seed_iso/user-data @@ -1,7 +1,9 @@ #cloud-config #vim:syntax=yaml -user: vagrant -password: vagrant +users: + - name: vagrant + plain_text_passwd: vagrant + sudo: ALL=(ALL) NOPASSWD:ALL # install packages for vbox guest additions to complete packages: From 96dad674d99736c6734d1cbf12f3ca3ed93d7b7b Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Mon, 18 Mar 2024 19:44:35 -0500 Subject: [PATCH 14/19] testing --- amazon_linux_2023_build.sh | 4 ++-- amazon_linux_2_virtualbox_build.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/amazon_linux_2023_build.sh b/amazon_linux_2023_build.sh index f6b9f6fc0..2d75c9b5d 100755 --- a/amazon_linux_2023_build.sh +++ b/amazon_linux_2023_build.sh @@ -41,7 +41,7 @@ VBoxManage createvm --name $VM --ostype "Fedora_64" --register VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI VBoxManage storagectl $VM --name "SATA CDROM" --add sata --controller IntelAHCI VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2023.vdi -VBoxManage storageattach $VM --storagectl "SATA CDROM" --port 0 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso VBoxManage modifyvm $VM --memory 2048 VBoxManage modifyvm $VM --cpus 2 VBoxManage modifyvm $VM --audio-driver none @@ -52,7 +52,7 @@ echo "Sleeping for 120 seconds to let the system boot and cloud-init to run" VBoxManage startvm $VM --type headless sleep 120 VBoxManage controlvm $VM poweroff --type headless -VBoxManage storageattach $VM --storagectl "SATA CDROM" --port 0 --device 0 --type dvddrive --medium none +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium none sleep 5 echo "Exporting the VM to an OVF file" diff --git a/amazon_linux_2_virtualbox_build.sh b/amazon_linux_2_virtualbox_build.sh index c1684f1f0..6cf04a2ff 100755 --- a/amazon_linux_2_virtualbox_build.sh +++ b/amazon_linux_2_virtualbox_build.sh @@ -37,7 +37,7 @@ echo "Creating the VM" VBoxManage createvm --name $VM --ostype "RedHat_64" --register VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2.vdi -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso VBoxManage modifyvm $VM --memory 2048 VBoxManage modifyvm $VM --cpus 2 VBoxManage modifyvm $VM --audio-driver none @@ -48,7 +48,7 @@ echo Sleeping for 120 seconds to let the system boot and cloud-init to run VBoxManage startvm $VM --type headless sleep 120 VBoxManage controlvm $VM poweroff --type headless -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 1 --type dvddrive --medium none +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium none sleep 5 echo Exporting the VM to an OVF file From a8b98d274dec7d1911759cb5169b43750bed5a6a Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 19 Mar 2024 23:15:58 -0500 Subject: [PATCH 15/19] Fixed AMZ Linux 2 and add 2023 build scripts --- amazon_linux_2023_build.sh | 71 ------------------- amazon_linux_2_virtualbox_build.sh | 67 ----------------- .../amazonlinux-2-aarch64-qemu.pkrvars.hcl | 12 ---- ...mazonlinux-2-x86_64-virtualbox.pkrvars.hcl | 9 --- .../amazonlinux-2023-aarch64-qemu.pkrvars.hcl | 17 ----- ...onlinux-2023-x86_64-virtualbox.pkrvars.hcl | 12 ---- packer_templates/amz_seed_iso/user-data | 26 ++----- packer_templates/pkr-builder.pkr.hcl | 2 +- 8 files changed, 6 insertions(+), 210 deletions(-) delete mode 100755 amazon_linux_2023_build.sh delete mode 100755 amazon_linux_2_virtualbox_build.sh delete mode 100644 os_pkrvars/amazonlinux/amazonlinux-2-aarch64-qemu.pkrvars.hcl delete mode 100644 os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl delete mode 100644 os_pkrvars/amazonlinux/amazonlinux-2023-aarch64-qemu.pkrvars.hcl delete mode 100644 os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl diff --git a/amazon_linux_2023_build.sh b/amazon_linux_2023_build.sh deleted file mode 100755 index 2d75c9b5d..000000000 --- a/amazon_linux_2023_build.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash - -# Getting script directory location -SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") -cd "$SCRIPT_RELATIVE_DIR" || exit - -# set tmp dir for files -AMZDIR="$(pwd)/packer_templates/amz_working_files" - -# Get virtualbox vdi file name with latest version number -IMG="$(wget -q https://cdn.amazonlinux.com/al2023/os-images/latest/kvm/ -O - | grep ".qcow2" | cut -d "\"" -f 2)" - -# Download image -echo "Downloading $IMG" -wget -q -O "$AMZDIR"/amazon2023.qcow2 -c https://cdn.amazonlinux.com/al2023/os-images/latest/kvm/"$IMG" - -echo "Convert qcow2 to vdi" -qemu-img convert -f qcow2 "$AMZDIR"/amazon2023.qcow2 -O vdi "$AMZDIR"/amazon2023.vdi - -if [ ! -f "$AMZDIR"/amazon2023.vdi ]; then - echo There must be a file named amazon2023.vdi in "$AMZDIR"! - echo You can download the files at https://cdn.amazonlinux.com/al2023/os-images/latest/ - exit 1 -fi - -echo "Cleaning up old files" -rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk - -echo "Creating ISO" -hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso - -VM="AmazonLinuxBento" -echo Powering off and deleting any existing VMs named $VM -VBoxManage controlvm $VM poweroff --type headless 2> /dev/null -VBoxManage unregistervm $VM --delete 2> /dev/null -sleep 5 - -echo "Creating the VM" -# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html -VBoxManage createvm --name $VM --ostype "Fedora_64" --register -VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI -VBoxManage storagectl $VM --name "SATA CDROM" --add sata --controller IntelAHCI -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2023.vdi -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso -VBoxManage modifyvm $VM --memory 2048 -VBoxManage modifyvm $VM --cpus 2 -VBoxManage modifyvm $VM --audio-driver none -VBoxManage modifyvm $VM --ioapic on -sleep 5 - -echo "Sleeping for 120 seconds to let the system boot and cloud-init to run" -VBoxManage startvm $VM --type headless -sleep 120 -VBoxManage controlvm $VM poweroff --type headless -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium none -sleep 5 - -echo "Exporting the VM to an OVF file" -vboxmanage export $VM -o "$AMZDIR"/amazon2023.ovf -sleep 5 - -echo "Deleting the VM" -vboxmanage unregistervm $VM --delete - -echo "starting packer build of amazonlinux" -if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2023.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl "$AMZDIR"/../../packer_templates; then - echo "Cleaning up files" - rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso "$AMZDIR"/*.vdi "$AMZDIR"/*.qcow2 -else - exit 1 -fi diff --git a/amazon_linux_2_virtualbox_build.sh b/amazon_linux_2_virtualbox_build.sh deleted file mode 100755 index 6cf04a2ff..000000000 --- a/amazon_linux_2_virtualbox_build.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -# Getting script directory location -SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") -cd "$SCRIPT_RELATIVE_DIR" || exit - -# set tmp dir for files -AMZDIR="$(pwd)/packer_templates/amz_working_files" - -# Get virtualbox vdi file name with latest version number -IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" - -# Download vbox vdi -echo "Downloading Vbox VDI $IMG" -wget -q -O "$AMZDIR"/amazon2.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" - -if [ ! -f "$AMZDIR"/amazon2.vdi ]; then - echo There must be a file named amazon2.vdi in "$AMZDIR"! - echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ - exit 1 -fi - -echo "Cleaning up old files" -rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk - -echo "Creating ISO" -hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso - -VM="AmazonLinuxBento" -echo Powering off and deleting any existing VMs named $VM -VBoxManage controlvm $VM poweroff --type headless 2> /dev/null -VBoxManage unregistervm $VM --delete 2> /dev/null -sleep 5 - -echo "Creating the VM" -# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html -VBoxManage createvm --name $VM --ostype "RedHat_64" --register -VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2.vdi -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso -VBoxManage modifyvm $VM --memory 2048 -VBoxManage modifyvm $VM --cpus 2 -VBoxManage modifyvm $VM --audio-driver none -VBoxManage modifyvm $VM --ioapic on -sleep 5 - -echo Sleeping for 120 seconds to let the system boot and cloud-init to run -VBoxManage startvm $VM --type headless -sleep 120 -VBoxManage controlvm $VM poweroff --type headless -VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium none -sleep 5 - -echo Exporting the VM to an OVF file -vboxmanage export $VM -o "$AMZDIR"/amazon2.ovf -sleep 5 - -echo Deleting the VM -vboxmanage unregistervm $VM --delete - -echo starting packer build of amazonlinux -if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl "$AMZDIR"/../../packer_templates; then - echo "Cleaning up files" - rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso -else - exit 1 -fi diff --git a/os_pkrvars/amazonlinux/amazonlinux-2-aarch64-qemu.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2-aarch64-qemu.pkrvars.hcl deleted file mode 100644 index 813c91c21..000000000 --- a/os_pkrvars/amazonlinux/amazonlinux-2-aarch64-qemu.pkrvars.hcl +++ /dev/null @@ -1,12 +0,0 @@ -os_name = "amazonlinux" -os_version = "2" -os_arch = "aarch64" -iso_url = "https://cdn.amazonlinux.com/os-images/2.0.20240131.0/kvm-arm64/amzn2-kvm-2.0.20240131.0-arm64.xfs.gpt.qcow2" -iso_checksum = "file:https://cdn.amazonlinux.com/os-images/2.0.20240131.0/kvm-arm64/SHA256SUMS" -qemu_disk_image = true -sources_enabled = [ - "source.qemu.vm" -] -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-rhel9-64" diff --git a/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl deleted file mode 100644 index e734c0874..000000000 --- a/os_pkrvars/amazonlinux/amazonlinux-2-x86_64-virtualbox.pkrvars.hcl +++ /dev/null @@ -1,9 +0,0 @@ -os_name = "amazonlinux" -os_version = "2" -os_arch = "x86_64" -vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/al2023-vmware_esx-2023.3.20240312.0-kernel-6.1-x86_64.xfs.gpt.ova" -vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/SHA256SUMS" -vbox_guest_os_type = "RedHat_64" -sources_enabled = [ - "source.virtualbox-ovf.vm" -] diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64-qemu.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64-qemu.pkrvars.hcl deleted file mode 100644 index dc37387fb..000000000 --- a/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64-qemu.pkrvars.hcl +++ /dev/null @@ -1,17 +0,0 @@ -os_name = "amazonlinux" -os_version = "2023" -os_arch = "aarch64" -iso_url = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240131.0/kvm-arm64/al2023-kvm-2023.3.20240131.0-kernel-6.1-arm64.xfs.gpt.qcow2" -iso_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240131.0/kvm-arm64/SHA256SUMS" -qemu_disk_image = true -cd_files = ["/Users/corey.hemminger/Documents/github/personal/chef/cookbooks/testing/bento/packer_templates/amz_seed_iso/*"] -qemu_efi_boot = true -qemu_efi_firmware_code = "/opt/homebrew/Cellar/qemu/8.2.1/share/qemu/edk2-arm-code.fd" -qemu_efi_firmware_vars = "/opt/homebrew/Cellar/qemu/8.2.1/share/qemu/edk2-arm-vars.fd" -qemu_efi_drop_efivars = null -sources_enabled = [ - "source.qemu.vm" -] -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-rhel9-64" diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl deleted file mode 100644 index 23f61e4e2..000000000 --- a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64-virtualbox.pkrvars.hcl +++ /dev/null @@ -1,12 +0,0 @@ -os_name = "amazonlinux" -os_version = "2023" -os_arch = "x86_64" -vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/al2023-vmware_esx-2023.3.20240312.0-kernel-6.1-x86_64.xfs.gpt.ova" -vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/SHA256SUMS" -parallels_guest_os_type = "fedora-core" -vbox_guest_os_type = "Fedora_64" -vmware_guest_os_type = "fedora-64" -sources_enabled = [ - "source.virtualbox-ovf.vm" -] - diff --git a/packer_templates/amz_seed_iso/user-data b/packer_templates/amz_seed_iso/user-data index b56afad0d..078342858 100644 --- a/packer_templates/amz_seed_iso/user-data +++ b/packer_templates/amz_seed_iso/user-data @@ -2,30 +2,14 @@ #vim:syntax=yaml users: - name: vagrant - plain_text_passwd: vagrant - sudo: ALL=(ALL) NOPASSWD:ALL + lock_passwd: false + passwd: $6$TbOu26d1hYO4EC/D$MymO7cTo/tID7tkH8TtAGyAdaK9nHwGQfDD9KwQmql3xP1BPPc67YCmoR8UO3Dw5jacOx3GvnBLqvAmHLHC4H0 + sudo: ALL=(ALL) NOPASSWD:ALL -# install packages for vbox guest additions to complete -packages: - - gcc - - kernel-devel - - kernel-headers - - dkms - - make - - bzip2 - - perl - -# make sure we don't setup the network on every boot +# Enable password authentication for SSH write_files: - - path: /etc/cloud/cloud.cfg.d/80_disable_network_after_firstboot.cfg - content: | - # Disable network configuration after first boot - network: - config: disabled - - path: /etc/cloud/cloud.cfg.d/90_enable_ssh_pwauth.cfg content: | runcmd: - sed -i "s/^PasswordAuthentication.*/PasswordAuthentication yes/" /etc/ssh/sshd_config - - sed -i "/^HWADDR/d" /etc/sysconfig/network-scripts/ifcfg-eth0 - - systemctl restart network sshd + - systemctl restart sshd diff --git a/packer_templates/pkr-builder.pkr.hcl b/packer_templates/pkr-builder.pkr.hcl index 4604def93..8111c87e4 100644 --- a/packer_templates/pkr-builder.pkr.hcl +++ b/packer_templates/pkr-builder.pkr.hcl @@ -114,7 +114,7 @@ locals { "${path.root}/scripts/fedora/cleanup_dnf.sh", "${path.root}/scripts/_common/minimize.sh" ] : ( - "${var.os_name}-${substr(var.os_version, 0, 1)}" == "amazonlinux-2" || + "${var.os_name}-${var.os_version}" == "amazonlinux-2" || "${var.os_name}-${substr(var.os_version, 0, 1)}" == "centos-7" || "${var.os_name}-${substr(var.os_version, 0, 1)}" == "oracle-7" || "${var.os_name}-${substr(var.os_version, 0, 1)}" == "rhel-7" ? [ From b5e2ea62149f08981b525362bc50b605e259b0ed Mon Sep 17 00:00:00 2001 From: Stromweld Date: Tue, 19 Mar 2024 23:21:13 -0500 Subject: [PATCH 16/19] Fixed AMZ Linux 2 and add 2023 build scripts --- amazonlinux-2-x86_64-virtualbox_build.sh | 67 +++++++++++++++++ amazonlinux-2023-aarch64-virtualbox-build.sh | 74 +++++++++++++++++++ amazonlinux-2023-x86_64-virtualbox-build.sh | 73 ++++++++++++++++++ .../amazonlinux-2-aarch64.pkrvars.hcl | 12 +++ .../amazonlinux-2-x86_64.pkrvars.hcl | 11 +++ .../amazonlinux-2023-aarch64.pkrvars.hcl | 17 +++++ .../amazonlinux-2023-x86_64.pkrvars.hcl | 11 +++ 7 files changed, 265 insertions(+) create mode 100755 amazonlinux-2-x86_64-virtualbox_build.sh create mode 100755 amazonlinux-2023-aarch64-virtualbox-build.sh create mode 100755 amazonlinux-2023-x86_64-virtualbox-build.sh create mode 100644 os_pkrvars/amazonlinux/amazonlinux-2-aarch64.pkrvars.hcl create mode 100644 os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl create mode 100644 os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl create mode 100644 os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl diff --git a/amazonlinux-2-x86_64-virtualbox_build.sh b/amazonlinux-2-x86_64-virtualbox_build.sh new file mode 100755 index 000000000..04cf24857 --- /dev/null +++ b/amazonlinux-2-x86_64-virtualbox_build.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +# Getting script directory location +SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") +cd "$SCRIPT_RELATIVE_DIR" || exit + +# set tmp dir for files +AMZDIR="$(pwd)/packer_templates/amz_working_files" + +# Get virtualbox vdi file name with latest version number +IMG="$(wget -q https://cdn.amazonlinux.com/os-images/latest/virtualbox/ -O - | grep ".vdi" | cut -d "\"" -f 2)" + +# Download vbox vdi +echo "Downloading Vbox VDI $IMG" +wget -q -O "$AMZDIR"/amazon2_x86_64.vdi -c https://cdn.amazonlinux.com/os-images/latest/virtualbox/"$IMG" + +if [ ! -f "$AMZDIR"/amazon2_x86_64.vdi ]; then + echo There must be a file named amazon2_x86_64.vdi in "$AMZDIR"! + echo You can download the vdi file at https://cdn.amazonlinux.com/os-images/latest/virtualbox/ + exit 1 +fi + +echo "Cleaning up old files" +rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk + +echo "Creating ISO" +hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso + +VM="AmazonLinuxBento" +echo Powering off and deleting any existing VMs named $VM +VBoxManage controlvm $VM poweroff --type headless 2> /dev/null +VBoxManage unregistervm $VM --delete 2> /dev/null +sleep 5 + +echo "Creating the VM" +# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html +VBoxManage createvm --name $VM --ostype "RedHat_64" --register +VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2_x86_64.vdi +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage modifyvm $VM --memory 2048 +VBoxManage modifyvm $VM --cpus 2 +VBoxManage modifyvm $VM --audio-driver none +VBoxManage modifyvm $VM --ioapic on +sleep 5 + +echo Sleeping for 120 seconds to let the system boot and cloud-init to run +VBoxManage startvm $VM --type headless +sleep 120 +VBoxManage controlvm $VM poweroff --type headless +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium none +sleep 5 + +echo Exporting the VM to an OVF file +vboxmanage export $VM -o "$AMZDIR"/amazon2_x86_64.ovf +sleep 5 + +echo Deleting the VM +vboxmanage unregistervm $VM --delete + +echo starting packer build of amazonlinux +if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2_x86_64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then + echo "Cleaning up files" + rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso +else + exit 1 +fi diff --git a/amazonlinux-2023-aarch64-virtualbox-build.sh b/amazonlinux-2023-aarch64-virtualbox-build.sh new file mode 100755 index 000000000..54ffdd934 --- /dev/null +++ b/amazonlinux-2023-aarch64-virtualbox-build.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +# Getting script directory location +SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") +cd "$SCRIPT_RELATIVE_DIR" || exit + +# set tmp dir for files +AMZDIR="$(pwd)/packer_templates/amz_working_files" + +echo "Cleaning up old files" +rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.vdi + +# Get virtualbox vdi file name with latest version number +IMG="$(wget -q https://cdn.amazonlinux.com/al2023/os-images/latest/kvm-arm64/ -O - | grep ".qcow2" | cut -d "\"" -f 2)" + +echo "Downloading $IMG" +wget -q -O "$AMZDIR"/amazon2023_arm64.qcow2 -c https://cdn.amazonlinux.com/al2023/os-images/latest/kvm-arm64/"$IMG" + +echo "Convert qcow2 to vdi" +qemu-img convert -f qcow2 "$AMZDIR"/amazon2023_arm64.qcow2 -O vdi "$AMZDIR"/amazon2023_arm64.vdi + +if [ ! -f "$AMZDIR"/amazon2023_arm64.vdi ]; then + echo There must be a file named amazon2023_arm64.vdi in "$AMZDIR"! + echo You can download the files at https://cdn.amazonlinux.com/al2023/os-images/latest/ + exit 1 +fi + +echo "Creating ISO" +hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso + +VM="AmazonLinuxBento" +echo Powering off and deleting any existing VMs named $VM +VBoxManage controlvm $VM poweroff --type headless 2> /dev/null +VBoxManage unregistervm $VM --delete 2> /dev/null +sleep 5 + +echo "Creating the VM" +# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html +VBoxManage createvm --name $VM --ostype "Fedora_64" --register +VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2023_arm64.vdi +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage modifyvm $VM --firmware efi +VBoxManage modifyvm $VM --memory 2048 +VBoxManage modifyvm $VM --cpus 2 +VBoxManage modifyvm $VM --nat-localhostreachable1 on +VBoxManage modifyvm $VM --vram 10 +VBoxManage modifyvm $VM --graphicscontroller vmsvga +VBoxManage modifyvm $VM --vrde off +VBoxManage modifyvm $VM --audio-driver none +VBoxManage modifyvm $VM --ioapic on +sleep 5 + +echo "Sleeping for 120 seconds to let the system boot and cloud-init to run" +VBoxManage startvm $VM --type headless +sleep 120 +VBoxManage controlvm $VM poweroff --type headless +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium none +sleep 5 + +echo "Exporting the VM to an OVF file" +vboxmanage export $VM -o "$AMZDIR"/amazon2023_arm64.ovf +sleep 5 + +echo "Deleting the VM" +vboxmanage unregistervm $VM --delete + +echo "starting packer build of amazonlinux" +if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2023_arm64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then + echo "Cleaning up files" + rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso "$AMZDIR"/*.vdi "$AMZDIR"/*.qcow2 +else + exit 1 +fi diff --git a/amazonlinux-2023-x86_64-virtualbox-build.sh b/amazonlinux-2023-x86_64-virtualbox-build.sh new file mode 100755 index 000000000..95e73f1fe --- /dev/null +++ b/amazonlinux-2023-x86_64-virtualbox-build.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +# Getting script directory location +SCRIPT_RELATIVE_DIR=$(dirname "${BASH_SOURCE[0]}") +cd "$SCRIPT_RELATIVE_DIR" || exit + +# set tmp dir for files +AMZDIR="$(pwd)/packer_templates/amz_working_files" + +echo "Cleaning up old files" +rm -f "$AMZDIR"/*.iso "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.vdi + +# Get virtualbox vdi file name with latest version number +IMG="$(wget -q https://cdn.amazonlinux.com/al2023/os-images/latest/kvm/ -O - | grep ".qcow2" | cut -d "\"" -f 2)" + +echo "Downloading $IMG" +wget -q -O "$AMZDIR"/amazon2023_x86_64.qcow2 -c https://cdn.amazonlinux.com/al2023/os-images/latest/kvm/"$IMG" + +echo "Convert qcow2 to vdi" +qemu-img convert -f qcow2 "$AMZDIR"/amazon2023_x86_64.qcow2 -O vdi "$AMZDIR"/amazon2023_x86_64.vdi + +if [ ! -f "$AMZDIR"/amazon2023_x86_64.vdi ]; then + echo There must be a file named amazon2023_x86_64.vdi in "$AMZDIR"! + echo You can download the files at https://cdn.amazonlinux.com/al2023/os-images/latest/ + exit 1 +fi + +echo "Creating ISO" +hdiutil makehybrid -o "$AMZDIR"/seed.iso -hfs -joliet -iso -default-volume-name cidata "$AMZDIR"/../amz_seed_iso + +VM="AmazonLinuxBento" +echo Powering off and deleting any existing VMs named $VM +VBoxManage controlvm $VM poweroff --type headless 2> /dev/null +VBoxManage unregistervm $VM --delete 2> /dev/null +sleep 5 + +echo "Creating the VM" +# from https://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html +VBoxManage createvm --name $VM --ostype "Fedora_64" --register +VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2023_x86_64.vdi +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage modifyvm $VM --memory 2048 +VBoxManage modifyvm $VM --cpus 2 +VBoxManage modifyvm $VM --nat-localhostreachable1 on +VBoxManage modifyvm $VM --vram 10 +VBoxManage modifyvm $VM --graphicscontroller vmsvga +VBoxManage modifyvm $VM --vrde off +VBoxManage modifyvm $VM --audio-driver none +VBoxManage modifyvm $VM --ioapic on +sleep 5 + +echo "Sleeping for 120 seconds to let the system boot and cloud-init to run" +VBoxManage startvm $VM --type headless +sleep 120 +VBoxManage controlvm $VM poweroff --type headless +VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium none +sleep 5 + +echo "Exporting the VM to an OVF file" +vboxmanage export $VM -o "$AMZDIR"/amazon2023_x86_64.ovf +sleep 5 + +echo "Deleting the VM" +vboxmanage unregistervm $VM --delete + +echo "starting packer build of amazonlinux" +if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2023_x86_64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then + echo "Cleaning up files" + rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso "$AMZDIR"/*.vdi "$AMZDIR"/*.qcow2 +else + exit 1 +fi diff --git a/os_pkrvars/amazonlinux/amazonlinux-2-aarch64.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2-aarch64.pkrvars.hcl new file mode 100644 index 000000000..813c91c21 --- /dev/null +++ b/os_pkrvars/amazonlinux/amazonlinux-2-aarch64.pkrvars.hcl @@ -0,0 +1,12 @@ +os_name = "amazonlinux" +os_version = "2" +os_arch = "aarch64" +iso_url = "https://cdn.amazonlinux.com/os-images/2.0.20240131.0/kvm-arm64/amzn2-kvm-2.0.20240131.0-arm64.xfs.gpt.qcow2" +iso_checksum = "file:https://cdn.amazonlinux.com/os-images/2.0.20240131.0/kvm-arm64/SHA256SUMS" +qemu_disk_image = true +sources_enabled = [ + "source.qemu.vm" +] +parallels_guest_os_type = "centos" +vbox_guest_os_type = "RedHat_64" +vmware_guest_os_type = "arm-rhel9-64" diff --git a/os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl new file mode 100644 index 000000000..08baf9a58 --- /dev/null +++ b/os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl @@ -0,0 +1,11 @@ +os_name = "amazonlinux" +os_version = "2" +os_arch = "x86_64" +vbox_source_path = "https://cdn.amazonlinux.com/os-images/latest/virtualbox/amzn2-virtualbox-2.0.20240306.2-x86_64.xfs.gpt.vdi" +vbox_checksum = "file:https://cdn.amazonlinux.com/os-images/latest/virtualbox/SHA256SUMS" +parallels_guest_os_type = "centos" +vbox_guest_os_type = "RedHat_64" +vmware_guest_os_type = "rhel9-64" +sources_enabled = [ + "source.virtualbox-ovf.vm" +] diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl new file mode 100644 index 000000000..dc37387fb --- /dev/null +++ b/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl @@ -0,0 +1,17 @@ +os_name = "amazonlinux" +os_version = "2023" +os_arch = "aarch64" +iso_url = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240131.0/kvm-arm64/al2023-kvm-2023.3.20240131.0-kernel-6.1-arm64.xfs.gpt.qcow2" +iso_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240131.0/kvm-arm64/SHA256SUMS" +qemu_disk_image = true +cd_files = ["/Users/corey.hemminger/Documents/github/personal/chef/cookbooks/testing/bento/packer_templates/amz_seed_iso/*"] +qemu_efi_boot = true +qemu_efi_firmware_code = "/opt/homebrew/Cellar/qemu/8.2.1/share/qemu/edk2-arm-code.fd" +qemu_efi_firmware_vars = "/opt/homebrew/Cellar/qemu/8.2.1/share/qemu/edk2-arm-vars.fd" +qemu_efi_drop_efivars = null +sources_enabled = [ + "source.qemu.vm" +] +parallels_guest_os_type = "centos" +vbox_guest_os_type = "RedHat_64" +vmware_guest_os_type = "arm-rhel9-64" diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl new file mode 100644 index 000000000..e094cd261 --- /dev/null +++ b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl @@ -0,0 +1,11 @@ +os_name = "amazonlinux" +os_version = "2023" +os_arch = "x86_64" +vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/al2023-vmware_esx-2023.3.20240312.0-kernel-6.1-x86_64.xfs.gpt.ova" +vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/SHA256SUMS" +parallels_guest_os_type = "fedora-core" +vbox_guest_os_type = "Fedora_64" +vmware_guest_os_type = "fedora-64" +sources_enabled = [ + "source.virtualbox-ovf.vm" +] From 69ffc0e75e418d95bfe120d868e83207a6592bd7 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Wed, 20 Mar 2024 11:29:37 -0500 Subject: [PATCH 17/19] updated amz builds Signed-off-by: Corey Hemminger --- amazonlinux-2-x86_64-virtualbox_build.sh | 2 +- amazonlinux-2023-aarch64-virtualbox-build.sh | 5 ++-- amazonlinux-2023-x86_64-virtualbox-build.sh | 2 +- builds.yml | 2 ++ .../amazonlinux-2-aarch64.pkrvars.hcl | 19 +++++++-------- .../amazonlinux-2023-aarch64.pkrvars.hcl | 24 +++++++------------ .../amazonlinux-2023-x86_64.pkrvars.hcl | 4 ++-- 7 files changed, 27 insertions(+), 31 deletions(-) diff --git a/amazonlinux-2-x86_64-virtualbox_build.sh b/amazonlinux-2-x86_64-virtualbox_build.sh index 04cf24857..8902e9dae 100755 --- a/amazonlinux-2-x86_64-virtualbox_build.sh +++ b/amazonlinux-2-x86_64-virtualbox_build.sh @@ -59,7 +59,7 @@ echo Deleting the VM vboxmanage unregistervm $VM --delete echo starting packer build of amazonlinux -if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2_x86_64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then +if packer build -timestamp-ui -var "vbox_source_path=$AMZDIR/amazon2_x86_64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then echo "Cleaning up files" rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso else diff --git a/amazonlinux-2023-aarch64-virtualbox-build.sh b/amazonlinux-2023-aarch64-virtualbox-build.sh index 54ffdd934..5d0ec7ae8 100755 --- a/amazonlinux-2023-aarch64-virtualbox-build.sh +++ b/amazonlinux-2023-aarch64-virtualbox-build.sh @@ -40,11 +40,12 @@ VBoxManage createvm --name $VM --ostype "Fedora_64" --register VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$AMZDIR"/amazon2023_arm64.vdi VBoxManage storageattach $VM --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "$AMZDIR"/seed.iso +VBoxManage modifyvm $VM --chipset ich9 VBoxManage modifyvm $VM --firmware efi VBoxManage modifyvm $VM --memory 2048 VBoxManage modifyvm $VM --cpus 2 VBoxManage modifyvm $VM --nat-localhostreachable1 on -VBoxManage modifyvm $VM --vram 10 +VBoxManage modifyvm $VM --vram 33 VBoxManage modifyvm $VM --graphicscontroller vmsvga VBoxManage modifyvm $VM --vrde off VBoxManage modifyvm $VM --audio-driver none @@ -66,7 +67,7 @@ echo "Deleting the VM" vboxmanage unregistervm $VM --delete echo "starting packer build of amazonlinux" -if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2023_arm64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then +if packer build -timestamp-ui -var "vbox_source_path=$AMZDIR/amazon2023_arm64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then echo "Cleaning up files" rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso "$AMZDIR"/*.vdi "$AMZDIR"/*.qcow2 else diff --git a/amazonlinux-2023-x86_64-virtualbox-build.sh b/amazonlinux-2023-x86_64-virtualbox-build.sh index 95e73f1fe..f58fb84b6 100755 --- a/amazonlinux-2023-x86_64-virtualbox-build.sh +++ b/amazonlinux-2023-x86_64-virtualbox-build.sh @@ -65,7 +65,7 @@ echo "Deleting the VM" vboxmanage unregistervm $VM --delete echo "starting packer build of amazonlinux" -if packer build -timestamp-ui -only=virtualbox-ovf.vm -var "vbox_source_path=$AMZDIR/amazon2023_x86_64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then +if packer build -timestamp-ui -var "vbox_source_path=$AMZDIR/amazon2023_x86_64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then echo "Cleaning up files" rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso "$AMZDIR"/*.vdi "$AMZDIR"/*.qcow2 else diff --git a/builds.yml b/builds.yml index 6f0cd3b65..6a3567516 100644 --- a/builds.yml +++ b/builds.yml @@ -6,6 +6,8 @@ default_architectures: - 'amd64' public: + - 'amazonlinux-2' + - 'amazonlinux-2023' - 'almalinux-8' - 'almalinux-9' - 'amazon-2' diff --git a/os_pkrvars/amazonlinux/amazonlinux-2-aarch64.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2-aarch64.pkrvars.hcl index 813c91c21..0895fcfd9 100644 --- a/os_pkrvars/amazonlinux/amazonlinux-2-aarch64.pkrvars.hcl +++ b/os_pkrvars/amazonlinux/amazonlinux-2-aarch64.pkrvars.hcl @@ -1,12 +1,11 @@ -os_name = "amazonlinux" -os_version = "2" -os_arch = "aarch64" -iso_url = "https://cdn.amazonlinux.com/os-images/2.0.20240131.0/kvm-arm64/amzn2-kvm-2.0.20240131.0-arm64.xfs.gpt.qcow2" -iso_checksum = "file:https://cdn.amazonlinux.com/os-images/2.0.20240131.0/kvm-arm64/SHA256SUMS" -qemu_disk_image = true +os_name = "amazonlinux" +os_version = "2" +os_arch = "aarch64" +vbox_source_path = "https://cdn.amazonlinux.com/os-images/latest/kvm-arm64/amzn2-kvm-2.0.20240306.2-arm64.xfs.gpt.qcow2" +vbox_checksum = "file:https://cdn.amazonlinux.com/os-images/latest/kvm-arm64/SHA256SUMS" +parallels_guest_os_type = "fedora-core" +vbox_guest_os_type = "Fedora_64" +vmware_guest_os_type = "arm-fedora-64" sources_enabled = [ - "source.qemu.vm" + "source.virtualbox-ovf.vm" ] -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-rhel9-64" diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl index dc37387fb..6a72f30af 100644 --- a/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl +++ b/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl @@ -1,17 +1,11 @@ -os_name = "amazonlinux" -os_version = "2023" -os_arch = "aarch64" -iso_url = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240131.0/kvm-arm64/al2023-kvm-2023.3.20240131.0-kernel-6.1-arm64.xfs.gpt.qcow2" -iso_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240131.0/kvm-arm64/SHA256SUMS" -qemu_disk_image = true -cd_files = ["/Users/corey.hemminger/Documents/github/personal/chef/cookbooks/testing/bento/packer_templates/amz_seed_iso/*"] -qemu_efi_boot = true -qemu_efi_firmware_code = "/opt/homebrew/Cellar/qemu/8.2.1/share/qemu/edk2-arm-code.fd" -qemu_efi_firmware_vars = "/opt/homebrew/Cellar/qemu/8.2.1/share/qemu/edk2-arm-vars.fd" -qemu_efi_drop_efivars = null +os_name = "amazonlinux" +os_version = "2023" +os_arch = "aarch64" +vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/al2023-vmware_esx-2023.3.20240312.0-kernel-6.1-x86_64.xfs.gpt.ova" +vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/SHA256SUMS" +parallels_guest_os_type = "fedora-core" +vbox_guest_os_type = "Fedora_64" +vmware_guest_os_type = "arm-fedora-64" sources_enabled = [ - "source.qemu.vm" + "source.virtualbox-ovf.vm" ] -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-rhel9-64" diff --git a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl index e094cd261..b059b2b4a 100644 --- a/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl +++ b/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl @@ -1,8 +1,8 @@ os_name = "amazonlinux" os_version = "2023" os_arch = "x86_64" -vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/al2023-vmware_esx-2023.3.20240312.0-kernel-6.1-x86_64.xfs.gpt.ova" -vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/2023.3.20240312.0/vmware/SHA256SUMS" +vbox_source_path = "https://cdn.amazonlinux.com/al2023/os-images/latest/vmware/al2023-vmware_esx-2023.3.20240312.0-kernel-6.1-x86_64.xfs.gpt.ova" +vbox_checksum = "file:https://cdn.amazonlinux.com/al2023/os-images/latest/vmware/SHA256SUMS" parallels_guest_os_type = "fedora-core" vbox_guest_os_type = "Fedora_64" vmware_guest_os_type = "fedora-64" From ad6c17023bb9f58dc5ed2d9fd291beca74988435 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Wed, 20 Mar 2024 16:32:36 -0500 Subject: [PATCH 18/19] updated changelog Signed-off-by: Corey Hemminger --- AMZ_README_FIRST.md | 12 ++++++------ CHANGELOG.md | 11 +++++++++-- ...ld.sh => amazonlinux-2-x86_64-virtualbox-build.sh | 0 3 files changed, 15 insertions(+), 8 deletions(-) rename amazonlinux-2-x86_64-virtualbox_build.sh => amazonlinux-2-x86_64-virtualbox-build.sh (100%) diff --git a/AMZ_README_FIRST.md b/AMZ_README_FIRST.md index 5393c82d2..1fd70bdbf 100644 --- a/AMZ_README_FIRST.md +++ b/AMZ_README_FIRST.md @@ -1,12 +1,12 @@ -This is not your normal Bento box. Instead of building a system from an ISO we're building a system from an Amazon provided VirtualBox VDI file. This means the process is a bit different than usual. +This is not your normal Bento box. Instead of building a system from an ISO we're building a system from an Amazon provided vm hdd image files. This means the process is a bit different than usual. # Building this box -Simply run the AMZ_build_virtualbox-ovf.sh script +Simply run one of the amazonlinxu-2*-build.sh scripts -This script will: +These scripts will: -1. Download the VirtualBox .vdi file for Amazon Linux 2 and place it in the amz_working_files directory. Amazon hosts these at . It will name it amazon.vdi instead of the version specific name that Amazon gives it on their site -1. It will prepare this VDI file for packer and export it as a OVF file +1. Download the vm image file for Amazon Linux 2 or 2023 and place it in the amz_working_files directory. Amazon hosts these at and . +1. It will prepare the VDI file for packer and export it as a OVF file 1. It will run the packer build -1. Lastly it will clean up the leftover files in the working directory +1. Lastly it will clean up the leftover files in the working directory on successful completion diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fe147770..8fe23efa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,8 +59,15 @@ Markdown table generated at ## [v4.0.2] (2024-02-28) - Update upload message to show architecture -- fix open-vm-tools install for vmware builds -- +- Fix open-vm-tools install for vmware builds +- Fix amazonlinux 2 build script +- Added amazonlinux 2023 build scripts +- Allow failed tests to continue and report at the end each test that failed +- Added amazonlinux aarch64 packer templates +- removed unneeded config from amazon user-data script for seed.iso +- Added additional qemu variables for various qemu source properties +- Added virtualbox-ovf vbox_source_path and vbox_checksum variables +- Added recursive flag to rhel cleanup scripts for persistent network files ## [v4.0.1] (2024-02-16) diff --git a/amazonlinux-2-x86_64-virtualbox_build.sh b/amazonlinux-2-x86_64-virtualbox-build.sh similarity index 100% rename from amazonlinux-2-x86_64-virtualbox_build.sh rename to amazonlinux-2-x86_64-virtualbox-build.sh From e6a52af986c719d24f73a9a7c2b976ed6d4c1baa Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Wed, 20 Mar 2024 16:36:45 -0500 Subject: [PATCH 19/19] updated changelog Signed-off-by: Corey Hemminger --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fe23efa2..13dcfefa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,11 +52,10 @@ Markdown table generated at - Look into making all build uefi default builds - Create CD pipeline to upload vagrant boxes after PR is merged - Create CD pipeline to build and upload new versions of vagrant boxes once every 3 months with the latest patches -- Added ability to configure bento upload of private or public boxes in builds.yml, defaults to private -## [unreleased] (2024-02-28) +## [unreleased] (2024-03-20) -## [v4.0.2] (2024-02-28) +## [v4.0.2] (2024-03-20) - Update upload message to show architecture - Fix open-vm-tools install for vmware builds @@ -121,6 +120,7 @@ Markdown table generated at - Updated Bento to continue builds even if one fails and report all failures at the end and exit with exit code 1 - Added qemu clone of libvirt box when metadata file is created for uploading to vagrant qemu provider - Made build shell scripts customizable through packer variable +- Added ability to configure bento upload of private or public boxes in builds.yml, defaults to private ## [v3.1.1] (2023-07-07)