Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 55 lines (45 sloc) 2.404 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#!/bin/bash
set -e

ssh $IMAGE_USER@$IMAGE_HOST "
cd /tmp &&
git clone https://github.com/pivotalexperimental/apple_orchard.git &&
git clone $SPROUT_WRAP_GIT_URL sprout-wrap"

if [[ $PIVOTAL_LABS ]]; then
ssh $IMAGE_USER@$IMAGE_HOST 'eval `ssh-agent` &&
ssh-add ~/.ssh/id_github_private &&
( ssh -o StrictHostKeyChecking=no git@github.com exit; : ) &&
cd /tmp &&
git clone git@github.com:pivotal/pivotal_workstation_private.git &&
echo "cookbook \"pivotal_workstation_private\", :path => \"/tmp/pivotal_workstation_private\"" >> /tmp/sprout-wrap/Cheffile'
fi

ssh $IMAGE_USER@$IMAGE_HOST 'sudo pmset sleep 0' # prevent machine from sleeping (otherwise will lose build)
ssh $IMAGE_USER@$IMAGE_HOST 'cd /tmp/sprout-wrap && sudo gem install bundler && bundle install && bundle exec soloist'

if [[ $PIVOTAL_LABS ]]; then
ssh $IMAGE_USER@$IMAGE_HOST 'cd /tmp/sprout-wrap && bundle exec soloist run_recipe meta::pivotal_specifics'
  ssh $IMAGE_USER@$IMAGE_HOST 'cd /tmp/sprout-wrap && bundle exec soloist run_recipe pivotal_workstation_private::meta_lion_image'

  # Successful run, in the future we should tag
fi

# post-install, set the machine name to NEWLY_IMAGED
ssh $IMAGE_USER@$IMAGE_HOST 'sudo hostname NEWLY_IMAGED
sudo scutil --set ComputerName NEWLY_IMAGED
sudo scutil --set LocalHostName NEWLY_IMAGED
sudo scutil --set HostName NEWLY_IMAGED
sudo diskutil rename / NEWLY_IMAGED'

ssh $IMAGE_USER@$IMAGE_HOST 'sudo cp /tmp/apple_orchard/assets/com.pivotallabs.first_run.plist /Library/LaunchAgents/'
ssh $IMAGE_USER@$IMAGE_HOST 'mkdir ~/bin; sudo cp /tmp/apple_orchard/assets/first_run.rb /usr/sbin/'
ssh $IMAGE_USER@$IMAGE_HOST 'mkdir ~/bin; sudo cp /tmp/apple_orchard/assets/auto_set_hostname.rb /usr/sbin/'

# turn off vmware tools (VMware Shared Folders) if installed
ssh $IMAGE_USER@$IMAGE_HOST 'for PLIST in \
/Library/LaunchAgents/com.vmware.launchd.vmware-tools-userd.plist \
/Library/LaunchDaemons/com.vmware.launchd.tools.plist
do
[ -f $PLIST ] &&
sudo defaults write $PLIST RunAtLoad -bool false &&
sudo plutil -convert xml1 $PLIST &&
sudo chmod 444 $PLIST
done
rm ~/Desktop/VMWare\ Shared\ Folders
true'

# reboot to Persistent
ssh $IMAGE_USER@$IMAGE_HOST 'sudo bless --mount /Volumes/Persistent --setboot'
ssh $IMAGE_USER@$IMAGE_HOST 'rm -fr ~/.ssh/id_github_private ~/.ssh/authorized_keys && sudo shutdown -r now'
Something went wrong with that request. Please try again.