@@ -68,4 +68,130 @@ Vagrant.configure("2") do |config|
68
68
# create: true
69
69
#)
70
70
end
71
+
72
+ # Extra APT boxes
73
+ #---
74
+ ( {
75
+ 'debian9' => {
76
+ 'box' => 'debian/stretch64' ,
77
+ 'aptscript' => \
78
+ "sed -i -e 's,main$,main non-free contrib,g' /etc/apt/sources.list; " \
79
+ "echo 'deb http://deb.debian.org/debian stretch-backports main contrib non-free' > /etc/apt/sources.list.d/backports.list;" \
80
+ "apt-get update;" \
81
+ "apt-get install -y virtualbox-guest-x11;" ,
82
+ 'db4script' => \
83
+ "cd /tmp;" \
84
+ "wget -q https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin/+build/12096244/+files/libdb4.8_4.8.30-xenial4_amd64.deb;" \
85
+ "wget -q https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin/+build/12096244/+files/libdb4.8++_4.8.30-xenial4_amd64.deb;" \
86
+ "wget -q https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin/+build/12096244/+files/libdb4.8-dev_4.8.30-xenial4_amd64.deb;" \
87
+ "wget -q https://launchpad.net/~bitcoin/+archive/ubuntu/bitcoin/+build/12096244/+files/libdb4.8++-dev_4.8.30-xenial4_amd64.deb;" \
88
+ "dpkg -i libdb4.8_4.8.30-xenial4_amd64.deb libdb4.8++_4.8.30-xenial4_amd64.deb;" \
89
+ "dpkg -i libdb4.8-dev_4.8.30-xenial4_amd64.deb libdb4.8++-dev_4.8.30-xenial4_amd64.deb" ,
90
+ } ,
91
+ } ) . each { |name , info |
92
+ config . vm . define "builder_#{ name } " do |node |
93
+ node . vm . provider "virtualbox" do |v |
94
+ # TODO: better detect from host system
95
+ # - half RAM
96
+ # - all CPUs
97
+ # "safe" defaults for any modern developer's system
98
+ v . memory = ENV . fetch ( 'VM_MEMORY' , 4096 )
99
+ v . cpus = ENV . fetch ( 'VM_CPUS' , 4 )
100
+ v . gui = true
101
+ end
102
+ node . vm . box = info [ 'box' ]
103
+
104
+ node . vm . provision 'libdb4' , type : "shell" , inline : info [ 'db4script' ]
105
+
106
+ node . vm . provision 'apt' , type : "shell" , inline : info [ 'aptscript' ]
107
+ node . vm . provision 'cid' , type : "shell" , inline :\
108
+ "apt-get install -y python3-pip;" \
109
+ "/usr/bin/pip3 install -U futoin-cid"
110
+
111
+ node . vm . provision 'git' , type : "shell" , inline :\
112
+ "apt-get install -y --no-install-recommends git;" \
113
+ "sudo -H -u vagrant git config --global user.name '#{ `git config --global user.name` } ';" \
114
+ "sudo -H -u vagrant git config --global user.email '#{ `git config --global user.email` } '"
115
+
116
+ node . vm . provision 'xorg' , type : "shell" , inline :\
117
+ "echo 'nodm nodm/enabled boolean true' | debconf-set-selections;" \
118
+ "apt-get install -y --no-install-recommends xorg fluxbox nodm;"
119
+
120
+ node . vm . provision 'debugger' , type : "shell" , inline :\
121
+ "apt-get install -y gdb gdbserver valgrind;" \
122
+ "/usr/bin/pip3 install gdbgui"
123
+
124
+ node . vm . provision 'bashrc' , type : "shell" , inline :\
125
+ "ensure_bashrc() { grep -q \" $@\" /home/vagrant/.bashrc || (echo \" $@\" >> /home/vagrant/.bashrc )};" \
126
+ "ensure_bashrc 'cd /vagrant';" \
127
+ "ensure_bashrc 'export DISPLAY=\" :0\" ';" \
128
+ "ensure_bashrc 'export GDBSERVER_COMM=0.0.0.0:2000';" \
129
+ "ensure_bashrc 'export GDBGUI_HOST=0.0.0.0';" \
130
+ "ensure_bashrc 'export GDBGUI_PORT=2000';"
131
+
132
+ node . vm . synced_folder ( "." , "/vagrant" ,
133
+ type : 'virtualbox' ,
134
+ owner : 'vagrant' , group : 'vagrant' ,
135
+ create : true
136
+ )
137
+ end
138
+ }
139
+
140
+ # Extra RPM boxes
141
+ #---
142
+ ( {
143
+ 'centos7' => {
144
+ 'box' => 'bento/centos-7' ,
145
+ 'yumscript' => \
146
+ "yum -y install epel-release;" ,
147
+ 'db4script' => "" ,
148
+ } ,
149
+ } ) . each { |name , info |
150
+ config . vm . define "builder_#{ name } " do |node |
151
+ node . vm . provider "virtualbox" do |v |
152
+ # TODO: better detect from host system
153
+ # - half RAM
154
+ # - all CPUs
155
+ # "safe" defaults for any modern developer's system
156
+ v . memory = ENV . fetch ( 'VM_MEMORY' , 4096 )
157
+ v . cpus = ENV . fetch ( 'VM_CPUS' , 4 )
158
+ v . gui = true
159
+ end
160
+ node . vm . box = info [ 'box' ]
161
+
162
+ node . vm . provision 'libdb4' , type : "shell" , inline : info [ 'db4script' ]
163
+
164
+ node . vm . provision 'yum' , type : "shell" , inline : info [ 'yumscript' ]
165
+ node . vm . provision 'cid' , type : "shell" , inline :\
166
+ "yum -y install python-pip;" \
167
+ "pip install -U futoin-cid"
168
+
169
+ node . vm . provision 'git' , type : "shell" , inline :\
170
+ "cid tool install git;" \
171
+ "sudo -H -u vagrant git config --global user.name '#{ `git config --global user.name` } ';" \
172
+ "sudo -H -u vagrant git config --global user.email '#{ `git config --global user.email` } '"
173
+
174
+ #node.vm.provision 'xorg', type: "shell", inline:\
175
+ # "echo 'nodm nodm/enabled boolean true' | debconf-set-selections;"\
176
+ # "apt-get install -y --no-install-recommends xorg fluxbox nodm;"
177
+
178
+ #node.vm.provision 'debugger', type: "shell", inline:\
179
+ # "apt-get install -y gdb gdbserver valgrind;"\
180
+ # "/usr/bin/pip3 install gdbgui"
181
+
182
+ node . vm . provision 'bashrc' , type : "shell" , inline :\
183
+ "ensure_bashrc() { grep -q \" $@\" /home/vagrant/.bashrc || (echo \" $@\" >> /home/vagrant/.bashrc )};" \
184
+ "ensure_bashrc 'cd /vagrant';" \
185
+ "ensure_bashrc 'export DISPLAY=\" :0\" ';" \
186
+ "ensure_bashrc 'export GDBSERVER_COMM=0.0.0.0:2000';" \
187
+ "ensure_bashrc 'export GDBGUI_HOST=0.0.0.0';" \
188
+ "ensure_bashrc 'export GDBGUI_PORT=2000';"
189
+
190
+ node . vm . synced_folder ( "." , "/vagrant" ,
191
+ type : 'virtualbox' ,
192
+ owner : 'vagrant' , group : 'vagrant' ,
193
+ create : true
194
+ )
195
+ end
196
+ }
71
197
end
0 commit comments