Compare commits
2 Commits
9977148dd6
...
bbb88746ad
Author | SHA1 | Date | |
---|---|---|---|
bbb88746ad | |||
81f387c340 |
7
Makefile
7
Makefile
@ -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
|
||||
|
||||
|
@ -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"]
|
||||
}
|
||||
|
||||
}
|
||||
|
24
debianzfs.sh
24
debianzfs.sh
@ -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
|
||||
|
||||
#################
|
||||
@ -112,24 +112,6 @@ function create_root_pool () {
|
||||
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 () {
|
||||
umount /boot/efi
|
||||
dd if="$1" of="$2"
|
||||
@ -151,7 +133,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 +404,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
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
sudo passwd -d user
|
||||
sudo chmod u+x /tmp/debianzfs.sh
|
||||
sudo chmod u+x /tmp/debianzfs
|
||||
|
Loading…
Reference in New Issue
Block a user