add scripts

This commit is contained in:
Alex Polvi 2013-07-25 07:50:45 -07:00
parent d5befd8097
commit 5982943b4e
2 changed files with 14 additions and 3 deletions

View File

@ -2,6 +2,8 @@
#
# This expects to run on an EC2 instance.
#
# mad props to Eric Hammond for the initial script
# https://github.com/alestic/alestic-hardy-ebs/blob/master/bin/alestic-hardy-ebs-build-ami
# AKI ids from:
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
@ -84,7 +86,7 @@ fi
# if it is on the local fs, just use it, otherwise try to download it
if [ -e "$binurl" ]; then
bzcat $binurl | dd of=$dev bs=128M
bunzip2 -c $binurl | dd of=$dev bs=128M
else
curl -s $binurl | bunzip2 | dd of=$dev bs=128M
fi
@ -103,8 +105,7 @@ amiid=$(ec2-register \
--architecture "$arch" \
--kernel "$akiid" \
--block-device-mapping /dev/sda=$snapshotid::true \
--block-device-mapping $ephemeraldev=ephemeral0 \
--snapshot "$snapshotid" |
--block-device-mapping $ephemeraldev=ephemeral0 |
cut -f2)
ec2-delete-volume "$volumeid"

10
oem/ami/zip_and_ship_ami.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash -xe
#
# this needs more refactoring, but is used to build the latest image
IMG="../build/images/amd64-generic/latest/coreos_ami_image.bin"
ssh -i ~/.ssh/coreos-images.pem ubuntu@23.22.1.1 "mkdir -p /mnt/tmp"
bzip2 $IMG
scp -i ~/.ssh/coreos-images.pem build_ebs_on_ec2.sh $IMG.bz2 ubuntu@23.22.1.1:/mnt/tmp
ssh -i ~/.ssh/coreos-images.pem ubuntu@23.22.1.1 "sudo /mnt/tmp/build_ebs_on_ec2.sh /mnt/tmp/coreos_ami_image.bin.bz2"