2018-08-11 10:35:40 +02:00
#!/bin/sh
2020-08-15 12:47:57 -04:00
image = "docker.io/antora/antora"
2018-09-23 13:44:43 +02:00
cmd = "--html-url-extension-style=indexify site.yml"
2020-08-15 12:47:57 -04:00
if [ " $( uname) " = "Darwin" ] ; then
2018-08-11 10:35:40 +02:00
# Running on macOS.
# Let's assume that the user has the Docker CE installed
# which doesn't require a root password.
2020-08-15 12:47:57 -04:00
echo ""
echo "This build script is using Docker container runtime to run the build in an isolated environment."
echo ""
docker run --rm -it -v " $( pwd ) :/antora " $image $cmd
elif [ " $( expr substr " $( uname -s) " 1 5) " = "Linux" ] ; then
2018-08-11 10:35:40 +02:00
# Running on Linux.
2020-09-24 11:32:54 -03:00
# Check whether podman is available, else fail back to docker
2018-08-11 10:35:40 +02:00
# which requires root.
2020-08-15 12:47:57 -04:00
if [ -f /usr/bin/podman ] ; then
echo ""
echo "This build script is using Podman to run the build in an isolated environment."
echo ""
podman run --rm -it -v " $( pwd ) :/antora:z " $image $cmd
elif [ -f /usr/bin/docker ] ; then
2018-09-23 13:44:43 +02:00
echo ""
echo "This build script is using Docker to run the build in an isolated environment."
echo ""
2020-08-15 12:47:57 -04:00
if groups | grep -wq "docker" ; then
docker run --rm -it -v " $( pwd ) :/antora:z " $image $cmd
else
echo ""
echo " This build script is using $runtime to run the build in an isolated environment. You might be asked for your password. "
echo "You can avoid this by adding your user to the 'docker' group, but be aware of the security implications. See https://docs.docker.com/install/linux/linux-postinstall/."
echo ""
sudo docker run --rm -it -v " $( pwd ) :/antora:z " $image $cmd
fi
2018-09-23 13:44:43 +02:00
else
echo ""
2020-08-15 12:47:57 -04:00
echo "Error: Container runtime haven't been found on your system. Fix it by:"
echo " $ sudo dnf install podman "
exit 1
2018-09-23 13:44:43 +02:00
fi
2020-08-15 12:47:57 -04:00
fi