This repository has been archived by the owner on Aug 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Vagrantfile
167 lines (142 loc) · 6.05 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#========================================================================
# Author: Edoardo Pasca, Ben Thomas
# Copyright 2018 University College London
# Copyright 2018 Science Technology Facilities Council
#
# This file is part of the CCP PETMR Synergistic Image Reconstruction Framework (SIRF) virtual machine.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#=========================================================================
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.synced_folder '.', '/vagrant', disabled: true
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:
vb.cpus = "2"
vb.memory = "4096"
vb.customize "pre-boot", [
"storageattach", :id,
"--storagectl", "IDE",
"--port", "1",
"--device", "0",
"--type", "dvddrive",
"--medium", "emptydrive",
]
vb.name = "SIRF_1.1.1"
vb.customize ["modifyvm", :id,
"--clipboard", "bidirectional"]
#vb.customize [ "modifyvm", :id,
# "--uartmode1", "disconnected" ]
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
SIRFUSERNAME=sirfuser
SIRFPASS=virtual
adduser $SIRFUSERNAME
adduser $SIRFUSERNAME sudo
{ echo $SIRFPASS; echo $SIRFPASS; } | passwd $SIRFUSERNAME
# remove serial port from grub configuration
sed -i 's/ console=ttyS0//' /etc/default/grub.d/50-cloudimg-settings.cfg
update-grub
# update the apt-get database
apt-get update
# mark grup as hold as it requires user intervention on upgrade!
apt-mark hold grub-pc
# upgrade the list of packages
apt-get upgrade -y
#install upgrades
apt-get install -y wget git xorg xterm gdm menu gksu synaptic gnome-session gnome-panel metacity --no-install-recommends
apt-get install -y at-spi2-core gnome-terminal gnome-control-center nautilus dmz-cursor-theme network-manager network-manager-gnome
# start gnome display manager
service gdm start
# set the current locale, otherwise the gnome-terminal doesn't start
sudo locale-gen en_GB.UTF-8
sudo locale-gen en_US.UTF-8
sudo locale-gen de_DE.UTF-8
sudo locale-gen fr_FR.UTF-8
sudo locale-gen es_ES.UTF-8
sudo locale-gen it_IT.UTF-8
sudo locale-gen pt_PT.UTF-8
sudo locale-gen pt_BR.UTF-8
sudo locale-gen ja_JP.UTF-8
sudo locale-gen zh_CN.UTF-8
sudo update-locale LANG=en_GB.UTF-8
sudo localectl set-x11-keymap uk
sudo localectl status
# To hide vagrant from login screen:
# 1. Log-in as vagrant
# 2. In /var/lib/AccountsService/users/vagrant change 'SystemAccount=true'
sudo echo '[User]' > vagrant
sudo echo 'SystemAccount=true' >> vagrant
sudo cp -v vagrant /var/lib/AccountsService/users/vagrant
# To remove the Ubuntu user from VM:
sudo deluser --remove-home ubuntu
# Could add custom logos here: /etc/gdm3/greeter.dconf-defaults
# download/install cmake
cd /opt
wget -c https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz
cd /usr/local
tar xzf /opt/cmake-3.7.2-Linux-x86_64.tar.gz --strip 1
HOME=/home/sirfuser
mkdir $HOME/devel
cd $HOME/devel
git clone https://github.com/CCPPETMR/CCPPETMR_VM.git
cd CCPPETMR_VM
bash $HOME/devel/CCPPETMR_VM/scripts/INSTALL_prerequisites_with_apt-get.sh
# install jupyter and firefox
apt-get install -y firefox
python -m pip install --upgrade pip
python -m pip install jupyter
python -m pip install spyder
bash $HOME/devel/CCPPETMR_VM/scripts/UPDATE.sh
chown -R sirfuser:users /home/sirfuser/
SHELL
end