Compare commits

..

No commits in common. "bbb88746ad1ba087ca5117b477a665e2d93949bc" and "9977148dd6a2d5470dc720c513724adb646cd642" have entirely different histories.

4 changed files with 30 additions and 21 deletions

View File

@ -1,13 +1,6 @@
all: debianzfs.qcow2 all: debianzfs.qcow2
# Generate password
debianzfs.qcow2: export PKR_VAR_password = "$(pwgen -s 8 1)" 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: debianzfs.qcow2:
packer build -color=false . | tee debianzfs.log packer build -color=false . | tee debianzfs.log

View File

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

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# This script is originally based off the "Debian Bullseye Root on ZFS" guide # Script is based off official guide: see "Debian Bullseye Root on ZFS"
# https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Bullseye%20Root%20on%20ZFS.html # https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Bullseye%20Root%20on%20ZFS.html
################# #################
@ -112,6 +112,24 @@ function create_root_pool () {
rpool $2 rpool $2
} }
function part_path () {
local DISK="$1"
local PART="$2"
[ "$(disk_check "$DISK")" == 1 ] && exit 1
if [ "${DISK:0:7}" == "/dev/sd" ]; then
DISK_PART="${DISK}${PART}"
elif [ "${DISK:0:9}" == "/dev/nvme" ]; then
DISK_PART="${DISK}p${PART}"
else
echo "ERROR: Disk not recognized"
exit 1
fi
[ "$(disk_check "$DISK_PART")" == 1 ] && exit 1
echo "$DISK_PART"
exit 0
}
function mirror_grub () { function mirror_grub () {
umount /boot/efi umount /boot/efi
dd if="$1" of="$2" dd if="$1" of="$2"
@ -133,7 +151,7 @@ function disk_byid_check () {
################ ################
# Static # Static
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
CODENAME="bookworm" CODENAME="bullseye"
# Options # Options
while getopts ':ghim:p:P:r:s:' OPTION; do while getopts ':ghim:p:P:r:s:' OPTION; do
@ -404,7 +422,7 @@ unset CDPATH
cd cd
# 5. Configure a basic system environment # 5. Configure a basic system environment
ln -fs /proc/self/mounts /etc/mtab ln -s /proc/self/mounts /etc/mtab
apt-get update && apt-get upgrade -y apt-get update && apt-get upgrade -y
apt-get install -y console-setup locales apt-get install -y console-setup locales

View File

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