Files
Colin Percival eca3149032 ec2-desktop: Don't enable firstboot_pkgs
We don't have any packages to install by default when the instance
first boots, so (as with the "small" flavour) don't enable the
firstboot_pkgs script.  If someone wants to launch a desktop with
packages autoinstalled at first boot, they can enable the script at
the same time as they provide the list of packages.

Sponsored by:	Amazon
2026-09-19 18:09:53 -07:00

74 lines
3.1 KiB
Bash

#!/bin/sh
. ${WORLDDIR}/release/tools/ec2.conf
# Build with a (just under) 20 GB partition; all of the "desktop" bits
# significantly bloat the image compared with stock FreeBSD.
export VMSIZE=20000m
# Packages to install into the image we're creating. In addition to packages
# present on all EC2 AMIs, we install:
# * amazon-ssm-agent (not enabled by default, but some users need to use
# it on systems not connected to the internet),
# * ec2-scripts, which provides a range of EC2ification startup scripts,
# * firstboot-pkg-upgrade, to install security updates at first boot,
# * firstboot-pkgs, to install packages at first boot, and
# * isc-dhcp44-client, used for IPv6 network setup, and
# * kde, to provide a useful desktop environment
# * chromium and libreoffice, to provide an office environment,
# * xorg, xrdp, and xorgxrdp, to provide the display server.
export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} amazon-ssm-agent ec2-scripts \
firstboot-pkg-upgrade firstboot-pkgs isc-dhcp44-client \
kde chromium libreoffice xorg xrdp xorgxrdp"
# Services to enable in rc.conf(5).
export VM_RC_LIST="${VM_RC_LIST} ec2_configinit ec2_ephemeral_swap \
ec2_fetchkey ec2_setpass ec2_loghostkey firstboot_pkg_upgrade \
growfs growfs_postboot sshd dbus xrdp xrdp_sesman"
vm_extra_pre_umount() {
# Limit firstboot_pkg_upgrade to the base system.
echo 'firstboot_pkg_upgrade_repos="FreeBSD-base"' >> ${DESTDIR}/etc/rc.conf
# Don't allocate swap space when we first boot; that makes it
# impossible to grow the root filesystem later.
echo 'growfs_swap_size=0' >> ${DESTDIR}/etc/rc.conf
# Give users a KDE desktop by default.
sed -i '' -e '/exec.*startplasma/s/^# //' ${DESTDIR}/usr/local/etc/xrdp/startwm.sh
# Use UID/GID _xrdp. Disabled for now until the port supports this.
#sed -i '' -e '/SessionSockdirGroup/s/^#//' ${DESTDIR}/usr/local/etc/xrdp/sesman.ini
#sed -i '' -E -e '/runtime_(user|group)=_xrdp/s/^#//' ${DESTDIR}/usr/local/etc/xrdp/xrdp.ini
# Set login password and print in encrypted form to the console.
# This will be removed from here once it lands in the ec2-scripts port.
install -m 755 ${WORLDDIR}/release/tools/ec2_setpass ${DESTDIR}/usr/local/etc/rc.d
metalog_add_data ./usr/local/etc/rc.d/ec2_setpass 0755
# Run some additional commands on first boot which won't be
# necessary once (a) the xrdp port gains host key generation as
# an rc.d script, and (b) pkg triggers are logged in METALOG and
# run from a firstboot script.
install -m 755 ${WORLDDIR}/release/tools/ec2_desktop_extras ${DESTDIR}/usr/local/etc/rc.d
metalog_add_data ./usr/local/etc/rc.d/ec2_desktop_extras 0755
# Any EC2 ephemeral disks seen when the system first boots will
# be "new" disks; there is no "previous boot" when they might have
# been seen and used already.
touch ${DESTDIR}/var/db/ec2_ephemeral_diskseen
metalog_add_data ./var/db/ec2_ephemeral_diskseen
# Configuration common to all EC2 AMIs
ec2_common
# Standard FreeBSD network configuration
ec2_base_networking
# Add files from packages which weren't recorded in metalog
metalog_add_data ./usr/local/etc/dhclient.conf
metalog_add_data ./usr/local/etc/ssl/cert.pem
return 0
}