Fetch all EC2 metadata / user data in the initrd
Since we're already fetching one datum, we may as well fetch the others needed by fetch-ec2-data. This also eliminates the dependency on wget.
This commit is contained in:
@@ -57,8 +57,7 @@ let cfg = config.ec2; in
|
||||
boot.initrd.postMountCommands =
|
||||
''
|
||||
metaDir=$targetRoot/etc/ec2-metadata
|
||||
mkdir -m 0755 -p $targetRoot/etc
|
||||
mkdir -m 0700 -p "$metaDir"
|
||||
mkdir -m 0755 -p "$metaDir"
|
||||
|
||||
echo "getting EC2 instance metadata..."
|
||||
|
||||
@@ -66,6 +65,19 @@ let cfg = config.ec2; in
|
||||
wget -q -O "$metaDir/ami-manifest-path" http://169.254.169.254/1.0/meta-data/ami-manifest-path
|
||||
fi
|
||||
|
||||
if ! [ -e "$metaDir/user-data" ]; then
|
||||
wget -q -O "$metaDir/user-data" http://169.254.169.254/1.0/user-data
|
||||
chmod 600 "$metaDir/user-data"
|
||||
fi
|
||||
|
||||
if ! [ -e "$metaDir/hostname" ]; then
|
||||
wget -q -O "$metaDir/hostname" http://169.254.169.254/1.0/meta-data/hostname
|
||||
fi
|
||||
|
||||
if ! [ -e "$metaDir/public-keys-0-openssh-key" ]; then
|
||||
wget -q -O "$metaDir/public-keys-0-openssh-key" http://169.254.169.254/1.0/meta-data/public-keys/0/openssh-key
|
||||
fi
|
||||
|
||||
diskNr=0
|
||||
diskForUnionfs=
|
||||
for device in /dev/xvd[abcde]*; do
|
||||
|
||||
Reference in New Issue
Block a user