forked from unxmaal/compilertron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
76 lines (66 loc) · 2.18 KB
/
Vagrantfile
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
#####
# Change these settings to match your environment
#####
gcc_zip = "https://github.com/onre/gcc/archive/gcc-4_7-irix.zip"
irix_root = "http://mirror.larbob.org/compilertron/irix-root.6.5.30.tar.bz2"
binutils = "https://mirrors.tripadvisor.com/gnu/binutils/binutils-2.17a.tar.bz2"
Target_Base_Box = "debian/contrib-stretch64"
Target_Version = "9.6.0"
RAM_for_VM = "2048"
NUM_of_CPUs = "2"
#####
# end of settings
#####
current_dir = File.dirname(File.expand_path(__FILE__))
disk_prefix = 'compiledisk'
disk_ext ='.vdi'
compiledisk = "%s/%s%s" % [current_dir,disk_prefix,disk_ext]
#
# Main configure block
Vagrant.configure("2") do |config|
config.vm.box = Target_Base_Box
config.vm.box_version = Target_Version
config.vm.post_up_message = [ "compilertron configuration stage" ]
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
# setup VirtualBox Settings
config.vm.provider "virtualbox" do |v|
v.linked_clone = true
v.memory = RAM_for_VM
v.cpus = NUM_of_CPUs
end
# Create disk for compiled objects
config.vm.provider "virtualbox" do |v|
unless File.exist?(compiledisk)
v.customize ['createhd', '--filename', compiledisk, '--size', 50 * 1024]
end
v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', compiledisk]
end
end
#
# Provision the new box with Ansible plays
Vagrant.configure("2") do |config|
if Vagrant::Util::Platform.windows?
config.vm.provision :shell do |shell|
shell.inline = "sudo apt-get -y install wget curl"
end
config.vm.provision :guest_ansible do |ansible|
ansible.verbose = "v"
ansible.playbook = "ansible/compilertron_setup.yml"
ansible.extra_vars = {
gcc_zip: gcc_zip,
irix_root: irix_root,
binutils: binutils
}
end
else
config.vm.provision "ansible" do |ansible|
ansible.verbose = "v"
ansible.playbook = "ansible/compilertron_setup.yml"
ansible.extra_vars = {
gcc_zip: gcc_zip,
irix_root: irix_root,
binutils: binutils
}
end
end
end