This repository has been archived by the owner on Aug 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
macbuild.sh
executable file
·71 lines (58 loc) · 1.97 KB
/
macbuild.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
#!/bin/bash
# Colours
BOLD='\033[1m'
RED='\033[91m'
GREEN='\033[92m'
YELLOW='\033[93m'
BLUE='\033[94m'
ENDC='\033[0m'
# Display a pretty header
echo
echo -e "${BOLD}Mac Build (using Ansible)${ENDC}"
echo
# Prompt the user for their sudo password
sudo -v
# Enable passwordless sudo for the macbuild run
sudo sed -i -e "s/^%admin.*/%admin ALL=(ALL) NOPASSWD: ALL/" /etc/sudoers
# Install Homebrew
if ! which brew > /dev/null 2>&1
then
echo -e "${BLUE}Installing Homebrew${ENDC}"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null
fi
# Install Python
if ! brew list python3 > /dev/null 2>&1
then
echo -e "${BLUE}Installing Python 3.x${ENDC}"
brew install python3
fi
# Install Ansible (using pip is the officially supported way)
if ! pip3 show ansible > /dev/null 2>&1
then
echo -e "${BLUE}Installing Ansible${ENDC}"
# TODO: switch back to pip when Ansible 2.2.1.0 is released
# pip3 install ansible
pip3 install git+git://github.com/ansible/ansible.git@stable-2.2
fi
# Setup the source of music production software from the backup drive attached
if [ -d "/Volumes/Backup Mac 1" ]
then
export HOMEBREW_CASK_MUSIC_SOFTWARE_BASEDIR='/Volumes/Backup Mac 1/Software/Music Production'
elif [ -d "/Volumes/Backup Mac 2" ]
then
export HOMEBREW_CASK_MUSIC_SOFTWARE_BASEDIR='/Volumes/Backup Mac 2/Software/Music Production'
fi
if [ ! -z "$HOMEBREW_CASK_MUSIC_SOFTWARE_BASEDIR" ]
then
echo -e "${GREEN}Using cask music software basedir of ${HOMEBREW_CASK_MUSIC_SOFTWARE_BASEDIR}${ENDC}"
else
echo -e "${RED}Unable to find the music software basedir${ENDC}"
fi
# Set Terminal settings
./extras/terminal.js && \
# Perform the build
ansible-playbook -i localhost, -e ansible_python_interpreter=/usr/local/bin/python3 local.yaml && \
# Launchpad
./extras/launchpad.py build host_vars/localhost/launchpad.yaml
# Disable passwordless sudo after the macbuild is complete
sudo sed -i -e "s/^%admin.*/%admin ALL=(ALL) ALL/" /etc/sudoers