bc8b070565
I've been hacking my way through building vagrant boxes in unprivileged containers. It works. Barely but it works. I can end up with a functional vagrant box with `make stretch`. The only place where I need `sudo` is when we tar up the root fs because it doesn't belong to the same UID.
69 lines
2.3 KiB
Makefile
69 lines
2.3 KiB
Makefile
UBUNTU_BOXES= xenial
|
|
DEBIAN_BOXES= jessie stretch sid
|
|
CENTOS_BOXES= 7
|
|
FEDORA_BOXES= rawhide 23
|
|
TODAY=$(shell date -u +"%Y-%m-%d")
|
|
|
|
# Replace i686 with i386 and x86_64 with amd64
|
|
ARCH=$(shell uname -m | sed -e "s/68/38/" | sed -e "s/x86_64/amd64/")
|
|
|
|
default:
|
|
|
|
all: ubuntu debian fedora
|
|
|
|
ubuntu: $(UBUNTU_BOXES)
|
|
debian: $(DEBIAN_BOXES)
|
|
centos: $(CENTOS_BOXES)
|
|
fedora: $(FEDORA_BOXES)
|
|
|
|
# REFACTOR: Figure out how can we reduce duplicated code
|
|
$(UBUNTU_BOXES): CONTAINER = "vagrant-base-${@}-$(ARCH)"
|
|
$(UBUNTU_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-${@}-$(ARCH).box"
|
|
$(UBUNTU_BOXES):
|
|
@mkdir -p $$(dirname $(PACKAGE))
|
|
@./mk-debian.sh ubuntu $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
|
|
@chmod +rw $(PACKAGE)
|
|
@chown ${USER}: $(PACKAGE)
|
|
$(DEBIAN_BOXES): CONTAINER = "vagrant-base-${@}-$(ARCH)"
|
|
$(DEBIAN_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-${@}-$(ARCH).box"
|
|
$(DEBIAN_BOXES):
|
|
@mkdir -p $$(dirname $(PACKAGE))
|
|
@./mk-debian.sh debian $(@) $(ARCH) $(CONTAINER) $(PACKAGE)
|
|
@chmod +rw $(PACKAGE)
|
|
@chown ${USER}: $(PACKAGE)
|
|
$(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)
|
|
|
|
acceptance: CONTAINER = "vagrant-base-acceptance-$(ARCH)"
|
|
acceptance: PACKAGE = "output/${TODAY}/vagrant-lxc-acceptance-$(ARCH).box"
|
|
acceptance:
|
|
@mkdir -p $$(dirname $(PACKAGE))
|
|
@PUPPET=1 CHEF=1 ./mk-debian.sh ubuntu precise $(ARCH) $(CONTAINER) $(PACKAGE)
|
|
@chmod +rw $(PACKAGE)
|
|
@chown ${USER}: $(PACKAGE)
|
|
|
|
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
|
|
clean:
|
|
@for r in $(ALL_BOXES); do \
|
|
./clean.sh $${r}\
|
|
vagrant-base-$${r}-$(ARCH) \
|
|
output/${TODAY}/vagrant-lxc-$${r}-$(ARCH).box; \
|
|
done
|