-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunvm
executable file
·71 lines (63 loc) · 1.37 KB
/
runvm
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
#! /usr/bin/env bash
set -e
set -x
port=${1:-2222}
# Clean:
VBoxManage controlvm "semantique" \
poweroff \
|| true
VBoxManage unregistervm "semantique" \
--delete \
|| true
cp "semantique.vmdk" \
"semantique-2018.vmdk"
# Launch the virtual machine:
VBoxManage createvm \
--name "semantique" \
--ostype "Ubuntu_64" \
--register
VBoxManage storagectl "semantique" \
--name "IDE Controller" \
--add "ide" \
--bootable "on"
VBoxManage modifyvm "semantique" \
--description "Sémantique @ UniGe" \
--memory 1024 \
--cpus 1 \
--hda "semantique-2018.vmdk" \
--natpf1 ssh,tcp,,${port},,22
VBoxManage startvm "semantique" \
--type "headless"
# Remove everything:
ssh \
-o "UserKnownHostsFile=/dev/null" \
-o "StrictHostKeyChecking=no" \
-i "vm-key" \
-p "${port}" \
semantique@localhost \
'bash -s' <<'EOS'
rm -rf *
EOS
# Copy files:
scp -r \
-o "UserKnownHostsFile=/dev/null" \
-o "StrictHostKeyChecking=no" \
-i "vm-key" \
-P "${port}" \
install Package.swift Sources Tests \
semantique@localhost:
# Install dependencies:
ssh \
-o "UserKnownHostsFile=/dev/null" \
-o "StrictHostKeyChecking=no" \
-i "vm-key" \
-p "${port}" \
semantique@localhost \
'bash -s' <<'EOS'
swift --version || ./install
swift test
EOS
VBoxManage controlvm "semantique" \
poweroff
VBoxManage unregistervm "semantique" \
--delete