path: root/release/tools
diff options
authorColin Percival <cperciva@FreeBSD.org>2020-05-17 21:54:59 +0000
committerColin Percival <cperciva@FreeBSD.org>2020-05-17 21:54:59 +0000
commitba97bfb0de8402acaa4aa9a8bdc9b153b267518e (patch)
tree39ce447b922fcff94c9ff2128c57f9165ff3e70c /release/tools
parent355711ea7628218bdf39cbe732caf1496d0dce90 (diff)
Add /etc/autofs/special_efs to EC2 AMIs
Since Amazon Elastic File System is only available within AWS, it seems more appropriate to have this added only in EC2 AMIs rather than "polluting" non-EC2 images with it. Reviewed by: gjb MFC after: 7 days Relnotes: Amazon EFS filesystems can be automounted by enabling autofs and placing "/efs -efs" into /etc/auto_master. Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D24791
Notes: svn path=/head/; revision=361143
Diffstat (limited to 'release/tools')
1 files changed, 17 insertions, 0 deletions
diff --git a/release/tools/ec2.conf b/release/tools/ec2.conf
index 147ee17a3609..a4b0abc8a1da 100644
--- a/release/tools/ec2.conf
+++ b/release/tools/ec2.conf
@@ -113,6 +113,23 @@ vm_extra_pre_umount() {
-e '1,/^#server/s/^#server.*/server iburst/' \
+ # Provide a map for accessing Elastic File System mounts
+ cat > ${DESTDIR}/etc/autofs/special_efs <<'EOF'
+if [ $# -eq 0 ]; then
+ # No way to know which EFS filesystems exist and are
+ # accessible to this EC2 instance.
+ exit 0
+# Provide instructions on how to mount the requested filesystem.
+REGION=`fetch -qo- | sed -e 's/[a-z]$//'`
+echo "-nfsv4,minorversion=1,oneopenown ${FS}.efs.${REGION}.amazonaws.com:/"
+ chmod 755 ${DESTDIR}/etc/autofs/special_efs
# The first time the AMI boots, the installed "first boot" scripts
# should be allowed to run:
# * ec2_configinit (download and process EC2 user-data)