boxes: Implement make clean
This commit is contained in:
parent
ff3baf1cd4
commit
85d36bfd41
3 changed files with 33 additions and 3 deletions
|
@ -12,5 +12,8 @@ $(UBUNTU_BOXES):
|
||||||
@sudo chmod +rw $(PACKAGE)
|
@sudo chmod +rw $(PACKAGE)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "Implement clean"
|
@for r in $(UBUNTU_BOXES); do \
|
||||||
@exit 1
|
sudo -E ./clean.sh $${r}\
|
||||||
|
vagrant-lxc-base-$${r}-amd64-${TODAY} \
|
||||||
|
output/vagrant-lxc-$${r}-amd64-${TODAY}.box; \
|
||||||
|
done
|
||||||
|
|
27
boxes/clean.sh
Executable file
27
boxes/clean.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
source common/ui.sh
|
||||||
|
|
||||||
|
export RELEASE=$1
|
||||||
|
export CONTAINER=$2
|
||||||
|
export PACKAGE=$3
|
||||||
|
export LOG=$(readlink -f .)/log/${CONTAINER}.log
|
||||||
|
|
||||||
|
info "Cleaning ${RELEASE} artifacts..."
|
||||||
|
|
||||||
|
# If container exists, check if want to continue
|
||||||
|
if $(lxc-ls | grep -q ${CONTAINER}); then
|
||||||
|
log "Removing '${CONTAINER}' container"
|
||||||
|
lxc-stop -n ${CONTAINER} &>/dev/null || true
|
||||||
|
lxc-destroy -n ${CONTAINER}
|
||||||
|
else
|
||||||
|
log "The container '${CONTAINER}' does not exist"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e ${PACKAGE} ]; then
|
||||||
|
log "Removing '${PACKAGE}'"
|
||||||
|
rm -f ${PACKAGE}
|
||||||
|
else
|
||||||
|
log "The package '${PACKAGE}' does not exist"
|
||||||
|
fi
|
|
@ -36,5 +36,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"
|
log "Run \`sudo lxc-destroy -n ${CONTAINER}\` or \`make clean\` to remove the container that was created along the way"
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Add table
Reference in a new issue