Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more improvements to build.sh, remove some external dependencies

  • Loading branch information...
commit fe682126c9453355a306c63b79ebb81107f4d7bd 1 parent 7f50a06
@mostlygeek mostlygeek authored
Showing with 18 additions and 3 deletions.
  1. +18 −3 build.sh
View
21 build.sh
@@ -1,5 +1,8 @@
#!/bin/bash
+# make sure we have dependencies
+hash mkisofs 2>/dev/null || { echo >&2 "ERROR: mkisofs not found. Aborting."; exit 1; }
+
BOX="ubuntu-precise-64"
# location, location, location
@@ -16,6 +19,7 @@ mkdir -p "${FOLDER_VBOX}"
mkdir -p "${FOLDER_ISO}"
# let's make sure they're empty
+echo "Cleaning Custom build directories..."
chmod -R u+w "${FOLDER_ISO_CUSTOM}"
rm -rf "${FOLDER_ISO_CUSTOM}"
mkdir -p "${FOLDER_ISO_CUSTOM}"
@@ -31,6 +35,7 @@ INITRD_FILENAME="${FOLDER_ISO}/initrd.gz"
ISO_GUESTADDITIONS="/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso"
# download the installation disk if you haven't already or it is corrupted somehow
+echo "Downloading ubuntu-12.04-alternate-amd64.iso ..."
if [ ! -e "${ISO_FILENAME}" ]
then
curl --output "${ISO_FILENAME}" -L "${ISO_URL}"
@@ -38,20 +43,25 @@ else
# make sure download is right...
ISO_HASH=`md5 -q "${ISO_FILENAME}"`
if [ "${ISO_MD5}" != "${ISO_HASH}" ]; then
- echo "MD5 does not match. Got ${ISO_HASH} instead of ${ISO_MD5}"
+ echo "ERROR: MD5 does not match. Got ${ISO_HASH} instead of ${ISO_MD5}. Aborting."
exit 1
fi
fi
# customize it
+echo "Creating Custom ISO"
if [ ! -e "${FOLDER_ISO}/custom.iso" ]; then
+
+ echo "Untarring downloaded ISO ..."
tar -C "${FOLDER_ISO_CUSTOM}" -xf "${ISO_FILENAME}"
# backup initrd.gz
+ echo "Backing up current init.rd ..."
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
+ echo "Installing new initrd.gz ..."
cd "${FOLDER_ISO_INITRD}"
gunzip -c "${FOLDER_ISO_CUSTOM}/install/initrd.gz.org" | cpio -id
cd "${FOLDER_BASE}"
@@ -60,9 +70,11 @@ if [ ! -e "${FOLDER_ISO}/custom.iso" ]; then
find . | cpio --create --format='newc' | gzip > "${FOLDER_ISO_CUSTOM}/install/initrd.gz"
# clean up permissions
+ echo "Cleaning up Permissions ..."
chmod u-w "${FOLDER_ISO_CUSTOM}/install" "${FOLDER_ISO_CUSTOM}/install/initrd.gz" "${FOLDER_ISO_CUSTOM}/install/initrd.gz.org"
# replace isolinux configuration
+ echo "Replacing isolinux config ..."
cd "${FOLDER_BASE}"
chmod u+w "${FOLDER_ISO_CUSTOM}/isolinux" "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.cfg"
rm "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.cfg"
@@ -70,9 +82,11 @@ if [ ! -e "${FOLDER_ISO}/custom.iso" ]; then
chmod u+w "${FOLDER_ISO_CUSTOM}/isolinux/isolinux.bin"
# add late_command script
+ echo "Add late_command script ..."
chmod u+w "${FOLDER_ISO_CUSTOM}"
cp "${FOLDER_BASE}/late_command.sh" "${FOLDER_ISO_CUSTOM}"
-
+
+ echo "Running mkisofs ..."
mkisofs -r -V "Custom Ubuntu Install CD" \
-cache-inodes -quiet \
-J -l -b isolinux/isolinux.bin \
@@ -82,6 +96,7 @@ if [ ! -e "${FOLDER_ISO}/custom.iso" ]; then
fi
+echo "Creating VM Box..."
# create virtual machine
if ! VBoxManage showvminfo "${BOX}" >/dev/null 2>/dev/null; then
VBoxManage createvm \
@@ -155,7 +170,7 @@ if ! VBoxManage showvminfo "${BOX}" >/dev/null 2>/dev/null; then
VBoxManage startvm "${BOX}"
# get private key
- wget -O "${FOLDER_BUILD}/id_rsa" --no-check-certificate "https://raw.github.com/mitchellh/vagrant/master/keys/vagrant"
+ curl --output "${FOLDER_BUILD}/id_rsa" "https://raw.github.com/mitchellh/vagrant/master/keys/vagrant"
chmod 600 "${FOLDER_BUILD}/id_rsa"
# install virtualbox guest additions
Please sign in to comment.
Something went wrong with that request. Please try again.