Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 40 lines (33 sloc) 1.2 KB
if [ $# -lt $EXPECTEDARGS ]; then
echo "You didn't provide a qcow. Downloading Ubuntu for you instead..."
echo ""
# Pull Ubuntu 14.04 UEC qcow
INPUT_PATH=`readlink -f ./trusty-server-cloudimg-amd64-disk1.img`
INPUT_PATH=`readlink -f $1`
# Mount qcow & give it access to sys resources & Internet
sudo modprobe nbd max_part=14
sudo qemu-nbd -c /dev/nbd0 $INPUT_PATH
sudo mkdir /mnt/image
sudo mount /dev/nbd0p1 /mnt/image
sudo mount --bind /dev /mnt/image/dev
sudo mount --bind /proc /mnt/image/proc
sudo mv /mnt/image/etc/resolv.conf /mnt/image/etc/resolv.conf.bak
sudo cp -f /etc/resolv.conf /mnt/image/etc/resolv.conf
# Modify qcow to work for RAX public cloud
pushd distro_scripts
sudo cp /mnt/image/tmp/
sudo chroot /mnt/image /bin/bash -c "su - -c 'cd /tmp ; ./'"
# Unmount modified qcow & cleanup
sudo mv /mnt/image/etc/resolv.conf.bak /mnt/image/etc/resolv.conf
sudo rm -rf /mtn/image/tmp/*
sudo umount -l /mnt/image/dev/
sudo umount -l /mnt/image/proc/
sudo umount -l /mnt/image
sudo qemu-nbd -d /dev/nbd0
sudo rm -rf /mnt/image
You can’t perform that action at this time.