Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/release/tools/ec2-builder.conf
34677 views
1
#!/bin/sh
2
3
. ${WORLDDIR}/release/tools/ec2.conf
4
5
# Build with a 7.9 GB partition; this is enough for our stripped-down
6
# base system plus the compressed ec2-base image.
7
export VMSIZE=8000m
8
9
# Flags to installworld/kernel: We don't want debug symbols (kernel or
10
# userland), 32-bit libraries, tests, or the debugger.
11
export INSTALLOPTS="WITHOUT_DEBUG_FILES=YES WITHOUT_KERNEL_SYMBOLS=YES \
12
WITHOUT_LIB32=YES WITHOUT_TESTS=YES WITHOUT_LLDB=YES"
13
14
# Packages to install into the image we're creating. In addition to packages
15
# present on all EC2 AMIs, we install:
16
# * ec2-scripts, which provides a range of EC2ification startup scripts,
17
# * isc-dhcp44-client, used for IPv6 network setup, and
18
# * py-awscli, to make it easier for users to create AMIs.
19
export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} ec2-scripts \
20
isc-dhcp44-client devel/py-awscli"
21
22
# Services to enable in rc.conf(5).
23
export VM_RC_LIST="${VM_RC_LIST} ec2_configinit ec2_ephemeral_swap \
24
ec2_fetchkey ec2_loghostkey sshd"
25
26
vm_extra_pre_umount() {
27
# Any EC2 ephemeral disks seen when the system first boots will
28
# be "new" disks; there is no "previous boot" when they might have
29
# been seen and used already.
30
touch ${DESTDIR}/var/db/ec2_ephemeral_diskseen
31
32
# Configuration common to all EC2 AMIs
33
ec2_common
34
35
# Standard FreeBSD network configuration
36
ec2_base_networking
37
38
# Grab a copy of the ec2-base disk image, and compress it
39
zstd < ${EC2BASEIMG} > ${DESTDIR}/image.zst
40
41
# Disable fortune so we don't have extra noise at login
42
chmod a-x ${DESTDIR}/usr/bin/fortune
43
44
# Install the AMI-building script
45
install -m 755 ${WORLDDIR}/release/tools/mkami.sh ${DESTDIR}/bin/mkami
46
47
# Install an /etc/rc which juggles disks around for us
48
install -m 755 ${WORLDDIR}/release/tools/rc.amibuilder ${DESTDIR}/etc
49
50
# We want to mount from the UFS disk and juggle disks first
51
cat >> ${DESTDIR}/boot/loader.conf <<-EOF
52
vfs.root.mountfrom="ufs:/dev/gpt/rootfs"
53
init_script="/etc/rc.amibuilder"
54
EOF
55
56
return 0
57
}
58
59