vagrant-lxc-base-boxes/Makefile

74 lines
2.5 KiB
Makefile
Raw Permalink Normal View History

2018-05-01 02:04:29 +00:00
UBUNTU_BOXES= trusty xenial
DEBIAN_BOXES= jessie stretch sid
CENTOS_BOXES= 7
FEDORA_BOXES= 27
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))
2014-04-28 01:31:23 +00:00
@sudo -E ./mk-debian.sh ubuntu $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
2014-03-25 03:26:19 +00:00
@sudo chmod +rw $(PACKAGE)
@sudo 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))
2014-04-28 01:31:23 +00:00
@sudo -E ./mk-debian.sh debian $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
2014-03-25 03:26:19 +00:00
@sudo chmod +rw $(PACKAGE)
@sudo 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))
@sudo -E ./mk-centos.sh $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
@sudo chmod +rw $(PACKAGE)
@sudo 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))
@sudo -E ./mk-fedora.sh $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
@sudo chmod +rw $(PACKAGE)
@sudo chown ${USER}: $(PACKAGE)
2014-03-25 03:26:19 +00:00
.PHONY: gentoo
gentoo:
@sudo -E ./mk-gentoo.sh
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))
2018-05-01 02:04:29 +00:00
@PUPPET=1 CHEF=1 sudo -E ./mk-debian.sh ubuntu xenial $(ARCH) $(CONTAINER) $(PACKAGE)
2014-03-25 03:26:19 +00:00
@sudo chmod +rw $(PACKAGE)
@sudo chown ${USER}: $(PACKAGE)
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 \
sudo -E ./clean.sh $${r}\
2014-12-23 00:12:09 +00:00
vagrant-base-$${r}-$(ARCH) \
output/${TODAY}/vagrant-lxc-$${r}-$(ARCH).box; \
done