vagrant-lxc-base-boxes/Makefile

61 lines
2.1 KiB
Makefile
Raw Normal View History

UBUNTU_BOXES= precise quantal raring saucy trusty utopic
2014-03-25 03:26:19 +00:00
DEBIAN_BOXES= squeeze wheezy sid jessie
2014-09-24 15:16:20 +00:00
CENTOS_BOXES= 6
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
ubuntu: $(UBUNTU_BOXES)
debian: $(DEBIAN_BOXES)
2014-09-24 15:16:20 +00:00
centos: $(CENTOS_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)
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))
2014-04-28 01:31:23 +00:00
@PUPPET=1 CHEF=1 sudo -E ./mk-debian.sh ubuntu precise $(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} acceptance
2014-03-25 03:26:19 +00:00
clean:
@for r in $(ALL_BOXES); do \
sudo -E ./clean.sh $${r}\
2014-04-28 01:31:23 +00:00
vagrant-base-$${r}-$(ARCH) \
output/${TODAY}/vagrant-lxc-$${r}-$(ARCH).box; \
2014-03-25 03:26:19 +00:00
done