-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
60 lines (48 loc) · 1.83 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
.PHONY: default clean dist-clean add-box del-box
VERSION=0.2.0
default: stripped.box
add-box: stripped.box
vagrant box add vagrant-kubernetes stripped.box -f
del-box: stripped.box
vagrant box remove kubernetes
.vagrant/machines/default/virtualbox/id: vg-00-kubernetes.sh conf/*
vagrant destroy -f
SCRIPT=vg-00-kubernetes.sh vagrant up --provision
vagrant halt
.vagrant/repartinioned: .vagrant/machines/default/virtualbox/id vg-*.sh
$(eval MACHINEID:=$(shell cat .vagrant/machines/default/virtualbox/id))
$(eval HDDFILE:=$(shell VBoxManage showvminfo --machinereadable $(MACHINEID) | grep "IDE Controller-0-0" | cut -d '=' -f 2))
test -f cloned.vdi && vboxmanage closemedium disk cloned.vdi --delete || true
VBoxManage clonehd $(HDDFILE) cloned.vdi --format vdi
VBoxManage modifyvm $(MACHINEID) --hda none
vboxmanage closemedium disk $(HDDFILE) --delete
VBoxManage modifyhd cloned.vdi --resize 122880 # 120 GB
VBoxManage clonehd cloned.vdi $(HDDFILE) --format vmdk
VBoxManage modifyvm $(MACHINEID) --hda $(HDDFILE)
vboxmanage closemedium disk cloned.vdi --delete
SCRIPT=vg-01-repartition.sh vagrant reload --provision
SCRIPT=vg-02-reformat.sh vagrant reload --provision
touch .vagrant/repartinioned
package.box: .vagrant/repartinioned Vagrantfile.dist
rm -f package.box
vagrant package --vagrantfile Vagrantfile.dist
tmp/Vagrantfile: package.box
mkdir -p tmp
tar xzf package.box -C tmp/
sed -i.back '/vagrant_private_key/d' tmp/Vagrantfile
rm -f tmp/Vagrantfile.back
rm -f tmp/vagrant_private_key
stripped.box: tmp/Vagrantfile
tar -czf stripped.box -C tmp/ .
box.meta: stripped.box box-metadata.sh
./box-metadata.sh stripped.box ${VERSION} box.meta
clean: ; \
vagrant destroy -f
rm -f package.box
rm -rf tmp
rm -rf cloned.vdi
rm -f stripped.box
rm -f box.meta
dist-clean: clean
rm -f etcd-*.tar.gz
rm -f kubernetes-*.tar.gz