#!/bin/sh
set -ev

# Clean documentation
rm -rf /srv/build/doc/*

# Clean basic tar
rm -f /srv/build/vm.tar.gz

# Clean native apps
rm -rf /srv/build/alpine/*

# Clean built LXC packages
rm -rf /srv/build/spoc

# Remove nginx configs
for CONF in $(find /etc/nginx/conf.d -name '*.conf' -a ! -name repo.conf -a ! -name default.conf); do
    rm -f ${CONF}
done
service nginx reload

# Stop running containers
for APP in $(spoc-container list); do
    spoc-container stop ${APP}
done

# Remove data
rm -rf /var/lib/spoc
rm -rf /var/log/spoc
