commit dcd80cd7a36d2bf5e0f04a3934b97908b64a43c7 Author: Kris Lamoureux Date: Fri Aug 15 00:27:26 2025 -0400 Add Debian 13 Packer build configuration diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..77e50a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/builds/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e12b56f --- /dev/null +++ b/LICENSE @@ -0,0 +1,12 @@ +Copyright (C) 2025 by Kris Lamoureux + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE +FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c2bd3e8 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# pkrbuilds + +This repository contains Packer build configurations for creating virtual +machine images. Each directory represents a different OS or distribution with +its specific build configurations. + +Navigate to individual directories to find OS-specific build instructions. + +_Licensed under 0BSD_ diff --git a/debian-13/Makefile b/debian-13/Makefile new file mode 100644 index 0000000..8a55a88 --- /dev/null +++ b/debian-13/Makefile @@ -0,0 +1,11 @@ +.PHONY: install clean + +HEADLESS ?= true + +default: install + +install: + packer build -var 'headless=$(HEADLESS)' . + +clean: + rm -rf ./builds diff --git a/debian-13/README.md b/debian-13/README.md new file mode 100644 index 0000000..9698e38 --- /dev/null +++ b/debian-13/README.md @@ -0,0 +1,24 @@ +# Debian Trixie Builds + +This directory contains Packer configuration for building Debian 13 (Trixie) +images + +## Usage + +Build the image: + +``` +make +``` + +Remove build artifacts: + +``` +make clean +``` + +Build with a visible VM console for debugging: + +``` +make HEADLESS=false +``` diff --git a/debian-13/http/preseed.cfg b/debian-13/http/preseed.cfg new file mode 100644 index 0000000..abd559a --- /dev/null +++ b/debian-13/http/preseed.cfg @@ -0,0 +1,48 @@ +# Select English US +d-i debian-installer/locale string en_US +d-i keyboard-configuration/xkb-keymap select us + +# Network and mirror +d-i mirror/country string manual +d-i mirror/http/hostname string deb.debian.org +d-i mirror/http/directory string /debian +d-i mirror/http/proxy string +d-i apt-setup/cdrom/set-first boolean false + +# (Initial) root account setup +d-i passwd/make-user boolean false +d-i passwd/root-login boolean true +d-i passwd/root-password password debian +d-i passwd/root-password-again password debian + +# Time +d-i clock-setup/utc boolean true +d-i time/zone string UTC + +# Partitioning +d-i partman-auto/method string regular +d-i partman-auto/choose_recipe select atomic +d-i partman/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +# Install SSH server +tasksel tasksel/first multiselect ssh-server + +# Opt out of package usage survey +popularity-contest popularity-contest/participate boolean false + +# Patch the new instance entirely +d-i pkgsel/upgrade select full-upgrade + +# SSH configuration +d-i preseed/late_command string \ + in-target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config + +# Bootloader +d-i grub-installer/only_debian boolean true +d-i grub-installer/bootdev string default + +# Finish +d-i finish-install/reboot_in_progress note diff --git a/debian-13/scripts/aptupdate.sh b/debian-13/scripts/aptupdate.sh new file mode 100644 index 0000000..53b167f --- /dev/null +++ b/debian-13/scripts/aptupdate.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +apt-get update +apt-get upgrade -y diff --git a/debian-13/x86_64-qemu-base.pkr.hcl b/debian-13/x86_64-qemu-base.pkr.hcl new file mode 100644 index 0000000..1653503 --- /dev/null +++ b/debian-13/x86_64-qemu-base.pkr.hcl @@ -0,0 +1,69 @@ +packer { + required_plugins { + qemu = { + version = ">= 1.1.3" + source = "github.com/hashicorp/qemu" + } + } +} + +variable "iso_url" { + default = "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-13.0.0-amd64-netinst.iso" +} + +variable "iso_hash" { + default = "sha256:e363cae0f1f22ed73363d0bde50b4ca582cb2816185cf6eac28e93d9bb9e1504" +} + +variable "disk_size" { + default = 102400 +} + +variable "memory" { + default = 2048 +} + +variable "headless" { + default = true +} + +source "qemu" "debian-13-64-base" { + iso_url = var.iso_url + iso_checksum = "${var.iso_hash}" + output_directory = "builds/qemu/debian-13-64-base" + shutdown_command = "/usr/bin/systemctl poweroff" + disk_interface = "virtio" + disk_size = var.disk_size + memory = var.memory + headless = var.headless + format = "qcow2" + accelerator = "kvm" + http_directory = "http" + ssh_username = "root" + ssh_password = "debian" + ssh_timeout = "60m" + vm_name = "debian-13-64-base" + net_device = "virtio-net" + boot_wait = "5s" + boot_command = [ + "", + "", + " auto=true", + " priority=critical", + " hostname=trixie", + " domain=", + " url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg", + "" + ] +} + +build { + name = "debian-base" + sources = ["source.qemu.debian-13-64-base"] + + provisioner "shell" { + scripts = [ + "scripts/aptupdate.sh", + ] + } +}