diff --git a/FreeBSD/freebsd-15.pkr.hcl b/FreeBSD/freebsd-15.pkr.hcl index cef1052..82ec582 100644 --- a/FreeBSD/freebsd-15.pkr.hcl +++ b/FreeBSD/freebsd-15.pkr.hcl @@ -14,57 +14,12 @@ source "proxmox-iso" "freebsd-15" { vm_id = "210" boot_wait = "5s" boot_key_interval = "200ms" - boot_command = ["", - "", # wait for boot to finish - "", # begin installation - "", # keymap - "freebsd", # hostname - "", - "", - "", - "", # wait for network to come up - "", # wait for disk detection - "", - "", - " ", # select disk - "", # confirm disk destroy - "", # install base system - "packerpacker", # root password - "", # timezone region - "95", # timezone selection - "", - "", - "", - "", - " ", - " ", - "", - "", - "xadmin", # break-glass username - "Remote admin user", # break-glass name - "", - "", - "wheel", # break-glass group (wheel - "", - "", - "", - "", - "", - "", - "", - "", - "packer", # break-glass password - "packer", # break-glass password confirm - "", - "", - "", - "", - "", # open post-install shell - "pkg install -y qemu-guest-agent sudo", # install qemu-guest-agent package for Proxmox - "echo 'xadmin ALL=(ALL:ALL) NOPASSWD:ALL' > /usr/local/etc/sudoers.d/xadmin", # allow xadmin to sudo - "sysrc qemu_guest_agent_enable=YES", # enable QEMU guest agent - "exit", # exit shell - "" # reboot + boot_command = ["2", # boot to single-user mode + "/bin/sh", # open a shell + "mdmfs -s 100m md /tmp", # mount a writable /tmp memory disk + "dhclient vtnet0", # bring up network (adjust interface: em0, vtnet0, etc.) + "fetch -o /tmp/installerconfig http://{{ .HTTPIP }}:{{ .HTTPPort }}/freebsd-15-installerconfig", # grab the installerconfig + "bsdinstall script /tmp/installerconfig" # execute bsdinstall with fetched config ] os = "other" diff --git a/http/freebsd-15-installerconfig b/http/freebsd-15-installerconfig new file mode 100644 index 0000000..a2bb7a5 --- /dev/null +++ b/http/freebsd-15-installerconfig @@ -0,0 +1,56 @@ +# ============================================================================== +# FreeBSD bsdinstall Scripting Configuration +# ============================================================================== + +# 1. System & Partitioning Defaults +KEYMAP="us.kbd" +HOSTNAME="freebsd" +DISTRIBUTIONS="kernel.txz base.txz" + +# Guided ZFS Installation Parameters +# Note: Adjust 'da0' below if your hypervisor uses vtbd0 or ada0! +ZFSBOOT_DISKS="da0" +ZFSBOOT_VDEV_TYPE="stripe" +ZFSBOOT_CONFIRM_POOL_CREATE="YES" + +# Timezone Configuration (US/Eastern) +TIMEZONE="America/New_York" + +# Enabling Services (local_unbound, sshd, etc.) +# Maps to your service choices during setup +bsdinstall_services="sshd local_unbound" + + +# ============================================================================== +# Post-Installation Shell Script (Runs automatically in chroot) +# ============================================================================== +#!/bin/sh + +# Network configuration for the installed system +echo 'ifconfig_DEFAULT="DHCP"' >> /etc/rc.conf + +# Set Root Password ('packer') +echo "packer" | pw usermod root -h 0 + +# Create 'xadmin' user in 'wheel' group with password 'packer' +echo "packer" | pw useradd xadmin \ + -c "Remote admin user" \ + -g wheel \ + -m \ + -s /bin/sh \ + -h 0 + +# Install Packages (qemu-guest-agent, sudo) +# ASSUMPTION: The system has internet access during post-install +env ASSUME_ALWAYS_YES=YES pkg install -y qemu-guest-agent sudo + +# Sudoers configuration for xadmin +mkdir -p /usr/local/etc/sudoers.d +echo 'xadmin ALL=(ALL:ALL) NOPASSWD:ALL' > /usr/local/etc/sudoers.d/xadmin +chmod 0440 /usr/local/etc/sudoers.d/xadmin + +# Enable QEMU Guest Agent service +sysrc qemu_guest_agent_enable="YES" + +# Finalize and reboot system +reboot \ No newline at end of file