43 lines
738 B
Bash
Executable File
43 lines
738 B
Bash
Executable File
#!/bin/bash
|
|
|
|
function exitFailure() {
|
|
echo "Exiting $1"
|
|
exit 1
|
|
}
|
|
|
|
function checkDependencies {
|
|
if ! command python3 --version &>/dev/null; then
|
|
exitFailure "python3 not installed"
|
|
fi
|
|
|
|
if ! command docker &>/dev/null; then
|
|
exitFailure "docker not installed"
|
|
fi
|
|
|
|
if [[ ! -e /var/run/libvirt/libvirt-sock ]]; then
|
|
exitFailure "libvirt-socket not detected"
|
|
fi
|
|
}
|
|
|
|
function setupEnvironment {
|
|
checkDependencies
|
|
|
|
if [[ ! -d venv ]]; then
|
|
python3 -m venv venv
|
|
fi
|
|
|
|
# shellcheck disable=SC1091
|
|
. venv/bin/activate
|
|
|
|
pip3 install -r ./requierments.txt
|
|
|
|
}
|
|
|
|
function dockerImageInit {
|
|
cd ./localImages || exitFailure "change dir failed"
|
|
docker build . -t kybus:latest
|
|
}
|
|
|
|
setupEnvironment
|
|
dockerImageInit
|