Finish basic version of the new ubuntu base boxes build
This commit is contained in:
parent
f927f65ec1
commit
8d3d84aef2
4 changed files with 14 additions and 26 deletions
|
@ -9,7 +9,7 @@ $(UBUNTU_BOXES): CONTAINER = "vagrant-lxc-base-${@}-amd64-${TODAY}"
|
||||||
$(UBUNTU_BOXES): PACKAGE = "output/vagrant-lxc-${@}-amd64-${TODAY}.box"
|
$(UBUNTU_BOXES): PACKAGE = "output/vagrant-lxc-${@}-amd64-${TODAY}.box"
|
||||||
$(UBUNTU_BOXES):
|
$(UBUNTU_BOXES):
|
||||||
@sudo -E ./mk-ubuntu.sh $(@) amd64 $(CONTAINER) $(PACKAGE)
|
@sudo -E ./mk-ubuntu.sh $(@) amd64 $(CONTAINER) $(PACKAGE)
|
||||||
@chmod +rw $(PACKAGE)
|
@sudo chmod +rw $(PACKAGE)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "Implement clean"
|
@echo "Implement clean"
|
||||||
|
|
|
@ -11,7 +11,7 @@ debug 'Stopping container'
|
||||||
lxc-stop -n ${CONTAINER} &>/dev/null || true
|
lxc-stop -n ${CONTAINER} &>/dev/null || true
|
||||||
|
|
||||||
if [ -f ${WORKING_DIR}/rootfs.tar.gz ]; then
|
if [ -f ${WORKING_DIR}/rootfs.tar.gz ]; then
|
||||||
log "Removing previous rootfs tarbal"
|
log "Removing previous rootfs tarball"
|
||||||
rm -f ${WORKING_DIR}/rootfs.tar.gz
|
rm -f ${WORKING_DIR}/rootfs.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -22,27 +22,13 @@ pushd $(dirname ${ROOTFS}) &>/dev/null
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
|
||||||
# Prepare package contents
|
# Prepare package contents
|
||||||
pushd ${WORKING_DIR} &>/dev/null
|
log 'Preparing box package contents'
|
||||||
warn "TODO: Package on `pwd`"
|
cp common/lxc-template ${WORKING_DIR}
|
||||||
warn "TODO: Add creation date"
|
cp conf/ubuntu ${WORKING_DIR}/lxc-config
|
||||||
warn "TODO: Fix hostname (its too big!)"
|
cp conf/metadata.json ${WORKING_DIR}
|
||||||
popd &>/dev/null
|
sed -i "s/<TODAY>/${NOW}/" ${WORKING_DIR}/metadata.json
|
||||||
|
|
||||||
# cp $LXC_TEMPLATE .
|
# Vagrant box!
|
||||||
# cp $LXC_CONF .
|
log 'Packaging box'
|
||||||
# cp $METATADA_JSON .
|
TARBALL=$(readlink -f ${PACKAGE})
|
||||||
# chmod +x lxc-template
|
(cd ${WORKING_DIR} && tar -czf $TARBALL ./*)
|
||||||
# sed -i "s/<TODAY>/${NOW}/" metadata.json
|
|
||||||
#
|
|
||||||
# # Vagrant box!
|
|
||||||
# tar -czf $PKG ./*
|
|
||||||
#
|
|
||||||
# chmod +rw ${WORKING_DIR}/${PKG}
|
|
||||||
# mkdir -p ${CWD}/output
|
|
||||||
# mv ${WORKING_DIR}/${PKG} ${CWD}/output
|
|
||||||
#
|
|
||||||
# # Clean up after ourselves
|
|
||||||
# rm -rf ${WORKING_DIR}
|
|
||||||
# lxc-destroy -n ${RELEASE}-base
|
|
||||||
#
|
|
||||||
# echo "The base box was built successfully to ${CWD}/output/${PKG}"
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"provider": "lxc",
|
"provider": "lxc",
|
||||||
"version": "3",
|
"version": "1.0.0",
|
||||||
"built-on": "<TODAY>"
|
"built-on": "<TODAY>"
|
||||||
}
|
}
|
|
@ -20,6 +20,7 @@ export CONTAINER=$3
|
||||||
export PACKAGE=$4
|
export PACKAGE=$4
|
||||||
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)
|
||||||
|
|
||||||
if [ -f ${PACKAGE} ]; then
|
if [ -f ${PACKAGE} ]; then
|
||||||
warn "The box '${PACKAGE}' already exists, skipping..."
|
warn "The box '${PACKAGE}' already exists, skipping..."
|
||||||
|
@ -39,4 +40,5 @@ info "Building box to '${PACKAGE}'..."
|
||||||
./common/package.sh ${CONTAINER} ${PACKAGE}
|
./common/package.sh ${CONTAINER} ${PACKAGE}
|
||||||
|
|
||||||
info "Finished building '${PACKAGE}'!"
|
info "Finished building '${PACKAGE}'!"
|
||||||
|
log "Run \`sudo lxc-destroy -n ${CONTAINER}\` to remove the container that was created along the way"
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Add table
Reference in a new issue