-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprovision.mk
98 lines (83 loc) · 2.41 KB
/
provision.mk
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
PROVISION_DIR=/vagrant
HOME_DIR=/home/vagrant
define UBUNTU_MIRRORS
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted universe multiverse
endef
define BASHRC
# Added by provision
export PS1='\[\e]0;\u@\h:\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$$ '
pushd_v () {
"pushd" "$$@" > /dev/null && "dirs" -v
}
popd_v () {
"popd" "$$@" > /dev/null && "dirs" -v
}
alias dirs='dirs -v'
alias popd='popd_v'
alias pushd='pushd_v'
alias la='ls -a'
alias ll='ls -l'
alias lla='ls -la'
alias ls='ls -CF --color=auto --show-control-chars'
endef
define SCREENRC
startup_message off
defencoding UTF-8
#defutf8 on
escape ^Tt
vbell off
defscrollback 1000
termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
hardstatus string "%?%H %?[screen %n%?: %t%?] %h"
endef
export UBUNTU_MIRRORS
export BASHRC
export SCREENRC
export MYCNF_SYS
export MYCNF_USER
export CONFIG_JSON
default:
ubuntu-all:
sudo make -f /vagrant/provision.mk ubuntu-root
sudo -u vagrant -i make -f /vagrant/provision.mk ubuntu-user
ubuntu-root: \
ubuntu-apt \
ubuntu-redis \
ubuntu-memcached \
ubuntu-pip
ubuntu-user: \
ubuntu-home
ubuntu-apt:
# Uninstall puppet and chef.
apt-get remove -y puppet chef
apt-get autoremove -y
# Use apt mirrors.
echo "$$UBUNTU_MIRRORS" | cat - /etc/apt/sources.list > \
/etc/apt/sources.list.new
mv /etc/apt/sources.list /etc/apt/sources.list.orig
mv /etc/apt/sources.list.new /etc/apt/sources.list
# Update catalog and pre-installed packages.
apt-get update
apt-get upgrade -y
ubuntu-redis:
apt-get install -y redis-server
ubuntu-memcached:
apt-get install -y memcached
ubuntu-pip:
apt-get install -y python-pip
pip install -r /vagrant/requirements.txt
ubuntu-home:
# Build home directory and configs.
touch .hushlogin
ln -s /vagrant vagrant
echo "$$BASHRC" >> "${HOME_DIR}/.bashrc"
echo "$$SCREENRC" >> "${HOME_DIR}/.screenrc"
echo "$$MYCNF_USER" >> "${HOME_DIR}/.my.cnf"
@if [ ! -f "${HOME_DIR}/vagrant/config.json" ]; \
then \
echo "copying ${HOME_DIR}/vagrant/config.json.default to ${HOME_DIR}/vagrant/config.json"; \
cp "${HOME_DIR}/vagrant/config.json.default" "${HOME_DIR}/vagrant/config.json"; \
fi