vagrant-lxc-base-boxes/mk-debian.sh

49 lines
1.1 KiB
Bash
Raw Permalink Normal View History

2014-03-25 03:26:19 +00:00
#!/bin/bash
set -e
source common/ui.sh
source common/utils.sh
2014-03-25 03:26:19 +00:00
export DISTRIBUTION=$1
export RELEASE=$2
export ARCH=$3
export CONTAINER=$4
export PACKAGE=$5
2015-12-27 15:34:32 +00:00
export ADDPACKAGES=${ADDPACKAGES-$(cat ${RELEASE}_packages | tr "\n" " ")}
export ROOTFS="${HOME}/.local/share/lxc/${CONTAINER}/rootfs"
2014-03-25 03:26:19 +00:00
export WORKING_DIR="/tmp/${CONTAINER}"
export NOW=$(date -u)
2018-04-15 21:01:03 +00:00
echo '############################################'
echo "# Beginning build at $(date)"
2014-03-25 03:26:19 +00:00
if [ -f ${PACKAGE} ]; then
warn "The box '${PACKAGE}' already exists, skipping..."
echo
exit
fi
debug "Creating ${WORKING_DIR}"
mkdir -p ${WORKING_DIR}
info "Building box to '${PACKAGE}'..."
./common/download.sh ${DISTRIBUTION} ${RELEASE} ${ARCH} ${CONTAINER}
utils.lxc.start
SECS=15
log "Sleeping for $SECS seconds..."
sleep $SECS
utils.lxc.runscript debian/vagrant-lxc-fixes.sh
utils.lxc.runscript debian/install-extras.sh
utils.lxc.runscript common/prepare-vagrant-user.sh
utils.lxc.runscript debian/clean.sh
utils.lxc.stop
./common/package.sh
2014-03-25 03:26:19 +00:00
info "Finished building '${PACKAGE}'!"
log "Run \`lxc-destroy -n ${CONTAINER}\` or \`make clean\` to remove the container that was created along the way"
2014-03-25 03:26:19 +00:00
echo