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):
|
||||
@sudo -E ./mk-ubuntu.sh $(@) amd64 $(CONTAINER) $(PACKAGE)
|
||||
@chmod +rw $(PACKAGE)
|
||||
@sudo chmod +rw $(PACKAGE)
|
||||
|
||||
clean:
|
||||
@echo "Implement clean"
|
||||
|
|
|
@ -11,7 +11,7 @@ debug 'Stopping container'
|
|||
lxc-stop -n ${CONTAINER} &>/dev/null || true
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
|
@ -22,27 +22,13 @@ pushd $(dirname ${ROOTFS}) &>/dev/null
|
|||
popd &>/dev/null
|
||||
|
||||
# Prepare package contents
|
||||
pushd ${WORKING_DIR} &>/dev/null
|
||||
warn "TODO: Package on `pwd`"
|
||||
warn "TODO: Add creation date"
|
||||
warn "TODO: Fix hostname (its too big!)"
|
||||
popd &>/dev/null
|
||||
log 'Preparing box package contents'
|
||||
cp common/lxc-template ${WORKING_DIR}
|
||||
cp conf/ubuntu ${WORKING_DIR}/lxc-config
|
||||
cp conf/metadata.json ${WORKING_DIR}
|
||||
sed -i "s/<TODAY>/${NOW}/" ${WORKING_DIR}/metadata.json
|
||||
|
||||
# cp $LXC_TEMPLATE .
|
||||
# cp $LXC_CONF .
|
||||
# cp $METATADA_JSON .
|
||||
# chmod +x lxc-template
|
||||
# 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}"
|
||||
# Vagrant box!
|
||||
log 'Packaging box'
|
||||
TARBALL=$(readlink -f ${PACKAGE})
|
||||
(cd ${WORKING_DIR} && tar -czf $TARBALL ./*)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"provider": "lxc",
|
||||
"version": "3",
|
||||
"version": "1.0.0",
|
||||
"built-on": "<TODAY>"
|
||||
}
|
|
@ -20,6 +20,7 @@ export CONTAINER=$3
|
|||
export PACKAGE=$4
|
||||
export ROOTFS="/var/lib/lxc/${CONTAINER}/rootfs"
|
||||
export WORKING_DIR="/tmp/${CONTAINER}"
|
||||
export NOW=$(date -u)
|
||||
|
||||
if [ -f ${PACKAGE} ]; then
|
||||
warn "The box '${PACKAGE}' already exists, skipping..."
|
||||
|
@ -39,4 +40,5 @@ info "Building box to '${PACKAGE}'..."
|
|||
./common/package.sh ${CONTAINER} ${PACKAGE}
|
||||
|
||||
info "Finished building '${PACKAGE}'!"
|
||||
log "Run \`sudo lxc-destroy -n ${CONTAINER}\` to remove the container that was created along the way"
|
||||
echo
|
||||
|
|
Loading…
Reference in a new issue