vagrant-lxc-base-boxes/Makefile

46 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2014-03-25 03:26:19 +00:00
UBUNTU_BOXES= precise quantal raring saucy trusty
DEBIAN_BOXES= squeeze wheezy sid jessie
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)
# 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-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)
clean: ALL_BOXES = ${DEBIAN_BOXES} ${UBUNTU_BOXES} acceptance
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