Skip to content

Instantly share code, notes, and snippets.

@dmamolina
Last active February 4, 2016 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmamolina/ae80d42cd4d39e66196a to your computer and use it in GitHub Desktop.
Save dmamolina/ae80d42cd4d39e66196a to your computer and use it in GitHub Desktop.
#!/bin/bash +x
function export_rc_vars
{
if [ -f $1 ] ; then
ONE_VARS=`cat $1 | egrep -e '^[a-zA-Z\-\_0-9]*=' | sed 's/=.*$//'`
. $1
for v in $ONE_VARS; do
export $v
done
fi
}
TMP_DIR=/tmp/one-context-tmp
TMP_FILE=$TMP_DIR/one-start-script
curl -o /tmp/context.sh http://169.254.169.254/latest/user-data
export_rc_vars /tmp/context.sh
echo -en "$START_SCRIPT_BASE64" | openssl enc -d -base64 -A > $TMP_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment