Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 May 2020 02:50:26 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r361643 - stable/12/release/tools
Message-ID:  <202005300250.04U2oQiq072757@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cperciva
Date: Sat May 30 02:50:26 2020
New Revision: 361643
URL: https://svnweb.freebsd.org/changeset/base/361643

Log:
  MFC r361143: Add /etc/autofs/special_efs to EC2 AMIs
  
  Sponsored by:	https://www.patreon.com/cperciva

Modified:
  stable/12/release/tools/ec2.conf
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/release/tools/ec2.conf
==============================================================================
--- stable/12/release/tools/ec2.conf	Sat May 30 02:09:36 2020	(r361642)
+++ stable/12/release/tools/ec2.conf	Sat May 30 02:50:26 2020	(r361643)
@@ -109,6 +109,23 @@ vm_extra_pre_umount() {
 		-e '1,/^#server/s/^#server.*/server 169.254.169.123 iburst/' \
 		${DESTDIR}/etc/ntp.conf
 
+	# Provide a map for accessing Elastic File System mounts
+	cat > ${DESTDIR}/etc/autofs/special_efs <<'EOF'
+#!/bin/sh
+
+if [ $# -eq 0 ]; then
+        # No way to know which EFS filesystems exist and are
+        # accessible to this EC2 instance.
+        exit 0
+fi
+
+# Provide instructions on how to mount the requested filesystem.
+FS=$1
+REGION=`fetch -qo- http://169.254.169.254/latest/meta-data/placement/availability-zone | sed -e 's/[a-z]$//'`
+echo "-nfsv4,minorversion=1,oneopenown ${FS}.efs.${REGION}.amazonaws.com:/"
+EOF
+	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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005300250.04U2oQiq072757>