-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
143 lines (132 loc) · 4.62 KB
/
Makefile
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
VM_NAME := Fedora Atomic Packer
BOX_NAME := Fedora Atomic Box
PWD := `pwd`
virtualbox: fedora-atomic-virtualbox.box
parallels: fedora-atomic-parallels.box
fedora-atomic-virtualbox.box: installer.iso box/template.json box/vagrantfile.tpl \
box/docker_start_service.rb box/change_host_name.rb box/configure_networks.rb \
box/network_static.erb http/atomic-ks.cfg oem/docker.socket oem/docker-tcp.socket \
oem/oem-release oem/opt_bin.sh
rm -f fedora-atomic-virtualbox.box
rm -rf box/output-virtualbox/
@cd box; \
packer build -only virtualbox template.json
fedora-atomic-parallels.box: fedora-atomic-virtualbox.box Vagrantfile
rm -f fedora-atomic-parallels.box
mkdir -p parallels
@cd parallels; \
rm -rf *; \
tar zxvf ../fedora-atomic-virtualbox.box; \
rm -f box.ovf fedora-atomic-disk1.vmdk; \
echo '{"provider": "parallels"}' > metadata.json
#
# Convert VMDK to HDD
#
@vagrant box add -f fedora-atomic fedora-atomic-virtualbox.box
vagrant destroy -f
VM_NAME="${VM_NAME}" vagrant up
vagrant halt -f
rm -rf "${HOME}/Documents/Parallels/fedora-atomic-disk1.hdd"
-prl_convert "${HOME}/VirtualBox VMs/${VM_NAME}/fedora-atomic-disk1.vmdk" --allow-no-os
vagrant destroy -f
#
# Create Parallels VM
#
prlctl create "${VM_NAME}" --ostype linux --distribution fedora-core --no-hdd
mv "${HOME}/Documents/Parallels/fedora-atomic-disk1.hdd" "${HOME}/Documents/Parallels/${VM_NAME}.pvm/"
prlctl set "${VM_NAME}" --device-add hdd --image "${HOME}/Documents/Parallels/${VM_NAME}.pvm/fedora-atomic-disk1.hdd"
prlctl set "${VM_NAME}" --device-bootorder "hdd0 cdrom0"
#
# Clone
#
-prlctl unregister "${BOX_NAME}"
rm -rf "Parallels/${BOX_NAME}.pvm"
prlctl clone "${VM_NAME}" --name "${BOX_NAME}" --template --dst "${PWD}/parallels"
prlctl unregister "${VM_NAME}"
rm -rf "${HOME}/Documents/Parallels/${VM_NAME}.pvm"
#
# Clean up
#
rm -f "parallels/${BOX_NAME}.pvm/config.pvs.backup"
rm -f "parallels/${BOX_NAME}.pvm/fedora-atomic-disk1.hdd/DiskDescriptor.xml.Backup"
#
# Package
#
rm -f fedora-atomic-parallels.box
cd parallels; tar zcvf ../fedora-atomic-parallels.box *
prlctl unregister "${BOX_NAME}"
installer.iso:
curl -LO http://dl.fedoraproject.org/pub/alt/fedora-atomic/testing/rawhide/20141104.0/installer/images/installer.iso
test: test/Vagrantfile fedora-atomic-virtualbox.box
@vagrant box add -f fedora-atomic fedora-atomic-virtualbox.box
@cd test; \
vagrant destroy -f; \
vagrant up; \
echo "-----> /etc/os-release"; \
vagrant ssh -c "cat /etc/os-release"; \
echo "-----> /etc/redhat-release"; \
vagrant ssh -c "cat /etc/redhat-release"; \
echo "-----> /etc/oem-release"; \
vagrant ssh -c "cat /etc/oem-release"; \
echo "-----> /etc/machine-id"; \
vagrant ssh -c "cat /etc/machine-id"; \
echo "-----> /etc/hostname"; \
vagrant ssh -c "cat /etc/hostname"; \
echo "-----> docker version"; \
DOCKER_HOST="tcp://localhost:2375"; \
docker version; \
echo "-----> docker images -t"; \
docker images -t; \
echo "-----> docker ps -a"; \
docker ps -a; \
echo "-----> nc localhost 8080"; \
nc localhost 8080; \
echo "-----> atomic status"; \
vagrant ssh -c "atomic status"; \
echo "-----> atomic upgrade"; \
vagrant ssh -c "sudo atomic upgrade"; \
echo '-----> docker exec `docker ps -l -q` ls -l'; \
docker exec `docker ps -l -q` ls -l; \
vagrant suspend
ptest: DOCKER_HOST_IP=$(shell cd test; vagrant ssh-config | sed -n "s/[ ]*HostName[ ]*//gp")
ptest: ptestup
@cd test; \
echo "-----> /etc/os-release"; \
vagrant ssh -c "cat /etc/os-release"; \
echo "-----> /etc/redhat-release"; \
vagrant ssh -c "cat /etc/redhat-release"; \
echo "-----> /etc/oem-release"; \
vagrant ssh -c "cat /etc/oem-release"; \
echo "-----> /etc/machine-id"; \
vagrant ssh -c "cat /etc/machine-id"; \
echo "-----> /etc/hostname"; \
vagrant ssh -c "cat /etc/hostname"; \
echo "-----> docker version"; \
DOCKER_HOST="tcp://${DOCKER_HOST_IP}:2375"; \
docker version; \
echo "-----> docker images -t"; \
docker images -t; \
echo "-----> docker ps -a"; \
docker ps -a; \
echo "-----> nc ${DOCKER_HOST_IP} 8080"; \
nc ${DOCKER_HOST_IP} 8080; \
echo "-----> atomic status"; \
vagrant ssh -c "atomic status"; \
echo "-----> atomic upgrade"; \
vagrant ssh -c "sudo atomic upgrade"; \
echo '-----> docker exec `docker ps -l -q` ls -l'; \
docker exec `docker ps -l -q` ls -l; \
vagrant suspend
ptestup: test/Vagrantfile fedora-atomic-parallels.box
@vagrant box add -f fedora-atomic fedora-atomic-parallels.box
@cd test; \
vagrant destroy -f; \
vagrant up --provider parallels
clean:
vagrant destroy -f
cd test; vagrant destroy -f
rm -f fedora-atomic-virtualbox.box
rm -rf box/output-*/
rm -f fedora-atomic-parallels.box
rm -rf parallels/
.PHONY: test clean