# Test coverage provided by this container:
# - arm64
# - strict hostonly
# - network-legacy
# - mkosi-initrd
# - hmaccalc (fido)
# - rdma out of tree dracut module
# - dbus-broker
# - network: network-legacy, network-manager

FROM registry.opensuse.org/opensuse/tumbleweed:latest

# Install needed packages for the dracut CI container
RUN zypper --non-interactive install --no-recommends \
    bash-completion \
    btrfsprogs \
    cargo \
    cpio \
    cryptsetup \
    dhcp-client \
    dhcp-server \
    distribution-gpg-keys \
    e2fsprogs \
    erofs-utils \
    gcc \
    git \
    hmaccalc \
    iproute2 \
    iputils \
    iscsiuio \
    kbd \
    kernel-vanilla \
    libfido2 \
    libkmod-devel \
    lvm2 \
    make \
    mdadm \
    mkosi-initrd \
    nbd \
    NetworkManager \
    nfs-kernel-server \
    open-iscsi \
    parted \
    pciutils \
    python3-pefile \
    qemu \
    ruby3.4-rubygem-asciidoctor \
    squashfs \
    swtpm \
    systemd-boot \
    systemd-devel \
    systemd-experimental \
    systemd-portable \
    tgt \
    tpm2.0-tools \
    util-linux-systemd \
    xorriso \
    && zypper --non-interactive dist-upgrade --no-recommends

# workaround for openSUSE on arm64
# force strict hostonly mode to increase test coverage
RUN \
    echo 'hostonly_mode="strict"' > /usr/lib/dracut/dracut.conf.d/02-dist.conf ;\
    KVERSION="$(cd /lib/modules && ls -1 | tail -1)" \
    && if [ "$(arch)"="aarch64" ] && [ -e /usr/lib/modules/"$KVERSION"/Image ]; then ln -sf /usr/lib/modules/"$KVERSION"/Image /usr/lib/modules/"$KVERSION"/vmlinuz; fi
