vagrant-lxc-base-boxes/common/utils.sh
Virgil Dupras 00a4664d73 Add gentoo dist
and remove ${LOG}. It's a bit of a useless mechanism and, in fact a
hindrance. Why not just let the user redirect stdout?
2018-04-22 21:59:45 -04:00

33 lines
624 B
Bash

#!/bin/bash
utils.lxc.attach() {
cmd="$@"
log "Running [${cmd}] inside '${CONTAINER}' container..."
lxc-attach -n ${CONTAINER} -- $cmd
}
utils.lxc.pipetofile() {
lxc-attach -n ${CONTAINER} -- /bin/bash -c "tee $1 > /dev/null"
}
utils.lxc.runscript() {
log "Running $1 inside '${CONTAINER}'..."
cat $1 | utils.lxc.pipetofile /script.sh
utils.lxc.attach /bin/bash /script.sh
}
utils.lxc.start() {
lxc-start -d -n ${CONTAINER} || true
}
utils.lxc.stop() {
lxc-stop -n ${CONTAINER} || true
}
utils.lxc.destroy() {
lxc-destroy -n ${CONTAINER}
}
utils.lxc.create() {
lxc-create -n ${CONTAINER} "$@"
}