This repository has been archived by the owner on Jul 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
2_run_soloist.sh
executable file
·81 lines (69 loc) · 3.2 KB
/
2_run_soloist.sh
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
set -e
# Start the ssh-agent and save the information; we'll need it later
SSH_AGENT=$(ssh $IMAGE_USER@$IMAGE_HOST ssh-agent)
function run_via_ssh() {
cmd=$1
echo "Running: '$cmd'"
ssh $IMAGE_USER@$IMAGE_HOST "$cmd"
}
ssh $IMAGE_USER@$IMAGE_HOST "
eval $SSH_AGENT
ssh-add ~/.ssh/id_github_private ;
( ssh -o StrictHostKeyChecking=no [email protected] exit; : ) &&
cd /tmp &&
git clone https://github.com/pivotal-sprout/sprout-orchard.git &&
git clone $SPROUT_WRAP_GIT_URL sprout-wrap"
if [[ $PIVOTAL_LABS != "0" ]]; then
ssh $IMAGE_USER@$IMAGE_HOST "
eval $SSH_AGENT
cd /tmp &&
git clone [email protected]:pivotal/pivotal_workstation_private.git &&
echo 'cookbook '\''pivotal_workstation_private'\'', :path => '\''/tmp/pivotal_workstation_private'\''' >> /tmp/sprout-wrap/Cheffile"
fi
NOKOGIRI_INSTALL='mkdir /tmp/libiconv
cd /tmp/libiconv
curl -OL http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvfz libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/Cellar/libiconv/1.13.1
make
sudo make install
sudo gem install nokogiri -- --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib'
run_via_ssh 'sudo pmset sleep 0' # prevent machine from sleeping (otherwise will lose build)
run_via_ssh 'sudo gem update --system'
run_via_ssh 'sudo gem install bundler --no-rdoc --no-ri'
run_via_ssh "$NOKOGIRI_INSTALL"
run_via_ssh 'cd /tmp/sprout-wrap && sudo bundle install && bundle && bundle exec soloist'
# curl -LO https://github.com/pivotal-sprout/omnibus-soloist/releases/download/1.0.1/install.sh &&
# sudo bash install.sh &&
# PATH+=:/opt/soloist/bin/ &&
# cd /tmp/sprout-wrap &&
# soloist"
if [[ $PIVOTAL_LABS != "0" ]]; then
ssh $IMAGE_USER@$IMAGE_HOST "
eval $SSH_AGENT
PATH+=:/opt/soloist/bin/
cd /tmp/sprout-wrap &&
bundle exec soloist run_recipe meta::pivotal_specifics &&
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'
run_via_ssh 'sudo cp /tmp/sprout-orchard/assets/com.pivotallabs.first_run.plist /Library/LaunchAgents/'
run_via_ssh 'mkdir ~/bin; sudo cp /tmp/sprout-orchard/assets/first_run.rb /usr/sbin/'
run_via_ssh 'mkdir ~/bin; sudo cp /tmp/sprout-orchard/assets/auto_set_hostname.rb /usr/sbin/'
# turn off vmware tools (VMware Shared Folders) if installed
run_via_ssh 'sudo rm /Library/LaunchAgents/com.vmware.launchd.vmware-tools-userd.plist'
run_via_ssh 'sudo rm /Library/LaunchDaemons/com.vmware.launchd.tools.plist'
run_via_ssh 'rm -rf "~/Desktop/VMWare\ Shared\ Folders"'
# FIXME: this shouldn't be necessary
run_via_ssh 'sudo diskutil mount $(diskutil list | grep Persistent | awk "{print \$6}")'
# reboot to Persistent
run_via_ssh 'sudo bless --mount /Volumes/Persistent --setboot'
run_via_ssh 'rm -fr ~/.ssh/id_github_private ~/.ssh/authorized_keys && sudo shutdown -r now'