Permalink
Browse files

whitespace

  • Loading branch information...
scgilardi committed Apr 28, 2012
1 parent 8eab253 commit f0b7d3bbca3f3784b3c47cb1db16044cf5a14299
Showing with 104 additions and 105 deletions.
  1. +104 −105 build.sh
View
209 build.sh
@@ -48,137 +48,136 @@ fi
# customize it
if [ ! -e "${FOLDER_ISO}/custom.iso" ]; then
- tar -C "${FOLDER_ISO_CUSTOM}" -xf "${ISO_FILENAME}"
+ tar -C "${FOLDER_ISO_CUSTOM}" -xf "${ISO_FILENAME}"
# backup initrd.gz
- chmod u+w "${FOLDER_ISO_CUSTOM}/install" "${FOLDER_ISO_CUSTOM}/install/initrd.gz"
- mv "${FOLDER_ISO_CUSTOM}/install/initrd.gz" "${FOLDER_ISO_CUSTOM}/install/initrd.gz.org"
+ chmod u+w "${FOLDER_ISO_CUSTOM}/install" "${FOLDER_ISO_CUSTOM}/install/initrd.gz"
+ mv "${FOLDER_ISO_CUSTOM}/install/initrd.gz" "${FOLDER_ISO_CUSTOM}/install/initrd.gz.org"
# stick in our new initrd.gz
- cd "${FOLDER_ISO_INITRD}"
- gunzip -c "${FOLDER_ISO_CUSTOM}/install/initrd.gz.org" | cpio -id
- cd "${FOLDER_BASE}"
- cp preseed.cfg "${FOLDER_ISO_INITRD}/preseed.cfg"
- cd "${FOLDER_ISO_INITRD}"
- find . | cpio --create --format='newc' | gzip > "${FOLDER_ISO_CUSTOM}/install/initrd.gz"
+ cd "${FOLDER_ISO_INITRD}"
+ gunzip -c "${FOLDER_ISO_CUSTOM}/install/initrd.gz.org" | cpio -id
+ cd "${FOLDER_BASE}"
+ cp preseed.cfg "${FOLDER_ISO_INITRD}/preseed.cfg"
+ cd "${FOLDER_ISO_INITRD}"
+ find . | cpio --create --format='newc' | gzip > "${FOLDER_ISO_CUSTOM}/install/initrd.gz"
# clean up permissions
- chmod u-w "${FOLDER_ISO_CUSTOM}/install" "${FOLDER_ISO_CUSTOM}/install/initrd.gz" "${FOLDER_ISO_CUSTOM}/install/initrd.gz.org"
+ chmod u-w "${FOLDER_ISO_CUSTOM}/install" "${FOLDER_ISO_CUSTOM}/install/initrd.gz" "${FOLDER_ISO_CUSTOM}/install/initrd.gz.org"
# replace isolinux configuration
- cd "${FOLDER_BASE}"
- chmod u+w "${FOLDER_ISO_CUSTOM}/isolinux" "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.cfg"
- rm "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.cfg"
- cp isolinux.cfg "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.cfg"
- chmod u+w "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.bin"
+ cd "${FOLDER_BASE}"
+ chmod u+w "${FOLDER_ISO_CUSTOM}/isolinux" "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.cfg"
+ rm "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.cfg"
+ cp isolinux.cfg "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.cfg"
+ chmod u+w "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.bin"
# add late_command script
- chmod u+w "${FOLDER_ISO_CUSTOM}"
- cp "${FOLDER_BASE}/late_command.sh" "${FOLDER_ISO_CUSTOM}"
-
- mkisofs -r -V "Custom Ubuntu Install CD" \
- -cache-inodes -quiet \
- -J -l -b isolinux/isolinux.bin \
- -c isolinux/boot.cat -no-emul-boot \
- -boot-load-size 4 -boot-info-table \
- -o "${FOLDER_ISO}/custom.iso" "${FOLDER_ISO_CUSTOM}"
-
+ chmod u+w "${FOLDER_ISO_CUSTOM}"
+ cp "${FOLDER_BASE}/late_command.sh" "${FOLDER_ISO_CUSTOM}"
+
+ mkisofs -r -V "Custom Ubuntu Install CD" \
+ -cache-inodes -quiet \
+ -J -l -b isolinux/isolinux.bin \
+ -c isolinux/boot.cat -no-emul-boot \
+ -boot-load-size 4 -boot-info-table \
+ -o "${FOLDER_ISO}/custom.iso" "${FOLDER_ISO_CUSTOM}"
fi
# create virtual machine
if ! VBoxManage showvminfo "${BOX}" >/dev/null 2>/dev/null; then
- VBoxManage createvm \
- --name "${BOX}" \
- --ostype Ubuntu_64 \
- --register \
- --basefolder "${FOLDER_VBOX}"
-
- VBoxManage modifyvm "${BOX}" \
- --memory 360 \
- --boot1 dvd \
- --boot2 disk \
- --boot3 none \
- --boot4 none \
- --vram 12 \
- --pae off \
- --rtcuseutc on
-
- VBoxManage storagectl "${BOX}" \
- --name "IDE Controller" \
- --add ide \
- --controller PIIX4 \
- --hostiocache on
-
- VBoxManage storageattach "${BOX}" \
- --storagectl "IDE Controller" \
- --port 1 \
- --device 0 \
- --type dvddrive \
- --medium "${FOLDER_ISO}/custom.iso"
-
- VBoxManage storagectl "${BOX}" \
- --name "SATA Controller" \
- --add sata \
- --controller IntelAhci \
- --sataportcount 1 \
- --hostiocache off
-
- VBoxManage createhd \
- --filename "${FOLDER_VBOX}/${BOX}/${BOX}.vdi" \
- --size 40960
-
- VBoxManage storageattach "${BOX}" \
- --storagectl "SATA Controller" \
- --port 0 \
- --device 0 \
- --type hdd \
- --medium "${FOLDER_VBOX}/${BOX}/${BOX}.vdi"
-
- VBoxManage startvm "${BOX}"
-
- echo -n "Waiting for installer to finish "
- while VBoxManage list runningvms | grep "${BOX}" >/dev/null; do
- sleep 20
- echo -n "."
- done
- echo ""
+ VBoxManage createvm \
+ --name "${BOX}" \
+ --ostype Ubuntu_64 \
+ --register \
+ --basefolder "${FOLDER_VBOX}"
+
+ VBoxManage modifyvm "${BOX}" \
+ --memory 360 \
+ --boot1 dvd \
+ --boot2 disk \
+ --boot3 none \
+ --boot4 none \
+ --vram 12 \
+ --pae off \
+ --rtcuseutc on
+
+ VBoxManage storagectl "${BOX}" \
+ --name "IDE Controller" \
+ --add ide \
+ --controller PIIX4 \
+ --hostiocache on
+
+ VBoxManage storageattach "${BOX}" \
+ --storagectl "IDE Controller" \
+ --port 1 \
+ --device 0 \
+ --type dvddrive \
+ --medium "${FOLDER_ISO}/custom.iso"
+
+ VBoxManage storagectl "${BOX}" \
+ --name "SATA Controller" \
+ --add sata \
+ --controller IntelAhci \
+ --sataportcount 1 \
+ --hostiocache off
+
+ VBoxManage createhd \
+ --filename "${FOLDER_VBOX}/${BOX}/${BOX}.vdi" \
+ --size 40960
+
+ VBoxManage storageattach "${BOX}" \
+ --storagectl "SATA Controller" \
+ --port 0 \
+ --device 0 \
+ --type hdd \
+ --medium "${FOLDER_VBOX}/${BOX}/${BOX}.vdi"
+
+ VBoxManage startvm "${BOX}"
+
+ echo -n "Waiting for installer to finish "
+ while VBoxManage list runningvms | grep -q "${BOX}"; do
+ sleep 20
+ echo -n "."
+ done
+ echo
# Forward SSH
- VBoxManage modifyvm "${BOX}" \
- --natpf1 "guestssh,tcp,,2222,,22"
+ VBoxManage modifyvm "${BOX}" \
+ --natpf1 "guestssh,tcp,,2222,,22"
# Attach guest additions iso
- VBoxManage storageattach "${BOX}" \
- --storagectl "IDE Controller" \
- --port 1 \
- --device 0 \
- --type dvddrive \
- --medium "${ISO_GUESTADDITIONS}"
+ VBoxManage storageattach "${BOX}" \
+ --storagectl "IDE Controller" \
+ --port 1 \
+ --device 0 \
+ --type dvddrive \
+ --medium "${ISO_GUESTADDITIONS}"
- VBoxManage startvm "${BOX}"
+ VBoxManage startvm "${BOX}"
# get private key
- wget -O "${FOLDER_BUILD}/id_rsa" --no-check-certificate "https://raw.github.com/mitchellh/vagrant/master/keys/vagrant"
- chmod 600 "${FOLDER_BUILD}/id_rsa"
+ wget -O "${FOLDER_BUILD}/id_rsa" --no-check-certificate "https://raw.github.com/mitchellh/vagrant/master/keys/vagrant"
+ chmod 600 "${FOLDER_BUILD}/id_rsa"
# install virtualbox guest additions
- ssh -i "${FOLDER_BUILD}/id_rsa" -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 2222 vagrant@127.0.0.1 "sudo mount /dev/cdrom /media/cdrom; sudo sh /media/cdrom/VBoxLinuxAdditions.run; sudo umount /media/cdrom; sudo shutdown -h now"
- echo -n "Waiting for machine to shut off "
- while VBoxManage list runningvms | grep "${BOX}" >/dev/null; do
- sleep 20
- echo -n "."
- done
- echo ""
+ ssh -i "${FOLDER_BUILD}/id_rsa" -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 2222 vagrant@127.0.0.1 "sudo mount /dev/cdrom /media/cdrom; sudo sh /media/cdrom/VBoxLinuxAdditions.run; sudo umount /media/cdrom; sudo shutdown -h now"
+ echo -n "Waiting for machine to shut off "
+ while VBoxManage list runningvms | grep -q "${BOX}"; do
+ sleep 20
+ echo -n "."
+ done
+ echo
- VBoxManage modifyvm "${BOX}" --natpf1 delete "guestssh"
+ VBoxManage modifyvm "${BOX}" --natpf1 delete "guestssh"
# Detach guest additions iso
- VBoxManage storageattach "${BOX}" \
- --storagectl "IDE Controller" \
- --port 1 \
- --device 0 \
- --type dvddrive \
- --medium emptydrive
+ VBoxManage storageattach "${BOX}" \
+ --storagectl "IDE Controller" \
+ --port 1 \
+ --device 0 \
+ --type dvddrive \
+ --medium emptydrive
fi
vagrant package --base "${BOX}"

0 comments on commit f0b7d3b

Please sign in to comment.