diff --git a/build_ebs_on_ec2.sh b/oem/ami/build_ebs_on_ec2.sh similarity index 93% rename from build_ebs_on_ec2.sh rename to oem/ami/build_ebs_on_ec2.sh index 182b887a16..c060836355 100755 --- a/build_ebs_on_ec2.sh +++ b/oem/ami/build_ebs_on_ec2.sh @@ -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" diff --git a/oem/ami/zip_and_ship_ami.sh b/oem/ami/zip_and_ship_ami.sh new file mode 100755 index 0000000000..9ff236a0b9 --- /dev/null +++ b/oem/ami/zip_and_ship_ami.sh @@ -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"