75 lines
2.2 KiB
Plaintext
75 lines
2.2 KiB
Plaintext
# ==============================================================================
|
|
# FreeBSD bsdinstall Scripting Configuration
|
|
# ==============================================================================
|
|
|
|
# 1. System & Partitioning Defaults
|
|
KEYMAP="us.kbd"
|
|
HOSTNAME="freebsd"
|
|
DISTRIBUTIONS="kernel.txz base.txz"
|
|
|
|
# FreeBSD Distribution Mirror
|
|
export BSDINSTALL_DISTSITE="http://download.freebsd.org/releases/amd64/15.1-RELEASE"
|
|
|
|
# 2. Configure networking in the live installer environment BEFORE fetch
|
|
IFACE=$(ifconfig -l ether | awk '{print $1}')
|
|
ifconfig "$IFACE" up
|
|
dhclient "$IFACE"
|
|
|
|
# Guided ZFS Installation Parameters
|
|
export nonInteractive="YES"
|
|
export ZFSBOOT_POOL_NAME="zroot"
|
|
export ZFSBOOT_DISKS="da0"
|
|
export ZFSBOOT_VDEV_TYPE="stripe"
|
|
export ZFSBOOT_BOOT_METHOD="UEFI"
|
|
export ZFSBOOT_PARTITION_SCHEME="GPT"
|
|
export ZFSBOOT_SWAP_SIZE="2g"
|
|
export ZFSBOOT_CONFIRM_POOL_CREATE="0"
|
|
|
|
# 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
|
|
|
|
# Ensure DNS works inside the chroot environment for pkg
|
|
cat << 'EOF' > /etc/resolv.conf
|
|
nameserver 8.8.8.8
|
|
nameserver 8.8.4.4
|
|
EOF
|
|
|
|
# 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
|