Updated debianzfs for Debian 12 (Bookworm)

- Shifted release info to packer variables
- Doubled boot_command initial wait to 20s
- Renamed Packer source to debian-live
- Removed .sh from debianzfs script path
- Tweaked comment wording
- Replaced hardcoded codename
- Used 'ln -fs' for existing /etc/mtab
This commit is contained in:
Kris Lamoureux 2023-06-12 00:47:58 -04:00
parent 9977148dd6
commit 81f387c340
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
4 changed files with 21 additions and 12 deletions

View File

@ -1,6 +1,13 @@
all: debianzfs.qcow2
# Generate password
debianzfs.qcow2: export PKR_VAR_password="$(pwgen -s 8 1)"
# Release info
debianzfs.qcow2: export PKR_VAR_release=12.0.0
debianzfs.qcow2: export PKR_VAR_codename=bookworm
debianzfs.qcow2: export PKR_VAR_sha256=fa3960f6f692fc60a43eec4362d60f754b4a246ab64aa662270dd879a946de84
debianzfs.qcow2:
packer build -color=false . | tee debianzfs.log

View File

@ -1,9 +1,11 @@
# Set 'password' using shell var: PKR_VAR_password=$(pwgen -s 8 1)
variable "password" {}
variable "release" {}
variable "sha256" {}
source "qemu" "bullseye-live" {
iso_url = "https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-11.5.0-amd64-standard.iso"
iso_checksum = "sha256:8172b188061d098080bb315972becbe9bd387c856866746cee018102cd00fc9b"
source "qemu" "debian-live" {
iso_url = "https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-${var.release}-amd64-standard.iso"
iso_checksum = "sha256:${var.sha256}"
output_directory = "output"
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
disk_size = "5000M"
@ -19,7 +21,7 @@ source "qemu" "bullseye-live" {
disk_interface = "virtio"
boot_wait = "5s"
boot_command = [
"<enter><wait10>",
"<enter><wait20>",
"<enter><wait>",
"sudo -i<enter><wait>",
"read -s userpw<enter><wait>",
@ -33,11 +35,11 @@ source "qemu" "bullseye-live" {
build {
name = "zfs"
sources = ["source.qemu.bullseye-live"]
sources = ["source.qemu.debian-live"]
provisioner "file" {
source = "debianzfs.sh"
destination = "/tmp/debianzfs.sh"
destination = "/tmp/debianzfs"
}
provisioner "shell" {
@ -45,7 +47,7 @@ build {
}
provisioner "shell" {
inline = ["sudo /tmp/debianzfs.sh -i -s0 -p changeme -P letmeinzfs! /dev/vda debianzfs"]
inline = ["sudo /tmp/debianzfs -i -s0 -p 'changeme' -P 'letmeinzfs!' /dev/vda debianzfs"]
}
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Script is based off official guide: see "Debian Bullseye Root on ZFS"
# This script is originally based off the "Debian Bullseye Root on ZFS" guide
# https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Bullseye%20Root%20on%20ZFS.html
#################
@ -151,7 +151,7 @@ function disk_byid_check () {
################
# Static
export DEBIAN_FRONTEND=noninteractive
CODENAME="bullseye"
CODENAME="bookworm"
# Options
while getopts ':ghim:p:P:r:s:' OPTION; do
@ -422,7 +422,7 @@ unset CDPATH
cd
# 5. Configure a basic system environment
ln -s /proc/self/mounts /etc/mtab
ln -fs /proc/self/mounts /etc/mtab
apt-get update && apt-get upgrade -y
apt-get install -y console-setup locales

View File

@ -1,3 +1,3 @@
#!/bin/bash
sudo passwd -d user
sudo chmod u+x /tmp/debianzfs.sh
sudo chmod u+x /tmp/debianzfs