From dc6933305414eaf9d6daba5eed5185a0e48c2b2a Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Mon, 1 Sep 2025 16:26:44 -0400 Subject: [PATCH] testing --- debian-13/Makefile | 7 +++---- debian-13/scripts/clean.sh | 16 ++++++++++++++++ debian-13/x86_64-qemu-base.pkr.hcl | 1 + debian-13/x86_64-qemu-vagrant.pkr.hcl | 7 ++++--- 4 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 debian-13/scripts/clean.sh diff --git a/debian-13/Makefile b/debian-13/Makefile index 91d253f..f90cd95 100644 --- a/debian-13/Makefile +++ b/debian-13/Makefile @@ -1,10 +1,9 @@ -.PHONY: install clean +.PHONY: base vagrant clean HEADLESS ?= true -default: install - -install: base +default: + @echo "Please run 'make base' or 'make vagrant'" base: PKR_VAR_headless="$(HEADLESS)" packer build x86_64-qemu-base.pkr.hcl diff --git a/debian-13/scripts/clean.sh b/debian-13/scripts/clean.sh new file mode 100644 index 0000000..25af9ec --- /dev/null +++ b/debian-13/scripts/clean.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -eux + +export DEBIAN_FRONTEND=noninteractive +apt-get clean -y +apt-get autoclean -y +rm -f /var/lib/dhcpcd/* +rm -rf /var/cache/apt/archives/* +rm -rf /var/lib/apt/lists/* +rm -rf /var/tmp/* /var/tmp/.[!.]* + +truncate -s 0 /var/log/wtmp + +dd if=/dev/zero of=/EMPTY bs=1M || true +sync +rm -rf /EMPTY diff --git a/debian-13/x86_64-qemu-base.pkr.hcl b/debian-13/x86_64-qemu-base.pkr.hcl index 2ba47d5..79bf39d 100644 --- a/debian-13/x86_64-qemu-base.pkr.hcl +++ b/debian-13/x86_64-qemu-base.pkr.hcl @@ -70,6 +70,7 @@ build { provisioner "shell" { scripts = [ "scripts/aptupdate.sh", + "scripts/clean.sh" ] } } diff --git a/debian-13/x86_64-qemu-vagrant.pkr.hcl b/debian-13/x86_64-qemu-vagrant.pkr.hcl index 950c662..fd2d5f8 100644 --- a/debian-13/x86_64-qemu-vagrant.pkr.hcl +++ b/debian-13/x86_64-qemu-vagrant.pkr.hcl @@ -27,7 +27,7 @@ source "qemu" "debian-13-64-vagrant" { iso_url = "builds/qemu/debian-13-64-base/debian-13-64-base" disk_image = true iso_checksum = "none" - output_directory = "builds/qemu/debian-13-64-vagrant" + output_directory = "builds/qemu" shutdown_command = "/usr/bin/systemctl poweroff" disk_interface = "virtio" disk_size = var.disk_size @@ -39,7 +39,7 @@ source "qemu" "debian-13-64-vagrant" { ssh_username = "root" ssh_password = var.ssh_password ssh_timeout = "60m" - vm_name = "debian-13-64-base" + vm_name = "debian-13-64-vagrant" net_device = "virtio-net" boot_wait = "5s" } @@ -50,7 +50,8 @@ build { provisioner "shell" { scripts = [ - "scripts/vagrant.sh" + "scripts/vagrant.sh", + "scripts/clean.sh" ] } }