Add support for building with Podman

For those users who have both Docker and Podman installed, Docker will be used
by default unless the new "-e" option is used to specify which container engine
to use.

For those users who only have Podman installed, the script will use it without
having to specify a container engine.
This commit is contained in:
Vicente Olivert Riera 2022-07-04 12:25:53 +09:00
parent 35b5d97ab7
commit 919e572c8c
No known key found for this signature in database
GPG key ID: 5DE0950419F6E531
2 changed files with 17 additions and 4 deletions

View file

@ -4,7 +4,8 @@ This repository contains the source to build a Debian package for [alacritty](ht
## Usage
If you have [Docker](https://www.docker.com/) installed locally, just run the following:
If you have [Docker](https://www.docker.com/) or [Podman](https://podman.io/)
installed locally, just run the following:
```bash
user@hostname$ ./build.sh

View file

@ -6,7 +6,16 @@ IMAGE="debian:bullseye-slim"
TARGET="$(dirname "$0" | xargs realpath)"
VERSION="v0.10.1"
while getopts "v:i:h" opt
if hash docker; then
ENGINE="docker"
elif hash podman; then
ENGINE="podman"
else
echo "ERROR: A supported container engine was not found!"
exit 1
fi
while getopts "v:i:e:h" opt
do
case "$opt" in
v)
@ -15,8 +24,11 @@ do
i)
IMAGE="$OPTARG"
;;
e)
ENGINE="$OPTARG"
;;
h)
echo "Usage: $0 [-i image] [-v version]"
echo "Usage: $0 [-i image] [-v version] [-e docker|podman]"
exit 0
;;
*)
@ -26,7 +38,7 @@ do
done
main() {
docker run --rm --name alacritty-build-$$ \
${ENGINE} run --rm --name alacritty-build-$$ \
--volume "$TARGET:/target" \
--workdir /target \
--env "VERSION=$VERSION" \