2014-03-08 02:34:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2014-03-08 05:23:06 +00:00
|
|
|
source common/ui.sh
|
|
|
|
|
2014-03-08 02:34:09 +00:00
|
|
|
if [ "$(id -u)" != "0" ]; then
|
|
|
|
echo "You should run this script as root (sudo)."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
export NO_COLOR='\033[0m'
|
|
|
|
export OK_COLOR='\033[32;01m'
|
|
|
|
export ERROR_COLOR='\033[31;01m'
|
|
|
|
export WARN_COLOR='\033[33;01m'
|
|
|
|
|
|
|
|
export DISTRIBUTION="ubuntu"
|
|
|
|
export RELEASE=$1
|
|
|
|
export ARCH=$2
|
|
|
|
export CONTAINER=$3
|
|
|
|
export PACKAGE=$4
|
2014-03-08 05:23:06 +00:00
|
|
|
export ROOTFS="/var/lib/lxc/${CONTAINER}/rootfs"
|
2014-03-08 02:34:09 +00:00
|
|
|
|
|
|
|
if [ -f ${PACKAGE} ]; then
|
2014-03-08 05:23:06 +00:00
|
|
|
warn "The box '${PACKAGE}' already exists, skipping..."
|
2014-03-08 02:34:09 +00:00
|
|
|
echo
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2014-03-08 05:23:06 +00:00
|
|
|
info "Building box to '${PACKAGE}'..."
|
2014-03-08 02:34:09 +00:00
|
|
|
|
|
|
|
./common/download.sh ubuntu ${RELEASE} ${ARCH} ${CONTAINER}
|
|
|
|
./common/prepare-vagrant-user.sh ${CONTAINER}
|
|
|
|
./debian/install-extras.sh ${CONTAINER}
|
|
|
|
./debian/clean.sh ${CONTAINER}
|
|
|
|
./common/package.sh ${CONTAINER} ${PACKAGE}
|
|
|
|
touch $PACKAGE
|
|
|
|
|
2014-03-08 05:23:06 +00:00
|
|
|
info "Finished building '${PACKAGE}'!"
|
2014-03-08 02:34:09 +00:00
|
|
|
echo
|