Last active
August 29, 2015 14:06
-
-
Save whiteley/75c3ba9997dc1ff51e1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -ex | |
# License: CC0 | |
parted -s /dev/xvdb mklabel msdos mkpart primary 0% 100% | |
mke2fs -L ubuntu-installer /dev/xvdb1 -F | |
mount LABEL=ubuntu-installer /mnt | |
cd /mnt | |
ARCH=amd64 | |
DIST=trusty-updates | |
DI_VERSION=current | |
AZ=$(wget -O - -q http://169.254.169.254/latest/meta-data/placement/availability-zone) | |
MIRROR=http://${AZ%?}.ec2.archive.ubuntu.com | |
BASEURL=$MIRROR/ubuntu/dists/$DIST/main/installer-$ARCH/$DI_VERSION/images/netboot/xen | |
wget $BASEURL/initrd.gz $BASEURL/vmlinuz | |
mkdir -p boot/grub | |
cat > boot/grub/menu.lst <<__END__ | |
default 0 | |
timeout 3 | |
title Ubuntu Installer ($DI_VERSION $ARCH) | |
root (hd0,0) | |
kernel /vmlinuz root=LABEL=ubuntu-installer ro console=hvc0 auto=true priority=critical url=http://169.254.169.254/latest/user-data DEBIAN_FRONTEND=text | |
initrd /initrd.gz | |
__END__ | |
sleep 30 | |
halt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment