|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Make sure we have the required binaries |
| 4 | +for NAME in podman docker; do |
| 5 | + command -v "${NAME}" &>/dev/null && BINARY=${NAME} |
| 6 | +done |
| 7 | +if [[ -z ${BINARY} ]]; then |
| 8 | + echo "Neither podman nor docker could be found on your system! Please install one to use this script." |
| 9 | + exit 1 |
| 10 | +fi |
| 11 | + |
| 12 | +DOCKER_DISTROS=( |
| 13 | + archlinux/base:latest |
| 14 | + debian:stable-slim |
| 15 | + debian:testing-slim |
| 16 | + debian:unstable-slim |
| 17 | + fedora:latest |
| 18 | + fedora:rawhide |
| 19 | + opensuse/leap:latest |
| 20 | + opensuse/tumbleweed:latest |
| 21 | + ubuntu:18.04 |
| 22 | + ubuntu:20.04 |
| 23 | + ubuntu:latest |
| 24 | + ubuntu:rolling |
| 25 | + ubuntu:devel |
| 26 | +) |
| 27 | + |
| 28 | +BASE=$(dirname "$(readlink -f "${0}")") |
| 29 | +RUN_SCRIPT=${BASE}/run.sh |
| 30 | + |
| 31 | +cat <<'EOF' >"${RUN_SCRIPT}" |
| 32 | +#!/usr/bin/env bash |
| 33 | +
|
| 34 | +RESULTS=$(dirname "$(readlink -f "${0}")")/results.log |
| 35 | +
|
| 36 | +set -x |
| 37 | +
|
| 38 | +# Debian/Ubuntu |
| 39 | +if command -v apt-get &>/dev/null; then |
| 40 | + apt-get update |
| 41 | + DEBIAN_FRONTEND=noninteractive apt-get upgrade -y |
| 42 | + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y clang |
| 43 | +# Fedora |
| 44 | +elif command -v dnf &>/dev/null; then |
| 45 | + dnf update -y |
| 46 | + dnf install -y clang |
| 47 | +# Arch |
| 48 | +elif command -v pacman &>/dev/null; then |
| 49 | + pacman -Syyu --noconfirm |
| 50 | + pacman -S --noconfirm clang |
| 51 | +# OpenSUSE Leap/Tumbleweed |
| 52 | +elif command -v zypper &>/dev/null; then |
| 53 | + zypper -n up |
| 54 | + zypper -n in clang |
| 55 | +fi |
| 56 | +
|
| 57 | +echo "${1}: $(clang --version | head -n1)" >> "${RESULTS}" |
| 58 | +EOF |
| 59 | +chmod +x "${RUN_SCRIPT}" |
| 60 | + |
| 61 | +rm "${BASE}"/results.log |
| 62 | +for DISTRO in "${DOCKER_DISTROS[@]}"; do |
| 63 | + "${BINARY}" pull "${DISTRO}" |
| 64 | + "${BINARY}" run \ |
| 65 | + --rm \ |
| 66 | + --init \ |
| 67 | + --volume="${BASE}:${BASE}" \ |
| 68 | + --workdir="${BASE}" \ |
| 69 | + "${DISTRO}" \ |
| 70 | + "${BASE}"/run.sh "${DISTRO}" |
| 71 | +done |
| 72 | + |
| 73 | +echo |
| 74 | +cat "${BASE}"/results.log |
0 commit comments