boxes: Getting ready to build debians

This commit is contained in:
Fabio Rehm 2014-03-09 21:35:53 -03:00
parent deac5930cc
commit 4f5d95b7f3
2 changed files with 22 additions and 9 deletions

View file

@ -1,20 +1,33 @@
UBUNTU_BOXES= precise quantal raring saucy trusty UBUNTU_BOXES= precise quantal raring saucy trusty
DEBIAN_BOXES= squeeze wheezy sid
TODAY=$(shell date -u +"%Y-%m-%d") TODAY=$(shell date -u +"%Y-%m-%d")
default: 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): CONTAINER = "vagrant-lxc-base-${@}-amd64"
$(UBUNTU_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-${@}-amd64.box" $(UBUNTU_BOXES): PACKAGE = "output/${TODAY}/vagrant-lxc-${@}-amd64.box"
$(UBUNTU_BOXES): $(UBUNTU_BOXES):
@mkdir -p $$(dirname $(PACKAGE)) @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 chmod +rw $(PACKAGE)
@sudo chown ${USER}: $(PACKAGE) @sudo chown ${USER}: $(PACKAGE)
clean: ALL_BOXES = ${DEBIAN_BOXES} ${UBUNTU_BOXES}
clean: clean:
@for r in $(UBUNTU_BOXES); do \ @for r in $(ALL_BOXES); do \
sudo -E ./clean.sh $${r}\ sudo -E ./clean.sh $${r}\
vagrant-lxc-base-$${r}-amd64 \ vagrant-lxc-base-$${r}-amd64 \
output/${TODAY}/vagrant-lxc-$${r}-amd64-${TODAY}.box; \ output/${TODAY}/vagrant-lxc-$${r}-amd64-${TODAY}.box; \

View file

@ -8,11 +8,11 @@ if [ "$(id -u)" != "0" ]; then
exit 1 exit 1
fi fi
export DISTRIBUTION="ubuntu" export DISTRIBUTION=$1
export RELEASE=$1 export RELEASE=$2
export ARCH=$2 export ARCH=$3
export CONTAINER=$3 export CONTAINER=$4
export PACKAGE=$4 export PACKAGE=$5
export ROOTFS="/var/lib/lxc/${CONTAINER}/rootfs" export ROOTFS="/var/lib/lxc/${CONTAINER}/rootfs"
export WORKING_DIR="/tmp/${CONTAINER}" export WORKING_DIR="/tmp/${CONTAINER}"
export NOW=$(date -u) export NOW=$(date -u)
@ -35,7 +35,7 @@ mkdir -p ${WORKING_DIR}
info "Building box to '${PACKAGE}'..." 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} ./common/prepare-vagrant-user.sh ${CONTAINER}
./debian/install-extras.sh ${CONTAINER} ./debian/install-extras.sh ${CONTAINER}
./debian/clean.sh ${CONTAINER} ./debian/clean.sh ${CONTAINER}