1#!/bin/sh 2 3. ${WORLDDIR}/release/tools/ec2.conf 4 5# Build with a (just under) 20 GB partition; all of the "desktop" bits 6# significantly bloat the image compared with stock FreeBSD. 7export VMSIZE=20000m 8 9# Packages to install into the image we're creating. In addition to packages 10# present on all EC2 AMIs, we install: 11# * amazon-ssm-agent (not enabled by default, but some users need to use 12# it on systems not connected to the internet), 13# * ec2-scripts, which provides a range of EC2ification startup scripts, 14# * firstboot-pkg-upgrade, to install security updates at first boot, 15# * firstboot-pkgs, to install packages at first boot, and 16# * isc-dhcp44-client, used for IPv6 network setup, and 17# * kde, to provide a useful desktop environment 18# * chromium and libreoffice, to provide an office environment, 19# * xorg, xrdp, and xorgxrdp, to provide the display server. 20export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} amazon-ssm-agent ec2-scripts \ 21 firstboot-pkg-upgrade firstboot-pkgs isc-dhcp44-client \ 22 kde chromium libreoffice xorg xrdp xorgxrdp" 23 24# Services to enable in rc.conf(5). 25export VM_RC_LIST="${VM_RC_LIST} ec2_configinit ec2_ephemeral_swap \ 26 ec2_fetchkey ec2_setpass ec2_loghostkey firstboot_pkg_upgrade \ 27 firstboot_pkgs growfs growfs_postboot sshd dbus xrdp xrdp_sesman" 28 29vm_extra_pre_umount() { 30 # Limit firstboot_pkg_upgrade to the base system. 31 echo 'firstboot_pkg_upgrade_repos="FreeBSD-base"' >> ${DESTDIR}/etc/rc.conf 32 33 # Don't allocate swap space when we first boot; that makes it 34 # impossible to grow the root filesystem later. 35 echo 'growfs_swap_size=0' >> ${DESTDIR}/etc/rc.conf 36 37 # Give users a KDE desktop by default. 38 sed -i '' -e '/exec.*startplasma/s/^# //' ${DESTDIR}/usr/local/etc/xrdp/startwm.sh 39 40 # Use UID/GID _xrdp. Disabled for now until the port supports this. 41 #sed -i '' -e '/SessionSockdirGroup/s/^#//' ${DESTDIR}/usr/local/etc/xrdp/sesman.ini 42 #sed -i '' -E -e '/runtime_(user|group)=_xrdp/s/^#//' ${DESTDIR}/usr/local/etc/xrdp/xrdp.ini 43 44 # Set login password and print in encrypted form to the console. 45 # This will be removed from here once it lands in the ec2-scripts port. 46 install -m 755 ${WORLDDIR}/release/tools/ec2_setpass ${DESTDIR}/usr/local/etc/rc.d 47 metalog_add_data ./usr/local/etc/rc.d/ec2_setpass 0755 48 49 # Run some additional commands on first boot which won't be 50 # necessary once (a) the xrdp port gains host key generation as 51 # an rc.d script, and (b) pkg triggers are logged in METALOG and 52 # run from a firstboot script. 53 install -m 755 ${WORLDDIR}/release/tools/ec2_desktop_extras ${DESTDIR}/usr/local/etc/rc.d 54 metalog_add_data ./usr/local/etc/rc.d/ec2_desktop_extras 0755 55 56 # Any EC2 ephemeral disks seen when the system first boots will 57 # be "new" disks; there is no "previous boot" when they might have 58 # been seen and used already. 59 touch ${DESTDIR}/var/db/ec2_ephemeral_diskseen 60 metalog_add_data ./var/db/ec2_ephemeral_diskseen 61 62 # Configuration common to all EC2 AMIs 63 ec2_common 64 65 # Standard FreeBSD network configuration 66 ec2_base_networking 67 68 # Add files from packages which weren't recorded in metalog 69 metalog_add_data ./usr/local/etc/dhclient.conf 70 metalog_add_data ./usr/local/etc/ssl/cert.pem 71 72 return 0 73} 74