From 4f5d95b7f31056a757398e28b6261f6965a99c2c Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sun, 9 Mar 2014 21:35:53 -0300 Subject: [PATCH] boxes: Getting ready to build debians --- boxes/Makefile | 19 ++++++++++++++++--- boxes/{mk-ubuntu.sh => mk-debian.sh} | 12 ++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) rename boxes/{mk-ubuntu.sh => mk-debian.sh} (85%) diff --git a/boxes/Makefile b/boxes/Makefile index e7d5f91..9114f25 100644 --- a/boxes/Makefile +++ b/boxes/Makefile @@ -1,20 +1,33 @@ UBUNTU_BOXES= precise quantal raring saucy trusty +DEBIAN_BOXES= squeeze wheezy sid TODAY=$(shell date -u +"%Y-%m-%d") default: -all: $(UBUNTU_BOXES) +all: ubuntu debian +ubuntu: $(UBUNTU_BOXES) +debian: $(DEBIAN_BOXES) + +# REFACTOR: Figure out how can we reduce duplicated code $(UBUNTU_BOXES): CONTAINER = "vagrant-lxc-base-${@}-amd64" $(UBUNTU_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-${@}-amd64.box" $(UBUNTU_BOXES): @mkdir -p $$(dirname $(PACKAGE)) - @sudo -E ./mk-ubuntu.sh $(@) amd64 $(CONTAINER) $(PACKAGE) + @sudo -E ./mk-debian.sh ubuntu $(@) amd64 $(CONTAINER) $(PACKAGE) + @sudo chmod +rw $(PACKAGE) + @sudo chown ${USER}: $(PACKAGE) +$(DEBIAN_BOXES): CONTAINER = "vagrant-lxc-base-${@}-amd64" +$(DEBIAN_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-${@}-amd64.box" +$(DEBIAN_BOXES): + @mkdir -p $$(dirname $(PACKAGE)) + @sudo -E ./mk-debian.sh debian $(@) amd64 $(CONTAINER) $(PACKAGE) @sudo chmod +rw $(PACKAGE) @sudo chown ${USER}: $(PACKAGE) +clean: ALL_BOXES = ${DEBIAN_BOXES} ${UBUNTU_BOXES} clean: - @for r in $(UBUNTU_BOXES); do \ + @for r in $(ALL_BOXES); do \ sudo -E ./clean.sh $${r}\ vagrant-lxc-base-$${r}-amd64 \ output/${TODAY}/vagrant-lxc-$${r}-amd64-${TODAY}.box; \ diff --git a/boxes/mk-ubuntu.sh b/boxes/mk-debian.sh similarity index 85% rename from boxes/mk-ubuntu.sh rename to boxes/mk-debian.sh index 4d5c9ab..a1b5d0c 100755 --- a/boxes/mk-ubuntu.sh +++ b/boxes/mk-debian.sh @@ -8,11 +8,11 @@ if [ "$(id -u)" != "0" ]; then exit 1 fi -export DISTRIBUTION="ubuntu" -export RELEASE=$1 -export ARCH=$2 -export CONTAINER=$3 -export PACKAGE=$4 +export DISTRIBUTION=$1 +export RELEASE=$2 +export ARCH=$3 +export CONTAINER=$4 +export PACKAGE=$5 export ROOTFS="/var/lib/lxc/${CONTAINER}/rootfs" export WORKING_DIR="/tmp/${CONTAINER}" export NOW=$(date -u) @@ -35,7 +35,7 @@ mkdir -p ${WORKING_DIR} info "Building box to '${PACKAGE}'..." -./common/download.sh ubuntu ${RELEASE} ${ARCH} ${CONTAINER} +./common/download.sh ${DISTRIBUTION} ${RELEASE} ${ARCH} ${CONTAINER} ./common/prepare-vagrant-user.sh ${CONTAINER} ./debian/install-extras.sh ${CONTAINER} ./debian/clean.sh ${CONTAINER}