Add Debian 13 Packer build configuration

This commit is contained in:
Kris Lamoureux 2025-08-15 00:27:26 -04:00
commit dcd80cd7a3
Signed by: kris
GPG Key ID: 105B748C1362EB96
8 changed files with 177 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
**/builds/

12
LICENSE Normal file
View File

@ -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.

9
README.md Normal file
View File

@ -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_

11
debian-13/Makefile Normal file
View File

@ -0,0 +1,11 @@
.PHONY: install clean
HEADLESS ?= true
default: install
install:
packer build -var 'headless=$(HEADLESS)' .
clean:
rm -rf ./builds

24
debian-13/README.md Normal file
View File

@ -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
```

View File

@ -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

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
apt-get update
apt-get upgrade -y

View File

@ -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 = [
"<down>",
"<tab>",
" auto=true",
" priority=critical",
" hostname=trixie",
" domain=",
" url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",
"<enter>"
]
}
build {
name = "debian-base"
sources = ["source.qemu.debian-13-64-base"]
provisioner "shell" {
scripts = [
"scripts/aptupdate.sh",
]
}
}