install: check for docker

This commit is contained in:
knoflook 2022-06-03 13:25:46 +02:00
parent 0540e42168
commit 7e280ee0c5
Signed by: knoflook
GPG Key ID: D6A1D0E8FC4FEF1C
1 changed files with 30 additions and 0 deletions

View File

@ -12,6 +12,35 @@ for arg in "$@"; do
fi
done
function check_docker {
dockerpath=$(which dockker)
if [ -z $dockerpath ]; then
echo "Docker was not found in your \$PATH. Attempt automatic installation? [y/N]"
read answer
if [[ $answer == "y" ]]; then
wget -O- https://get.docker.com | bash
else
echo "Please install docker manually or add it to your \$PATH and re-run the installation script"
exit 1
fi
fi
docker info > /dev/null
if [[ $? != 0 ]]; then
echo "docker info returned a non-zero value. This could be caused by your user not being in the docker group. Add user to docker group? [y/N]"
read answer
if [[ $answer == "y" ]]; then
sudo usermod -aG docker $USER
if [[ $? != 0 ]]; then
echo "Adding user failed. Add your user to docker group and re-run the installer"
exit 1
fi
else
echo "Add your user to docker group and re-run the installer"
exit 1
fi
fi
}
function show_banner {
echo ""
echo " ____ ____ _ _ "
@ -101,6 +130,7 @@ function install_abra_release {
function run_installation {
check_docker
show_banner
install_abra_release
}