forked from mirage/mirage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ec2.sh
executable file
·36 lines (30 loc) · 947 Bytes
/
ec2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh -ex
# Build an EC2 bundle and upload/register it to Amazon
IMG=mirage.img
NAME=mirage-os
BUCKET=mirage-apps
MNT=/mnt/mirage
SUDO=sudo
if [ ! -e "$1" ]; then
echo Usage: $0 kernel.xen
exit 1
fi
${SUDO} mkdir -p /mnt/mirage
rm -f ${IMG}
dd if=/dev/zero of=${IMG} bs=1M count=5
${SUDO} mke2fs -F -j ${IMG}
${SUDO} mount -o loop ${IMG} ${MNT}
${SUDO} mkdir -p ${MNT}/boot/grub
echo default 0 > menu.lst
echo timeout 1 >> menu.lst
echo title Mirage >> menu.lst
echo " root (hd0)" >> menu.lst
echo " kernel /boot/mirage-os.gz" >> menu.lst
${SUDO} mv menu.lst ${MNT}/boot/grub/menu.lst
${SUDO} sh -c "gzip -c $1 > ${MNT}/boot/mirage-os.gz"
${SUDO} umount -d ${MNT}
rm -rf ec2_tmp
mkdir ec2_tmp
ec2-bundle-image -i ${IMG} -k ${EC2_PRIVATE_KEY} -c ${EC2_CERT} -u ${EC2_USER} -d ec2_tmp -r x86_64 --kernel aki-427d952b
ec2-upload-bundle -b ${BUCKET} -m ec2_tmp/${IMG}.manifest.xml -a ${EC2_ACCESS} -s ${EC2_ACCESS_SECRET}
rm -rf ec2_tmp