diff --git a/extra/files/ubuntu/24.04/proxmox-uefi/meta-data b/extra/files/ubuntu/24.04/proxmox-uefi/meta-data new file mode 100644 index 0000000..e69de29 diff --git a/extra/files/ubuntu/24.04/proxmox-uefi/user-data b/extra/files/ubuntu/24.04/proxmox-uefi/user-data new file mode 100644 index 0000000..7f367e5 --- /dev/null +++ b/extra/files/ubuntu/24.04/proxmox-uefi/user-data @@ -0,0 +1,109 @@ +#cloud-config + +autoinstall: + version: 1 + early-commands: + - systemctl stop ssh # otherwise packer tries to connect and exceed max attempts + network: + network: + version: 2 + ethernets: + eth0: + dhcp4: yes + dhcp-identifier: mac + update: no + apt: + geoip: true + preserve_sources_list: false + primary: + - arches: [amd64] + uri: "http://archive.ubuntu.com/ubuntu/" + packages: + - mc + - curl + - wget + - sudo + - tar + - bzip2 + - build-essential + - linux-image-virtual + - linux-tools-virtual + - net-tools + - qemu-guest-agent + locale: en_US.UTF-8 + timezone: Europe/Copenhagen + ssh: + install-server: true + allow-pw: true + user-data: + disable_root: false +# lock-passwd: false + ssh_pwauth: true + hostname: ubuntu2404 +# username: root + chpasswd: + expire: false + users: + - name: root + password: password + type: text + - name: ubuntu + password: password + type: text + late-commands: + #- echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu + - sed -ie 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="net.ifnames=0 ipv6.disable=1 biosdevname=0"/' /target/etc/default/grub + - sed -ie 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /target/etc/ssh/sshd_config + - sed -ie 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /target/etc/ssh/sshd_config + - sed -ie 's/#AllowAgentForwarding yes/AllowAgentForwarding yes/' /target/etc/ssh/sshd_config + - curtin in-target -- update-grub2 + # virtual package is required for some cloud images. Lack of it causes failure in communication. + - curtin in-target -- apt-get -y install linux-cloud-tools-virtual||true + - curtin in-target -- systemctl enable qemu-guest-agent + storage: + config: + - type: disk + id: disk0 + ptable: gpt + wipe: superblock + grub_device: true + match: + size: largest + - id: efi-partition + type: partition + device: disk0 + size: 512MB + flag: boot + grub_device: true + - id: boot-partition + type: partition + device: disk0 + size: 2GB + - id: root-partition + type: partition + device: disk0 + size: -1 + - id: efi-partition-fs + type: format + fstype: fat32 + volume: efi-partition + - id: boot-partition-fs + type: format + fstype: ext4 + volume: boot-partition + - id: root-partition-fs + type: format + fstype: ext4 + volume: root-partition + - id: efi-partition-fs-mount + type: mount + path: /boot/efi + device: efi-partition-fs + - id: boot-partition-fs-mount + type: mount + path: /boot + device: boot-partition-fs + - id: root-partition-fs-mount + type: mount + path: / + device: root-partition-fs diff --git a/proxmox/proxmox_ubuntu.pkr.hcl b/proxmox/proxmox_ubuntu.pkr.hcl index 4f02c62..8cf3e89 100644 --- a/proxmox/proxmox_ubuntu.pkr.hcl +++ b/proxmox/proxmox_ubuntu.pkr.hcl @@ -163,6 +163,41 @@ variable "provision_script_options" { default = "" } +variable "efi_storage_pool" { + type = string + default = "local" +} + +variable "pre_enrolled_keys" { + type = bool + default = false +} + +variable "efi_type" { + type = string + default = "4m" +} + +variable "bios" { + type = string + default = "seabios" +} + +variable "use_efi" { + type = bool + default = false +} + +variable "machine" { + type = string + default = "pc" +} + +variable "tags" { + type = string + default = "bios;template" +} + locals { packer_timestamp = formatdate("YYYYMMDD-hhmm", timestamp()) @@ -172,6 +207,7 @@ source "proxmox-iso" "linux" { ballooning_minimum = "${var.ballooning_minimum}" boot_command = ["${var.boot_command}"] boot_wait = "${var.boot_wait}" + bios = "${var.bios}" cores = "${var.cores}" cpu_type = "${var.cpu_type}" disable_kvm = "${var.disable_kvm}" @@ -185,6 +221,7 @@ source "proxmox-iso" "linux" { http_directory = "${path.cwd}/extra/files" insecure_skip_tls_verify = true iso_file = "${var.iso_file}" + machine = "${var.machine}" memory = "${var.memory}" network_adapters { bridge = "${var.network_adapters.bridge}" @@ -203,6 +240,7 @@ source "proxmox-iso" "linux" { ssh_timeout = "10000s" ssh_username = "${var.ssh_username}" ssh_pty = "true" + tags = "${var.tags}" task_timeout = "${var.task_timeout}" template_name = "${var.template}.${local.packer_timestamp}" token = "${var.proxmox_token}" @@ -211,9 +249,62 @@ source "proxmox-iso" "linux" { } -build { - sources = ["source.proxmox-iso.linux"] +source "proxmox-iso" "linux-efi" { + ballooning_minimum = "${var.ballooning_minimum}" + boot_command = ["${var.boot_command}"] + boot_wait = "${var.boot_wait}" + bios = "${var.bios}" + cores = "${var.cores}" + cpu_type = "${var.cpu_type}" + disable_kvm = "${var.disable_kvm}" + disks { + cache_mode = "${var.disks.cache_mode}" + disk_size = "${var.disks.disk_size}" + format = "${var.disks.format}" + storage_pool = "${var.disks.storage_pool}" + type = "${var.disks.type}" + } + efi_config { + efi_storage_pool = "${var.efi_storage_pool}" + efi_type = "${var.efi_type}" + pre_enrolled_keys = "${var.pre_enrolled_keys}" + } + http_directory = "${path.cwd}/extra/files" + insecure_skip_tls_verify = true + iso_file = "${var.iso_file}" + memory = "${var.memory}" + machine = "${var.machine}" + network_adapters { + bridge = "${var.network_adapters.bridge}" + model = "${var.network_adapters.model}" + firewall = "${var.network_adapters.firewall}" + mac_address = "${var.network_adapters.mac_address}" + } + node = "${var.proxmox_node}" + os = "${var.os}" + proxmox_url = "${var.proxmox_url}" + qemu_agent = "${var.qemu_agent}" + scsi_controller = "${var.scsi_controller}" + sockets = "${var.sockets}" + ssh_password = "${var.ssh_password}" + ssh_port = "${var.ssh_port}" + ssh_timeout = "10000s" + ssh_username = "${var.ssh_username}" + ssh_pty = "true" + tags = "${var.tags}" + task_timeout = "${var.task_timeout}" + template_name = "${var.template}.${local.packer_timestamp}" + token = "${var.proxmox_token}" + unmount_iso = true + username = "${var.proxmox_username}" +} + + +build { + sources = [ + var.use_efi ? "source.proxmox-iso.linux-efi" : "source.proxmox-iso.linux" + ] provisioner "file" { diff --git a/proxmox/proxmox_windows.pkr.hcl b/proxmox/proxmox_windows.pkr.hcl index 501185c..fa7804c 100644 --- a/proxmox/proxmox_windows.pkr.hcl +++ b/proxmox/proxmox_windows.pkr.hcl @@ -208,6 +208,31 @@ variable "virtio_iso_file" { default = "virtio-win.iso" } +variable "use_efi" { + type = bool + default = false +} + +variable "tags" { + type = string + default = "uefi;template" +} + +variable "pre_enrolled_keys" { + type = bool + default = false +} + +variable "efi_type" { + type = string + default = "4m" +} + +variable "efi_storage_pool" { + type = string + default = "local" +} + locals { packer_timestamp = formatdate("YYYYMMDD-hhmm", timestamp()) } @@ -272,6 +297,7 @@ source "proxmox-iso" "windows" { winrm_password = "${var.winrm_password}" winrm_timeout = "8h" winrm_username = "${var.winrm_username}" + tags = "${var.tags}" task_timeout = "${var.task_timeout}" qemu_agent = "${var.qemu_agent}" vga { diff --git a/proxmox/variables_proxmox_ubuntu2204.pkvars.hcl b/proxmox/variables_ubuntu2204.pkvars.hcl similarity index 100% rename from proxmox/variables_proxmox_ubuntu2204.pkvars.hcl rename to proxmox/variables_ubuntu2204.pkvars.hcl diff --git a/proxmox/variables_ubuntu2204_uefi.pkvars.hcl b/proxmox/variables_ubuntu2204_uefi.pkvars.hcl new file mode 100644 index 0000000..8ec4de1 --- /dev/null +++ b/proxmox/variables_ubuntu2204_uefi.pkvars.hcl @@ -0,0 +1,9 @@ +boot_command = "clinux /casper/vmlinuz quiet autoinstall net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu/22.04/proxmox/' initrd /casper/initrdboot" +efi_storage_pool = "zfs" +efi_type = "4m" +pre_enrolled_keys = "true" +bios = "ovmf" +machine = "q35" +use_efi = "true" +template = "ubuntu22.04.uefi" +tags = "uefi;template" \ No newline at end of file diff --git a/proxmox/variables_proxmox_ubuntu2304.pkvars.hcl b/proxmox/variables_ubuntu2304.pkvars.hcl similarity index 100% rename from proxmox/variables_proxmox_ubuntu2304.pkvars.hcl rename to proxmox/variables_ubuntu2304.pkvars.hcl diff --git a/proxmox/variables_ubuntu2304_uefi.pkvars.hcl b/proxmox/variables_ubuntu2304_uefi.pkvars.hcl new file mode 100644 index 0000000..db65b25 --- /dev/null +++ b/proxmox/variables_ubuntu2304_uefi.pkvars.hcl @@ -0,0 +1,9 @@ +boot_command = "clinux /casper/vmlinuz quiet autoinstall net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu/24.04/proxmox/' initrd /casper/initrdboot" +efi_storage_pool = "zfs" +efi_type = "4m" +pre_enrolled_keys = "true" +bios = "ovmf" +machine = "q35" +use_efi = "true" +template = "ubuntu24.04.uefi" +tags = "uefi;template" \ No newline at end of file diff --git a/proxmox/variables_proxmox_ubuntu2404.pkvars.hcl b/proxmox/variables_ubuntu2404.pkvars.hcl similarity index 100% rename from proxmox/variables_proxmox_ubuntu2404.pkvars.hcl rename to proxmox/variables_ubuntu2404.pkvars.hcl diff --git a/proxmox/variables_ubuntu2404_uefi.pkvars.hcl b/proxmox/variables_ubuntu2404_uefi.pkvars.hcl new file mode 100644 index 0000000..57aa837 --- /dev/null +++ b/proxmox/variables_ubuntu2404_uefi.pkvars.hcl @@ -0,0 +1,9 @@ +boot_command = "clinux /casper/vmlinuz quiet autoinstall net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu/24.04/proxmox-uefi/' initrd /casper/initrdboot" +efi_storage_pool = "zfs" +efi_type = "4m" +pre_enrolled_keys = "true" +bios = "ovmf" +machine = "q35" +use_efi = "true" +template = "ubuntu24.04.uefi" +tags = "uefi;template" \ No newline at end of file diff --git a/proxmox/variables_proxmox_windows2019-dc.pkvars.hcl b/proxmox/variables_windows2019-dc.pkvars.hcl similarity index 100% rename from proxmox/variables_proxmox_windows2019-dc.pkvars.hcl rename to proxmox/variables_windows2019-dc.pkvars.hcl diff --git a/proxmox/variables_windows2019-dc_uefi.pkvars.hcl b/proxmox/variables_windows2019-dc_uefi.pkvars.hcl new file mode 100644 index 0000000..3f9954e --- /dev/null +++ b/proxmox/variables_windows2019-dc_uefi.pkvars.hcl @@ -0,0 +1,9 @@ +boot_command = [""] +efi_storage_pool = "zfs" +efi_type = "4m" +pre_enrolled_keys = "true" +bios = "ovmf" +machine = "q35" +use_efi = "true" +template = "windows2019-dc.uefi" +tags = "uefi;template" \ No newline at end of file diff --git a/proxmox/variables_proxmox_windows2019-std.pkvars.hcl b/proxmox/variables_windows2019-std.pkvars.hcl similarity index 100% rename from proxmox/variables_proxmox_windows2019-std.pkvars.hcl rename to proxmox/variables_windows2019-std.pkvars.hcl diff --git a/proxmox/variables_windows2019-std_uefi.pkvars.hcl b/proxmox/variables_windows2019-std_uefi.pkvars.hcl new file mode 100644 index 0000000..8a0d604 --- /dev/null +++ b/proxmox/variables_windows2019-std_uefi.pkvars.hcl @@ -0,0 +1,9 @@ +boot_command = [""] +efi_storage_pool = "zfs" +efi_type = "4m" +pre_enrolled_keys = "true" +bios = "ovmf" +machine = "q35" +use_efi = "true" +template = "windows2019-std.uefi" +tags = "uefi;template" \ No newline at end of file diff --git a/proxmox/variables_proxmox_windows2022-dc.pkvars.hcl b/proxmox/variables_windows2022-dc.pkvars.hcl similarity index 96% rename from proxmox/variables_proxmox_windows2022-dc.pkvars.hcl rename to proxmox/variables_windows2022-dc.pkvars.hcl index d11d1f6..0118a64 100644 --- a/proxmox/variables_proxmox_windows2022-dc.pkvars.hcl +++ b/proxmox/variables_windows2022-dc.pkvars.hcl @@ -38,7 +38,7 @@ scsi_controller = "virtio-scsi-single" sockets = "1" sysprep_unattended = "./extra/files/windows/2022/proxmox/unattend.xml" task_timeout = "20m" -template = "windows2022-dc.microsoft.com" +template = "windows2022-dc" unmount_iso = true winrm_password = "password" winrm_username = "Administrator" diff --git a/proxmox/variables_windows2022-dc_uefi.pkvars.hcl b/proxmox/variables_windows2022-dc_uefi.pkvars.hcl new file mode 100644 index 0000000..97475fb --- /dev/null +++ b/proxmox/variables_windows2022-dc_uefi.pkvars.hcl @@ -0,0 +1,9 @@ +boot_command = [""] +efi_storage_pool = "zfs" +efi_type = "4m" +pre_enrolled_keys = "true" +bios = "ovmf" +machine = "q35" +use_efi = "true" +template = "windows2022-dc.uefi" +tags = "uefi;template" \ No newline at end of file diff --git a/proxmox/variables_proxmox_windows2022-std.pkvars.hcl b/proxmox/variables_windows2022-std.pkvars.hcl similarity index 100% rename from proxmox/variables_proxmox_windows2022-std.pkvars.hcl rename to proxmox/variables_windows2022-std.pkvars.hcl diff --git a/proxmox/variables_windows2022-std_uefi.pkvars.hcl b/proxmox/variables_windows2022-std_uefi.pkvars.hcl new file mode 100644 index 0000000..387b363 --- /dev/null +++ b/proxmox/variables_windows2022-std_uefi.pkvars.hcl @@ -0,0 +1,9 @@ +boot_command = [""] +efi_storage_pool = "zfs" +efi_type = "4m" +pre_enrolled_keys = "true" +bios = "ovmf" +machine = "q35" +use_efi = "true" +template = "windows2022-std.uefi" +tags = "uefi;template" \ No newline at end of file diff --git a/proxmox_ubuntu_2204.sh b/proxmox_ubuntu_2204.sh deleted file mode 100755 index 288d582..0000000 --- a/proxmox_ubuntu_2204.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Start time -start_time=$(date +%s%N) - -export PACKER_LOG=0 - -if [ -e secrets/proxmox.sh ]; then - # shellcheck source=secrets/proxmox.sh - source secrets/proxmox.sh -else - echo "secrets/proxmox.sh not found" -fi - -version="ubuntu2204" -family="ubuntu" -var_file="proxmox/variables_proxmox_${version}.pkvars.hcl" -template="proxmox/proxmox_${family}.pkr.hcl" - -packer validate --var-file="$var_file" "$template" -rc=$? - if [ $rc -ne 0 ]; then - echo "Packer validate failed - exiting now" - exit $rc - else - packer build --force --var-file="$var_file" "$template" - rc=$? - fi - -if [ $rc -ne 0 ]; then - echo "Packer build failed - exiting now" - exit $rc -fi - -# End time -end_time=$(date +%s%N) - -# Calculate time difference in seconds -time_diff_seconds=$(( (end_time - start_time) / 1000000000 )) - - -# Convert time difference to hours, minutes, and seconds -hours=$(( time_diff_seconds / 3600 )) -minutes=$(( (time_diff_seconds % 3600) / 60 )) -seconds=$(( time_diff_seconds % 60 )) - -echo "Packer build took: $hours hours, $minutes minutes, and $seconds seconds." \ No newline at end of file diff --git a/proxmox_ubuntu_2204_hwe.sh b/proxmox_ubuntu_2204_hwe.sh deleted file mode 100755 index 6f00570..0000000 --- a/proxmox_ubuntu_2204_hwe.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Start time -start_time=$(date +%s%N) - -export PACKER_LOG=0 - -if [ -e secrets/proxmox.sh ]; then - # shellcheck source=secrets/proxmox.sh - source secrets/proxmox.sh -else - echo "secrets/proxmox.sh not found" -fi - -version="ubuntu2204" -family="ubuntu" -var_file="proxmox/variables_proxmox_${version}.pkvars.hcl" -template="proxmox/proxmox_${family}.pkr.hcl" - -packer validate --var-file="$var_file" -var="boot_command=clinux /casper/hwe-vmlinuz quiet autoinstall net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds=\"nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu/22.04/proxmox/\"initrd /casper/hwe-initrdboot" -var "template=ubuntu22.04.hwe" "$template" -rc=$? - if [ $rc -ne 0 ]; then - echo "Packer validate failed - exiting now" - exit $rc - else - packer build --force --var-file="$var_file" -var="boot_command=clinux /casper/hwe-vmlinuz quiet autoinstall net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds=\"nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu/22.04/proxmox/\"initrd /casper/hwe-initrdboot" -var "template=ubuntu22.04.hwe" "$template" - rc=$? - fi - -if [ $rc -ne 0 ]; then - echo "Packer build failed - exiting now" - exit $rc -fi - -# End time -end_time=$(date +%s%N) - -# Calculate time difference in seconds -time_diff_seconds=$(( (end_time - start_time) / 1000000000 )) - - -# Convert time difference to hours, minutes, and seconds -hours=$(( time_diff_seconds / 3600 )) -minutes=$(( (time_diff_seconds % 3600) / 60 )) -seconds=$(( time_diff_seconds % 60 )) - -echo "Packer build took: $hours hours, $minutes minutes, and $seconds seconds." \ No newline at end of file diff --git a/proxmox_ubuntu_2304.sh b/proxmox_ubuntu_2304.sh deleted file mode 100755 index 695e9a8..0000000 --- a/proxmox_ubuntu_2304.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Start time -start_time=$(date +%s%N) - -export PACKER_LOG=0 - -if [ -e secrets/proxmox.sh ]; then - # shellcheck source=secrets/proxmox.sh - source secrets/proxmox.sh -else - echo "secrets/proxmox.sh not found" -fi - -version="ubuntu2304" -family="ubuntu" -var_file="proxmox/variables_proxmox_${version}.pkvars.hcl" -template="proxmox/proxmox_${family}.pkr.hcl" - -packer validate --var-file="$var_file" "$template" -rc=$? - if [ $rc -ne 0 ]; then - echo "Packer validate failed - exiting now" - exit $rc - else - packer build --force --var-file="$var_file" "$template" - rc=$? - fi - -if [ $rc -ne 0 ]; then - echo "Packer build failed - exiting now" - exit $rc -fi - -# End time -end_time=$(date +%s%N) - -# Calculate time difference in seconds -time_diff_seconds=$(( (end_time - start_time) / 1000000000 )) - - -# Convert time difference to hours, minutes, and seconds -hours=$(( time_diff_seconds / 3600 )) -minutes=$(( (time_diff_seconds % 3600) / 60 )) -seconds=$(( time_diff_seconds % 60 )) - -echo "Packer build took: $hours hours, $minutes minutes, and $seconds seconds." \ No newline at end of file diff --git a/proxmox_ubuntu_2404.sh b/proxmox_ubuntu_2404.sh deleted file mode 100755 index 9817129..0000000 --- a/proxmox_ubuntu_2404.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Start time -start_time=$(date +%s%N) - -export PACKER_LOG=0 - -if [ -e secrets/proxmox.sh ]; then - # shellcheck source=secrets/proxmox.sh - source secrets/proxmox.sh -else - echo "secrets/proxmox.sh not found" -fi - -version="ubuntu2404" -family="ubuntu" -var_file="proxmox/variables_proxmox_${version}.pkvars.hcl" -template="proxmox/proxmox_${family}.pkr.hcl" - -packer validate --var-file="$var_file" "$template" -rc=$? - if [ $rc -ne 0 ]; then - echo "Packer validate failed - exiting now" - exit $rc - else - packer build --force --var-file="$var_file" "$template" - rc=$? - fi - -if [ $rc -ne 0 ]; then - echo "Packer build failed - exiting now" - exit $rc -fi - -# End time -end_time=$(date +%s%N) - -# Calculate time difference in seconds -time_diff_seconds=$(( (end_time - start_time) / 1000000000 )) - - -# Convert time difference to hours, minutes, and seconds -hours=$(( time_diff_seconds / 3600 )) -minutes=$(( (time_diff_seconds % 3600) / 60 )) -seconds=$(( time_diff_seconds % 60 )) - -echo "Packer build took: $hours hours, $minutes minutes, and $seconds seconds." \ No newline at end of file diff --git a/proxmox_windows_2019-dc.sh b/proxmox_windows_2019-dc.sh deleted file mode 100755 index ccf85b8..0000000 --- a/proxmox_windows_2019-dc.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -# Start time -start_time=$(date +%s%N) - -export PACKER_LOG=0 - -if [ -e secrets/proxmox.sh ]; then - # shellcheck source=secrets/proxmox.sh - source secrets/proxmox.sh -else - echo "secrets/proxmox.sh not found" -fi - -template1="./proxmox/proxmox_windows.pkr.hcl" -var_file="./proxmox/variables_proxmox_windows2019-dc.pkvars.hcl" -packer="packer" - -if [ -z "$1" ]; then - set -- 0 -fi - -if [ "$1" -eq 1 ]; then - # 1 pass - $packer --version - $packer validate --var-file="$var_file" "$template1" - rc=$? - if [ $rc -ne 0 ]; then - echo "Packer validate failed - exiting now" - exit $rc - else - $packer build --force --var-file="$var_file" "$template1" - rc=$? - fi - - if [ $rc -ne 0 ]; then - echo "Packer build failed - exiting now" - exit $rc - else - echo "Packer build for $template1 success" - fi -fi - -# End time -end_time=$(date +%s%N) - -# Calculate time difference in seconds -time_diff_seconds=$(( (end_time - start_time) / 1000000000 )) - - -# Convert time difference to hours, minutes, and seconds -hours=$(( time_diff_seconds / 3600 )) -minutes=$(( (time_diff_seconds % 3600) / 60 )) -seconds=$(( time_diff_seconds % 60 )) - -echo "Packer build took: $hours hours, $minutes minutes, and $seconds seconds." diff --git a/proxmox_windows_2019-std.sh b/proxmox_windows_2019-std.sh deleted file mode 100755 index dc59c45..0000000 --- a/proxmox_windows_2019-std.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -# Start time -start_time=$(date +%s) - -export PACKER_LOG=0 - -if [ -e secrets/proxmox.sh ]; then - # shellcheck source=secrets/proxmox.sh - source secrets/proxmox.sh -else - echo "secrets/proxmox.sh not found" -fi - -template1="./proxmox/proxmox_windows.pkr.hcl" -var_file="./proxmox/variables_proxmox_windows2019-std.pkvars.hcl" -packer="packer" - - -if [ -z "$1" ] || [ "$1" -eq 1 ]; then - # 1 pass - $packer --version - $packer validate --var-file="$var_file" "$template1" - - rc=$? - if [ $rc -ne 0 ]; then - echo "Packer validate failed - exiting now" - exit $rc - else - $packer build --force --var-file="$var_file" "$template1" - rc=$? - fi - - if [ $rc -ne 0 ]; then - echo "Packer build failed - exiting now" - exit $rc - else - echo "Packer build for $template1 success" - fi -fi - -# End time -end_time=$(date +%s) - -# Calculate time difference in seconds -time_diff_seconds=$(( (end_time - start_time) / 1000000 )) - - -# Convert time difference to hours, minutes, and seconds -hours=$(( time_diff_seconds / 3600 )) -minutes=$(( (time_diff_seconds % 3600) / 60 )) -seconds=$(( time_diff_seconds % 60 )) - -echo "Packer build took: $hours hours, $minutes minutes, and $seconds seconds." diff --git a/proxmox_windows_2022-dc.sh b/proxmox_windows_2022-dc.sh deleted file mode 100755 index b861e6d..0000000 --- a/proxmox_windows_2022-dc.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -# Start time -start_time=$(date +%s%N) - -if [ -e secrets/proxmox.sh ]; then - # shellcheck source=secrets/proxmox.sh - source secrets/proxmox.sh -else - echo "secrets/proxmox.sh not found" -fi - -export PACKER_LOG=0 - - -template1="./proxmox/proxmox_windows.pkr.hcl" -var_file="./proxmox/variables_proxmox_windows2022-dc.pkvars.hcl" -packer="packer" - - -if [ -z "$1" ] || [ "$1" -eq 1 ]; then - # 1 pass - $packer --version - $packer validate --var-file="$var_file" "$template1" - - rc=$? - if [ $rc -ne 0 ]; then - echo "Packer validate failed - exiting now" - exit $rc - else - $packer build --force --var-file="$var_file" "$template1" - rc=$? - fi - - if [ $rc -ne 0 ]; then - echo "Packer build failed - exiting now" - exit $rc - else - echo "Packer build for $template1 success" - fi -fi - -# End time -end_time=$(date +%s%N) - -# Calculate time difference in seconds -time_diff_seconds=$(( (end_time - start_time) / 1000000000 )) - - -# Convert time difference to hours, minutes, and seconds -hours=$(( time_diff_seconds / 3600 )) -minutes=$(( (time_diff_seconds % 3600) / 60 )) -seconds=$(( time_diff_seconds % 60 )) - -echo "Packer build took: $hours hours, $minutes minutes, and $seconds seconds." - diff --git a/proxmox_windows_2022-std.sh b/proxmox_windows_2022-std.sh deleted file mode 100755 index 480c334..0000000 --- a/proxmox_windows_2022-std.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash - -# Start time -start_time=$(date +%s%N) - -export PACKER_LOG=0 - -if [ -e secrets/proxmox.sh ]; then - # shellcheck source=secrets/proxmox.sh - source secrets/proxmox.sh -else - echo "secrets/proxmox.sh not found" -fi - -template1="./proxmox/proxmox_windows.pkr.hcl" -var_file="./proxmox/variables_proxmox_windows2022-std.pkvars.hcl" -packer="packer" - - -if [ -z "$1" ] || [ "$1" -eq 1 ]; then - # 1 pass - $packer --version - $packer validate --var-file="$var_file" "$template1" - - rc=$? - if [ $rc -ne 0 ]; then - echo "Packer validate failed - exiting now" - exit $rc - else - $packer build --force --var-file="$var_file" "$template1" - rc=$? - fi - - if [ $rc -ne 0 ]; then - echo "Packer build failed - exiting now" - exit $rc - else - echo "Packer build for $template1 success" - fi -fi - -# End time -end_time=$(date +%s%N) - -# Calculate time difference in seconds -time_diff_seconds=$(( (end_time - start_time) / 1000000000 )) - - -# Convert time difference to hours, minutes, and seconds -hours=$(( time_diff_seconds / 3600 )) -minutes=$(( (time_diff_seconds % 3600) / 60 )) -seconds=$(( time_diff_seconds % 60 )) - -echo "Packer build took: $hours hours, $minutes minutes, and $seconds seconds."