Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding experimental support for OSX Mavericks via "Install OS X Mavericks.app" #848

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions templates/OSX/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ curl -k 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' > /Us
chmod 600 /Users/vagrant/.ssh/authorized_keys
chown -R vagrant /Users/vagrant/.ssh

# Make zero free space on the drive so veewee can shrink it later with vmware-vdiskmanager
# References: https://communities.vmware.com/message/2289660
# http://www.vmware.com/support/ws45/doc/disks_vdiskmanager_run_ws.html
cat /dev/zero > wipefile; rm wipefile

exit
37 changes: 32 additions & 5 deletions templates/OSX/prepare_veewee_iso/prepare_veewee_iso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ usage() {
cat <<EOF
Usage:
$(basename "$0") "/path/to/InstallESD.dmg" [/path/to/output/directory]
$(basename "$0") "/path/to/Install OS X [Mountain] Lion.app" [/path/to/output/directory]
$(basename "$0") "/path/to/Install OS X [[Mountain] Lion|Mavericks].app" [/path/to/output/directory]

Description:
Converts a 10.7/10.8 installer image to a new image that contains components
Expand Down Expand Up @@ -124,15 +124,33 @@ if [ $? -ne 0 ]; then
msg_error "Could not mount $ESD on $MNT_ESD"
exit 1
fi
DMG_OS_VERS=$(/usr/libexec/PlistBuddy -c 'Print :ProductVersion' "$MNT_ESD/System/Library/CoreServices/SystemVersion.plist")
if [ -e "$MNT_ESD/System/Library/CoreServices/SystemVersion.plist" ]; then
SYSTEM_VERSION_PLIST="$MNT_ESD/System/Library/CoreServices/SystemVersion.plist"
elif [ -e "$MNT_ESD/BaseSystem.dmg" ]; then
# This is probably an "Install OS X Mavericks.app"... check the BaseSystem.dmg for the SystemVersion.plist
MNT_BASESYSTEM=`/usr/bin/mktemp -d /tmp/veewee-osx-basesystem.XXXX`
hdiutil attach "$MNT_ESD/BaseSystem.dmg" -mountpoint "$MNT_BASESYSTEM" -shadow -nobrowse -owners on
[ $? -ne 0 ] && msg_error "Could not mount $MNT_ESD/BaseSystem.dmg on $MNT_BASESYSTEM" && exit 1
if [ -e "$MNT_BASESYSTEM/System/Library/CoreServices/SystemVersion.plist" ]; then
SYSTEM_VERSION_PLIST="$MNT_BASESYSTEM/System/Library/CoreServices/SystemVersion.plist"
else
msg_error "Could not find $MNT_BASESYSTEM/System/Library/CoreServices/SystemVersion.plist in BaseSystem.dmg"
exit 1
fi
else
msg_error "Could not find $ESD on $MNT_ESD"
exit 1
fi
DMG_OS_VERS=$(/usr/libexec/PlistBuddy -c 'Print :ProductVersion' "$SYSTEM_VERSION_PLIST")
DMG_OS_VERS_MAJOR=$(echo $DMG_OS_VERS | awk -F "." '{print $2}')
DMG_OS_BUILD=$(/usr/libexec/PlistBuddy -c 'Print :ProductBuildVersion' "$MNT_ESD/System/Library/CoreServices/SystemVersion.plist")
DMG_OS_BUILD=$(/usr/libexec/PlistBuddy -c 'Print :ProductBuildVersion' "$SYSTEM_VERSION_PLIST")
OUTPUT_DMG="$OUT_DIR/OSX_InstallESD_${DMG_OS_VERS}_${DMG_OS_BUILD}.dmg"
if [ -e "$OUTPUT_DMG" ]; then
msg_error "Output file $OUTPUT_DMG already exists! We're not going to overwrite it, exiting.."
hdiutil detach "$MNT_ESD"
exit 1
fi
[ -e "$MNT_BASESYSTEM" ] && hdiutil detach "$MNT_BASESYSTEM"

SUPPORT_DIR="$SCRIPT_DIR/support"

Expand All @@ -142,7 +160,7 @@ SUPPORT_DIR="$SCRIPT_DIR/support"
# direct link: http://support.apple.com/downloads/DL1596/en_US/ServerAdminTools.dmg
AUTOPART_APP_IN_SIU="System Image Utility.app/Contents/Library/Automator/Create Image.action/Contents/Resources/AutoPartition.app"
OSX_VERS=$(sw_vers -productVersion | awk -F "." '{print $2}')
if [ $DMG_OS_VERS_MAJOR -eq 8 ]; then
if [ $DMG_OS_VERS_MAJOR -eq 8 -o $DMG_OS_VERS_MAJOR -eq 9 ]; then
if [ $OSX_VERS -eq 7 ]; then
msg_status "To build Mountain Lion on Lion, we need to extract AutoPartition.app from within the 10.8 installer ESD."
SIU_TMPDIR=$(/usr/bin/mktemp -d /tmp/siu-108.XXXX)
Expand Down Expand Up @@ -173,6 +191,15 @@ if [ $DMG_OS_VERS_MAJOR -eq 8 ]; then
exit 1
fi
cp -R "$AUTOPART_TOOL" "$SUPPORT_DIR/AutoPartition-10.${DMG_OS_VERS_MAJOR}/"
elif [ $OSX_VERS -eq 9 ]; then
# Location of AutoPartition.app changed in OSX Mavericks!
AUTOPART_APP_IN_SIU="System Image Utility.app/Contents/Frameworks/SIUFoundation.framework/Versions/A/XPCServices/com.apple.SIUAgent.xpc/Contents/Resources/AutoPartition.app"
AUTOPART_TOOL="/System/Library/CoreServices/$AUTOPART_APP_IN_SIU"
if [ ! -e "$AUTOPART_TOOL" ]; then
msg_error "We're on Mavericks, and should have System Image Utility available at $AUTOPART_TOOL, but it's not available for some reason."
exit 1
fi
cp -R "$AUTOPART_TOOL" "$SUPPORT_DIR/AutoPartition-10.${DMG_OS_VERS_MAJOR}/"
fi
# on Lion, we first check if Server Admin Tools are already installed..
elif [ $DMG_OS_VERS_MAJOR -eq 7 ]; then
Expand Down Expand Up @@ -275,7 +302,7 @@ if [ -n "$DEFAULT_ISO_DIR" ]; then
msg_status "Setting ISO file in definition "$DEFINITION_FILE".."
ISO_FILE=$(basename "$OUTPUT_DMG")
# Explicitly use -e in order to use double quotes around sed command
sed -i -e "s/%OSX_ISO%/${ISO_FILE}/" "$DEFINITION_FILE"
sed -i '' -e "s/%OSX_ISO%/${ISO_FILE}/" "$DEFINITION_FILE"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change it to sed -i'' -e ... - it is more portable

fi

msg_status "Done."