From 919e572c8c320dcde4bb205cc503ab5070f0537b Mon Sep 17 00:00:00 2001 From: Vicente Olivert Riera Date: Mon, 4 Jul 2022 12:25:53 +0900 Subject: [PATCH] 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. --- README.md | 3 ++- build.sh | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0060131..7e81f96 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/build.sh b/build.sh index f3d8720..ce881c3 100755 --- a/build.sh +++ b/build.sh @@ -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" \