1#!/bin/sh 2 3. ${WORLDDIR}/release/tools/ec2.conf 4 5# Build with a 4.9 GB partition; the growfs rc.d script will expand 6# the partition to fill the root disk after the EC2 instance is launched. 7# Note that if this is set to <N>G, we will end up with an <N+1> GB disk 8# image since VMSIZE is the size of the filesystem partition, not the disk 9# which it resides within. (This overrides the default in ec2.conf.) 10export VMSIZE=5000m 11 12# Flags to installworld/kernel: We don't want debug symbols (kernel or 13# userland), 32-bit libraries, or tests. 14export INSTALLOPTS="WITHOUT_DEBUG_FILES=YES WITHOUT_KERNEL_SYMBOLS=YES \ 15 WITHOUT_LIB32=YES WITHOUT_TESTS=YES" 16 17# Equivalent to INSTALLOPTS for pkgbase 18vm_extra_filter_base_packages() { 19 grep -v \ 20 -e '.*-dbg$' \ 21 -e '.*-lib32$' \ 22 -e '^FreeBSD-set-tests' 23} 24 25# Packages to install into the image we're creating. In addition to packages 26# present on all EC2 AMIs, we install: 27# * ec2-scripts, which provides a range of EC2ification startup scripts, 28# * firstboot-pkg-upgrade, to install security updates at first boot, 29# * firstboot-pkgs, to install packages at first boot, and 30# * isc-dhcp44-client, used for IPv6 network setup. 31export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} ec2-scripts \ 32 firstboot-pkg-upgrade firstboot-pkgs isc-dhcp44-client" 33 34# Services to enable in rc.conf(5). 35export VM_RC_LIST="${VM_RC_LIST} ec2_configinit ec2_ephemeral_swap \ 36 ec2_fetchkey ec2_loghostkey firstboot_pkg_upgrade \ 37 growfs growfs_postboot sshd" 38 39vm_extra_pre_umount() { 40 # Limit firstboot_pkg_upgrade to the base system. 41 echo 'firstboot_pkg_upgrade_repos="FreeBSD-base"' >> ${DESTDIR}/etc/rc.conf 42 43 # Don't allocate swap space when we first boot; that makes it 44 # impossible to grow the root filesystem later. 45 echo 'growfs_swap_size=0' >> ${DESTDIR}/etc/rc.conf 46 47 # Any EC2 ephemeral disks seen when the system first boots will 48 # be "new" disks; there is no "previous boot" when they might have 49 # been seen and used already. 50 touch ${DESTDIR}/var/db/ec2_ephemeral_diskseen 51 metalog_add_data ./var/db/ec2_ephemeral_diskseen 52 53 # Configuration common to all EC2 AMIs 54 ec2_common 55 56 # Standard FreeBSD network configuration 57 ec2_base_networking 58 59 # Add files from packages which weren't recorded in metalog 60 metalog_add_data ./usr/local/etc/dhclient.conf 61 62 return 0 63} 64