vagrant-lxc-base-boxes/Makefile

70 lines
2.3 KiB
Makefile
Raw Normal View History

UBUNTU_BOXES= xenial
DEBIAN_BOXES= jessie stretch sid
CENTOS_BOXES= 7
FEDORA_BOXES= rawhide 23
2014-03-25 03:26:19 +00:00
TODAY=$(shell date -u +"%Y-%m-%d")
2014-05-03 14:34:38 +00:00
# Replace i686 with i386 and x86_64 with amd64
ARCH=$(shell uname -m | sed -e "s/68/38/" | sed -e "s/x86_64/amd64/")
2014-04-28 01:31:23 +00:00
2014-03-25 03:26:19 +00:00
default:
all: ubuntu debian fedora
2014-03-25 03:26:19 +00:00
ubuntu: $(UBUNTU_BOXES)
debian: $(DEBIAN_BOXES)
2014-09-24 15:16:20 +00:00
centos: $(CENTOS_BOXES)
fedora: $(FEDORA_BOXES)
2014-03-25 03:26:19 +00:00
# REFACTOR: Figure out how can we reduce duplicated code
2014-04-28 01:31:23 +00:00
$(UBUNTU_BOXES): CONTAINER = "vagrant-base-${@}-$(ARCH)"
$(UBUNTU_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-${@}-$(ARCH).box"
2014-03-25 03:26:19 +00:00
$(UBUNTU_BOXES):
@mkdir -p $$(dirname $(PACKAGE))
@./mk-debian.sh ubuntu $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
@chmod +rw $(PACKAGE)
@chown ${USER}: $(PACKAGE)
2014-04-28 01:31:23 +00:00
$(DEBIAN_BOXES): CONTAINER = "vagrant-base-${@}-$(ARCH)"
$(DEBIAN_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-${@}-$(ARCH).box"
2014-03-25 03:26:19 +00:00
$(DEBIAN_BOXES):
@mkdir -p $$(dirname $(PACKAGE))
@./mk-debian.sh debian $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
@chmod +rw $(PACKAGE)
@chown ${USER}: $(PACKAGE)
2014-09-24 15:16:20 +00:00
$(CENTOS_BOXES): CONTAINER = "vagrant-base-centos-${@}-$(ARCH)"
$(CENTOS_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-centos-${@}-$(ARCH).box"
$(CENTOS_BOXES):
@mkdir -p $$(dirname $(PACKAGE))
@./mk-centos.sh $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
@chmod +rw $(PACKAGE)
@chown ${USER}: $(PACKAGE)
$(FEDORA_BOXES): CONTAINER = "vagrant-base-fedora-${@}-$(ARCH)"
$(FEDORA_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-fedora-${@}-$(ARCH).box"
$(FEDORA_BOXES):
@mkdir -p $$(dirname $(PACKAGE))
@./mk-fedora.sh $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
@chmod +rw $(PACKAGE)
@chown ${USER}: $(PACKAGE)
2014-03-25 03:26:19 +00:00
2014-04-28 01:31:23 +00:00
acceptance: CONTAINER = "vagrant-base-acceptance-$(ARCH)"
acceptance: PACKAGE = "output/${TODAY}/vagrant-lxc-acceptance-$(ARCH).box"
2014-03-25 03:26:19 +00:00
acceptance:
@mkdir -p $$(dirname $(PACKAGE))
@PUPPET=1 CHEF=1 ./mk-debian.sh ubuntu precise $(ARCH) $(CONTAINER) $(PACKAGE)
@chmod +rw $(PACKAGE)
@chown ${USER}: $(PACKAGE)
2014-03-25 03:26:19 +00:00
2014-09-24 15:16:20 +00:00
release:
@test -z '$(version)' && echo 'version parameter not provided to `make`!' && exit 1 || return 0
gh release create -d -a output/${TODAY} $(version)
git tag $(version)
git push && git push --tags
clean: ALL_BOXES = ${DEBIAN_BOXES} ${UBUNTU_BOXES} ${CENTOS_BOXES} ${FEDORA_BOXES} acceptance
2014-03-25 03:26:19 +00:00
clean:
@for r in $(ALL_BOXES); do \
./clean.sh $${r}\
2014-12-23 00:12:09 +00:00
vagrant-base-$${r}-$(ARCH) \
output/${TODAY}/vagrant-lxc-$${r}-$(ARCH).box; \
done