xref: /freebsd/release/tools/ec2-base.conf (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1#!/bin/sh
2
3. ${WORLDDIR}/release/tools/ec2.conf
4
5# Packages to install into the image we're creating.  In addition to packages
6# present on all EC2 AMIs, we install:
7# * ec2-scripts, which provides a range of EC2ification startup scripts,
8# * firstboot-freebsd-update, to install security updates at first boot,
9# * firstboot-pkgs, to install packages at first boot, and
10# * isc-dhcp44-client, used for IPv6 network setup.
11export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} ec2-scripts \
12    firstboot-freebsd-update firstboot-pkgs isc-dhcp44-client"
13
14# Services to enable in rc.conf(5).
15export VM_RC_LIST="${VM_RC_LIST} ec2_configinit ec2_ephemeral_swap \
16    ec2_fetchkey ec2_loghostkey firstboot_freebsd_update firstboot_pkgs \
17    growfs sshd"
18
19vm_extra_pre_umount() {
20	# The AWS CLI tools are generally useful, and small enough that they
21	# will download quickly; but users will often override this setting
22	# via EC2 user-data.
23	echo 'firstboot_pkgs_list="devel/py-awscli"' >> ${DESTDIR}/etc/rc.conf
24
25	# EC2 instances use DHCP to get their network configuration.  IPv6
26	# requires accept_rtadv.
27	echo 'ifconfig_DEFAULT="SYNCDHCP accept_rtadv"' >> ${DESTDIR}/etc/rc.conf
28
29	# Enable IPv6 on all interfaces, and spawn DHCPv6 via rtsold
30	echo 'ipv6_activate_all_interfaces="YES"' >> ${DESTDIR}/etc/rc.conf
31	echo 'rtsold_enable="YES"' >> ${DESTDIR}/etc/rc.conf
32	echo 'rtsold_flags="-M /usr/local/libexec/rtsold-M -a"' >> ${DESTDIR}/etc/rc.conf
33
34	# Provide a script which rtsold can use to launch DHCPv6
35	mkdir -p ${DESTDIR}/usr/local/libexec
36	cat > ${DESTDIR}/usr/local/libexec/rtsold-M <<'EOF'
37#!/bin/sh
38
39/usr/local/sbin/dhclient -6 -nw -N -cf /dev/null $1
40EOF
41	chmod 755 ${DESTDIR}/usr/local/libexec/rtsold-M
42
43	# Any EC2 ephemeral disks seen when the system first boots will
44	# be "new" disks; there is no "previous boot" when they might have
45	# been seen and used already.
46	touch ${DESTDIR}/var/db/ec2_ephemeral_diskseen
47
48	# Configuration common to all EC2 AMIs
49	ec2_common
50
51	return 0
52}
53