#!/bin/bash

if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

# TODO(lucasagomes): optimize the ramdisk for other OSs
if [ $DISTRO_NAME = 'fedora' ] ; then

    install-packages -e kernel-debug-devel gcc fedora-logos python3 rsync sudo pykickstart grubby make genisoimage tcpdump man-db policycoreutils kbd-misc plymouth cronie

    if [ $DIB_RELEASE -ge 22 ]; then
        # Remove yum, >= F22 defaults to dnf
        dnf remove yum -y
        # Remove package manager cache
        dnf clean all
    else
        # Remove package manager cache
        yum clean all
    fi

    # Rebuilding the rpm database after removing packages will reduce
    # its size
    rpm --rebuilddb

fi
